init commit
This commit is contained in:
@@ -0,0 +1,193 @@
|
||||
namespace PokerStarsBotClientv2.Forms
|
||||
{
|
||||
partial class FormRun
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.labelSelectHH = new System.Windows.Forms.Label();
|
||||
this.textBoxHH = new System.Windows.Forms.TextBox();
|
||||
this.btnSelect = new System.Windows.Forms.Button();
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
this.customInstaller1 = new MySql.Data.MySqlClient.CustomInstaller();
|
||||
this.labelStreamDelay = new System.Windows.Forms.Label();
|
||||
this.labelSeconds = new System.Windows.Forms.Label();
|
||||
this.toggleDelay = new PokerStarsBotClientv2.Forms.MyCheckBox();
|
||||
this.toggleRun = new PokerStarsBotClientv2.Forms.MyCheckBox();
|
||||
this.numericUpDownDelay = new System.Windows.Forms.NumericUpDown();
|
||||
((System.ComponentModel.ISupportInitialize)(this.numericUpDownDelay)).BeginInit();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// labelSelectHH
|
||||
//
|
||||
this.labelSelectHH.AutoSize = true;
|
||||
this.labelSelectHH.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.labelSelectHH.Location = new System.Drawing.Point(86, 51);
|
||||
this.labelSelectHH.Name = "labelSelectHH";
|
||||
this.labelSelectHH.Size = new System.Drawing.Size(378, 20);
|
||||
this.labelSelectHH.TabIndex = 0;
|
||||
this.labelSelectHH.Text = "Select PokerStars handhistory directory of your user:";
|
||||
//
|
||||
// textBoxHH
|
||||
//
|
||||
this.textBoxHH.BackColor = System.Drawing.Color.White;
|
||||
this.textBoxHH.Location = new System.Drawing.Point(90, 85);
|
||||
this.textBoxHH.Name = "textBoxHH";
|
||||
this.textBoxHH.Size = new System.Drawing.Size(374, 20);
|
||||
this.textBoxHH.TabIndex = 1;
|
||||
//
|
||||
// btnSelect
|
||||
//
|
||||
this.btnSelect.BackColor = System.Drawing.Color.DeepSkyBlue;
|
||||
this.btnSelect.FlatAppearance.BorderSize = 0;
|
||||
this.btnSelect.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
|
||||
this.btnSelect.Location = new System.Drawing.Point(461, 85);
|
||||
this.btnSelect.Name = "btnSelect";
|
||||
this.btnSelect.Size = new System.Drawing.Size(92, 20);
|
||||
this.btnSelect.TabIndex = 2;
|
||||
this.btnSelect.Text = "Select";
|
||||
this.btnSelect.UseVisualStyleBackColor = false;
|
||||
this.btnSelect.Click += new System.EventHandler(this.buttonSelect_Click);
|
||||
//
|
||||
// label1
|
||||
//
|
||||
this.label1.AutoSize = true;
|
||||
this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.label1.Location = new System.Drawing.Point(86, 159);
|
||||
this.label1.Name = "label1";
|
||||
this.label1.Size = new System.Drawing.Size(39, 20);
|
||||
this.label1.TabIndex = 3;
|
||||
this.label1.Text = "Run";
|
||||
//
|
||||
// labelStreamDelay
|
||||
//
|
||||
this.labelStreamDelay.AutoSize = true;
|
||||
this.labelStreamDelay.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.labelStreamDelay.Location = new System.Drawing.Point(86, 264);
|
||||
this.labelStreamDelay.Name = "labelStreamDelay";
|
||||
this.labelStreamDelay.Size = new System.Drawing.Size(105, 20);
|
||||
this.labelStreamDelay.TabIndex = 7;
|
||||
this.labelStreamDelay.Text = "Stream Delay";
|
||||
//
|
||||
// labelSeconds
|
||||
//
|
||||
this.labelSeconds.AutoSize = true;
|
||||
this.labelSeconds.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.labelSeconds.Location = new System.Drawing.Point(370, 294);
|
||||
this.labelSeconds.Name = "labelSeconds";
|
||||
this.labelSeconds.Size = new System.Drawing.Size(72, 20);
|
||||
this.labelSeconds.TabIndex = 9;
|
||||
this.labelSeconds.Text = "Seconds";
|
||||
//
|
||||
// toggleDelay
|
||||
//
|
||||
this.toggleDelay.Appearance = System.Windows.Forms.Appearance.Button;
|
||||
this.toggleDelay.BackColor = System.Drawing.Color.Transparent;
|
||||
this.toggleDelay.FlatAppearance.BorderColor = System.Drawing.Color.RoyalBlue;
|
||||
this.toggleDelay.FlatAppearance.BorderSize = 2;
|
||||
this.toggleDelay.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
|
||||
this.toggleDelay.Location = new System.Drawing.Point(90, 297);
|
||||
this.toggleDelay.Name = "toggleDelay";
|
||||
this.toggleDelay.Padding = new System.Windows.Forms.Padding(6);
|
||||
this.toggleDelay.Size = new System.Drawing.Size(61, 25);
|
||||
this.toggleDelay.TabIndex = 8;
|
||||
this.toggleDelay.Text = "myCheckBox2";
|
||||
this.toggleDelay.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
|
||||
this.toggleDelay.UseVisualStyleBackColor = false;
|
||||
this.toggleDelay.CheckedChanged += new System.EventHandler(this.toggleDelay_CheckedChanged);
|
||||
//
|
||||
// toggleRun
|
||||
//
|
||||
this.toggleRun.Appearance = System.Windows.Forms.Appearance.Button;
|
||||
this.toggleRun.BackColor = System.Drawing.Color.Transparent;
|
||||
this.toggleRun.FlatAppearance.BorderColor = System.Drawing.Color.RoyalBlue;
|
||||
this.toggleRun.FlatAppearance.BorderSize = 2;
|
||||
this.toggleRun.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
|
||||
this.toggleRun.Location = new System.Drawing.Point(90, 192);
|
||||
this.toggleRun.Name = "toggleRun";
|
||||
this.toggleRun.Padding = new System.Windows.Forms.Padding(6);
|
||||
this.toggleRun.Size = new System.Drawing.Size(61, 25);
|
||||
this.toggleRun.TabIndex = 6;
|
||||
this.toggleRun.Text = "myCheckBox1";
|
||||
this.toggleRun.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
|
||||
this.toggleRun.UseVisualStyleBackColor = false;
|
||||
this.toggleRun.CheckedChanged += new System.EventHandler(this.toggleRun_CheckedChanged);
|
||||
//
|
||||
// numericUpDownDelay
|
||||
//
|
||||
this.numericUpDownDelay.BackColor = System.Drawing.Color.White;
|
||||
this.numericUpDownDelay.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||
this.numericUpDownDelay.Location = new System.Drawing.Point(461, 297);
|
||||
this.numericUpDownDelay.Maximum = new decimal(new int[] {
|
||||
9999,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
this.numericUpDownDelay.Name = "numericUpDownDelay";
|
||||
this.numericUpDownDelay.Size = new System.Drawing.Size(92, 20);
|
||||
this.numericUpDownDelay.TabIndex = 11;
|
||||
this.numericUpDownDelay.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
|
||||
this.numericUpDownDelay.ValueChanged += new System.EventHandler(this.numericUpDownDelay_ValueChanged);
|
||||
this.numericUpDownDelay.Leave += new System.EventHandler(this.numericUpDownDelay_Leave);
|
||||
//
|
||||
// FormRun
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.BackColor = System.Drawing.Color.White;
|
||||
this.ClientSize = new System.Drawing.Size(686, 422);
|
||||
this.Controls.Add(this.numericUpDownDelay);
|
||||
this.Controls.Add(this.labelSeconds);
|
||||
this.Controls.Add(this.toggleDelay);
|
||||
this.Controls.Add(this.labelStreamDelay);
|
||||
this.Controls.Add(this.toggleRun);
|
||||
this.Controls.Add(this.label1);
|
||||
this.Controls.Add(this.btnSelect);
|
||||
this.Controls.Add(this.textBoxHH);
|
||||
this.Controls.Add(this.labelSelectHH);
|
||||
this.Margin = new System.Windows.Forms.Padding(1);
|
||||
this.Name = "FormRun";
|
||||
this.Text = "FormRun";
|
||||
((System.ComponentModel.ISupportInitialize)(this.numericUpDownDelay)).EndInit();
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.Label labelSelectHH;
|
||||
private System.Windows.Forms.TextBox textBoxHH;
|
||||
private System.Windows.Forms.Button btnSelect;
|
||||
private System.Windows.Forms.Label label1;
|
||||
private MySql.Data.MySqlClient.CustomInstaller customInstaller1;
|
||||
private MyCheckBox toggleRun;
|
||||
private MyCheckBox toggleDelay;
|
||||
private System.Windows.Forms.Label labelStreamDelay;
|
||||
private System.Windows.Forms.Label labelSeconds;
|
||||
private System.Windows.Forms.NumericUpDown numericUpDownDelay;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,195 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.IO;
|
||||
using System.Net;
|
||||
using System.Collections.Specialized;
|
||||
using MySql.Data.MySqlClient;
|
||||
using System.Drawing.Text;
|
||||
using PokerStarsBotClientv2;
|
||||
|
||||
namespace PokerStarsBotClientv2.Forms
|
||||
{
|
||||
public partial class FormRun : Form
|
||||
{
|
||||
// Fields
|
||||
private int LoopIntervalMS = 1000; // worker sleep duration in milliseconds in checking loop
|
||||
private List<FileInfo> UploadList = new List<FileInfo>();
|
||||
public Dictionary<string, DateTime> dictionary = new Dictionary<string, DateTime>();
|
||||
|
||||
public FormRun()
|
||||
{
|
||||
InitializeComponent();
|
||||
LoadSavedSettings(); // load handhistory dir, delay in seconds
|
||||
}
|
||||
|
||||
private void LoadSavedSettings()
|
||||
{
|
||||
if (!string.IsNullOrEmpty(Properties.Settings.Default.HandhistoryDir))
|
||||
{
|
||||
textBoxHH.Text = Properties.Settings.Default.HandhistoryDir;
|
||||
}
|
||||
if (!Properties.Settings.Default.DelaySeconds.Equals(null))
|
||||
{
|
||||
numericUpDownDelay.Value = Properties.Settings.Default.DelaySeconds;
|
||||
}
|
||||
if (Properties.Settings.Default.DelayEnabled)
|
||||
{
|
||||
toggleDelay.Checked = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
toggleDelay.Checked = false;
|
||||
}
|
||||
|
||||
|
||||
/* if (string.IsNullOrEmpty(Properties.Settings.Default.UploadAllTimeStamp))
|
||||
{
|
||||
UploadAll_label_uploaded.Text = Properties.Settings.Default.UploadAllTimeStamp;
|
||||
}*/
|
||||
/*if (string.IsNullOrEmpty(Properties.Settings.Default.HandhistoryDirUploadAll))
|
||||
{
|
||||
UploadAll_metroTextBox.Text = Properties.Settings.Default.HandhistoryDirUploadAll;
|
||||
}*/
|
||||
}
|
||||
|
||||
private void toggleRun_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (toggleRun.Checked)
|
||||
{
|
||||
// Check if handhistory dir is valid
|
||||
if (!HelperMethods.is_valid_run_dir(textBoxHH))
|
||||
{
|
||||
toggleRun.Checked = false;
|
||||
return;
|
||||
}
|
||||
|
||||
// Spawn backgroundworker
|
||||
BackgroundWorker backgroundworker = new BackgroundWorker
|
||||
{
|
||||
WorkerReportsProgress = true,
|
||||
WorkerSupportsCancellation = true,
|
||||
};
|
||||
backgroundworker.DoWork += BackgroundWorkerOnDoWork;
|
||||
backgroundworker.ProgressChanged += BackgroundWorkerOnProgressChanged;
|
||||
backgroundworker.RunWorkerCompleted += BackgroundWorkerCompleted;
|
||||
backgroundworker.RunWorkerAsync();
|
||||
|
||||
// Disable ChooseDir button
|
||||
btnSelect.Enabled = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
System.Console.WriteLine("Unchecked Run");
|
||||
btnSelect.Enabled = true; // Enable ChooseDir button
|
||||
}
|
||||
}
|
||||
|
||||
private void BackgroundWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
|
||||
{
|
||||
// Worker completed
|
||||
}
|
||||
|
||||
private void BackgroundWorkerOnProgressChanged(object sender, ProgressChangedEventArgs e)
|
||||
{
|
||||
System.Console.WriteLine(e.ProgressPercentage);
|
||||
}
|
||||
|
||||
private void BackgroundWorkerOnDoWork(object sender, DoWorkEventArgs e)
|
||||
{
|
||||
BackgroundWorker worker = (BackgroundWorker)sender;
|
||||
while (!worker.CancellationPending)
|
||||
{
|
||||
Console.WriteLine("\n");
|
||||
Console.WriteLine("-------------------------------");
|
||||
HelperMethods.DirectoryListing(textBoxHH.Text, dictionary, UploadList);
|
||||
HelperMethods.UploadFiles(UploadList);
|
||||
|
||||
System.Threading.Thread.Sleep(LoopIntervalMS);
|
||||
if (toggleRun.Checked == false)
|
||||
{
|
||||
worker.CancelAsync();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// FileBrowserDialog after clicking Select button
|
||||
private void buttonSelect_Click(object sender, EventArgs e)
|
||||
{
|
||||
using (var fbd = new FolderBrowserDialog())
|
||||
{
|
||||
DialogResult result = fbd.ShowDialog();
|
||||
|
||||
if (result == DialogResult.OK && !string.IsNullOrWhiteSpace(fbd.SelectedPath))
|
||||
{
|
||||
string[] files = Directory.GetFiles(fbd.SelectedPath);
|
||||
//System.Windows.Forms.MessageBox.Show("Files found: " + files.Length.ToString(), "Message");
|
||||
textBoxHH.Text = fbd.SelectedPath;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void toggleDelay_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (toggleDelay.Checked)
|
||||
{
|
||||
numericUpDownDelay.Enabled = true;
|
||||
Properties.Settings.Default.DelayEnabled = true;
|
||||
Properties.Settings.Default.Save();
|
||||
}
|
||||
else
|
||||
{
|
||||
numericUpDownDelay.Enabled = false;
|
||||
Properties.Settings.Default.DelayEnabled = false;
|
||||
Properties.Settings.Default.Save();
|
||||
}
|
||||
}
|
||||
|
||||
private void numericUpDownDelay_ValueChanged(object sender, EventArgs e)
|
||||
{
|
||||
// Save
|
||||
Properties.Settings.Default.DelaySeconds = numericUpDownDelay.Value;
|
||||
Properties.Settings.Default.Save();
|
||||
}
|
||||
|
||||
private void numericUpDownDelay_Leave(object sender, EventArgs e)
|
||||
{
|
||||
// Refresh delay in DB
|
||||
HelperMethods.SQLStreamDelay(numericUpDownDelay.Value);
|
||||
}
|
||||
}
|
||||
|
||||
public class MyCheckBox : CheckBox
|
||||
{
|
||||
public MyCheckBox()
|
||||
{
|
||||
SetStyle(ControlStyles.UserPaint | ControlStyles.AllPaintingInWmPaint, true);
|
||||
Padding = new Padding(6);
|
||||
}
|
||||
protected override void OnPaint(PaintEventArgs e)
|
||||
{
|
||||
this.OnPaintBackground(e);
|
||||
e.Graphics.SmoothingMode = SmoothingMode.AntiAlias;
|
||||
using (var path = new GraphicsPath())
|
||||
{
|
||||
var d = Padding.All;
|
||||
var r = this.Height - 2 * d;
|
||||
path.AddArc(d, d, r, r, 90, 180);
|
||||
path.AddArc(this.Width - r - d, d, r, r, -90, 180);
|
||||
path.CloseFigure();
|
||||
e.Graphics.FillPath(Checked ? Brushes.DarkGray : Brushes.LightGray, path);
|
||||
r = Height - 1;
|
||||
var rect = Checked ? new Rectangle(Width - r - 1, 0, r, r)
|
||||
: new Rectangle(0, 0, r, r);
|
||||
e.Graphics.FillEllipse(Checked ? Brushes.DeepSkyBlue : Brushes.WhiteSmoke, rect);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,123 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<metadata name="customInstaller1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 17</value>
|
||||
</metadata>
|
||||
</root>
|
||||
@@ -0,0 +1,150 @@
|
||||
namespace PokerStarsBotClientv2.Forms
|
||||
{
|
||||
partial class FormUploadAll
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.labelUpload = new System.Windows.Forms.Label();
|
||||
this.btnSelect = new System.Windows.Forms.Button();
|
||||
this.textBoxHH = new System.Windows.Forms.TextBox();
|
||||
this.labelSelectHH = new System.Windows.Forms.Label();
|
||||
this.toggleRun = new PokerStarsBotClientv2.Forms.MyCheckBox();
|
||||
this.labelUploadAll = new System.Windows.Forms.Label();
|
||||
this.labelUploadAllStatus = new System.Windows.Forms.Label();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// labelUpload
|
||||
//
|
||||
this.labelUpload.AutoSize = true;
|
||||
this.labelUpload.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.labelUpload.Location = new System.Drawing.Point(90, 48);
|
||||
this.labelUpload.Name = "labelUpload";
|
||||
this.labelUpload.Size = new System.Drawing.Size(464, 20);
|
||||
this.labelUpload.TabIndex = 0;
|
||||
this.labelUpload.Text = "Use this feature to upload your whole handhistory directory once.";
|
||||
//
|
||||
// btnSelect
|
||||
//
|
||||
this.btnSelect.BackColor = System.Drawing.Color.DeepSkyBlue;
|
||||
this.btnSelect.FlatAppearance.BorderSize = 0;
|
||||
this.btnSelect.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
|
||||
this.btnSelect.Location = new System.Drawing.Point(464, 167);
|
||||
this.btnSelect.Name = "btnSelect";
|
||||
this.btnSelect.Size = new System.Drawing.Size(92, 20);
|
||||
this.btnSelect.TabIndex = 5;
|
||||
this.btnSelect.Text = "Select";
|
||||
this.btnSelect.UseVisualStyleBackColor = false;
|
||||
this.btnSelect.Click += new System.EventHandler(this.btnSelect_Click);
|
||||
//
|
||||
// textBoxHH
|
||||
//
|
||||
this.textBoxHH.BackColor = System.Drawing.Color.White;
|
||||
this.textBoxHH.Location = new System.Drawing.Point(93, 167);
|
||||
this.textBoxHH.Name = "textBoxHH";
|
||||
this.textBoxHH.Size = new System.Drawing.Size(374, 20);
|
||||
this.textBoxHH.TabIndex = 4;
|
||||
//
|
||||
// labelSelectHH
|
||||
//
|
||||
this.labelSelectHH.AutoSize = true;
|
||||
this.labelSelectHH.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.labelSelectHH.Location = new System.Drawing.Point(89, 133);
|
||||
this.labelSelectHH.Name = "labelSelectHH";
|
||||
this.labelSelectHH.Size = new System.Drawing.Size(378, 20);
|
||||
this.labelSelectHH.TabIndex = 3;
|
||||
this.labelSelectHH.Text = "Select PokerStars handhistory directory of your user:";
|
||||
//
|
||||
// toggleRun
|
||||
//
|
||||
this.toggleRun.Appearance = System.Windows.Forms.Appearance.Button;
|
||||
this.toggleRun.BackColor = System.Drawing.Color.Transparent;
|
||||
this.toggleRun.FlatAppearance.BorderColor = System.Drawing.Color.RoyalBlue;
|
||||
this.toggleRun.FlatAppearance.BorderSize = 2;
|
||||
this.toggleRun.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
|
||||
this.toggleRun.Location = new System.Drawing.Point(94, 279);
|
||||
this.toggleRun.Name = "toggleRun";
|
||||
this.toggleRun.Padding = new System.Windows.Forms.Padding(6);
|
||||
this.toggleRun.Size = new System.Drawing.Size(61, 25);
|
||||
this.toggleRun.TabIndex = 8;
|
||||
this.toggleRun.Text = "myCheckBox1";
|
||||
this.toggleRun.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
|
||||
this.toggleRun.UseVisualStyleBackColor = false;
|
||||
this.toggleRun.CheckedChanged += new System.EventHandler(this.toggleRun_CheckedChanged);
|
||||
//
|
||||
// labelUploadAll
|
||||
//
|
||||
this.labelUploadAll.AutoSize = true;
|
||||
this.labelUploadAll.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.labelUploadAll.Location = new System.Drawing.Point(90, 246);
|
||||
this.labelUploadAll.Name = "labelUploadAll";
|
||||
this.labelUploadAll.Size = new System.Drawing.Size(81, 20);
|
||||
this.labelUploadAll.TabIndex = 7;
|
||||
this.labelUploadAll.Text = "Upload All";
|
||||
//
|
||||
// labelUploadAllStatus
|
||||
//
|
||||
this.labelUploadAllStatus.AutoSize = true;
|
||||
this.labelUploadAllStatus.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F);
|
||||
this.labelUploadAllStatus.Location = new System.Drawing.Point(231, 279);
|
||||
this.labelUploadAllStatus.Name = "labelUploadAllStatus";
|
||||
this.labelUploadAllStatus.Size = new System.Drawing.Size(0, 20);
|
||||
this.labelUploadAllStatus.TabIndex = 9;
|
||||
//
|
||||
// FormUploadAll
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.BackColor = System.Drawing.Color.White;
|
||||
this.ClientSize = new System.Drawing.Size(686, 422);
|
||||
this.Controls.Add(this.labelUploadAllStatus);
|
||||
this.Controls.Add(this.toggleRun);
|
||||
this.Controls.Add(this.labelUploadAll);
|
||||
this.Controls.Add(this.btnSelect);
|
||||
this.Controls.Add(this.textBoxHH);
|
||||
this.Controls.Add(this.labelSelectHH);
|
||||
this.Controls.Add(this.labelUpload);
|
||||
this.Margin = new System.Windows.Forms.Padding(1, 1, 1, 1);
|
||||
this.MaximumSize = new System.Drawing.Size(702, 461);
|
||||
this.MinimumSize = new System.Drawing.Size(702, 461);
|
||||
this.Name = "FormUploadAll";
|
||||
this.Text = "Form1";
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.Label labelUpload;
|
||||
private System.Windows.Forms.Button btnSelect;
|
||||
private System.Windows.Forms.TextBox textBoxHH;
|
||||
private System.Windows.Forms.Label labelSelectHH;
|
||||
private MyCheckBox toggleRun;
|
||||
private System.Windows.Forms.Label labelUploadAll;
|
||||
private System.Windows.Forms.Label labelUploadAllStatus;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,127 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using System.IO;
|
||||
|
||||
namespace PokerStarsBotClientv2.Forms
|
||||
{
|
||||
public partial class FormUploadAll : Form
|
||||
{
|
||||
// Fields
|
||||
public int UploadAllFileCount = 0;
|
||||
|
||||
// Constructor
|
||||
public FormUploadAll()
|
||||
{
|
||||
InitializeComponent();
|
||||
LoadSavedSettings();
|
||||
}
|
||||
|
||||
// Methods
|
||||
private void LoadSavedSettings()
|
||||
{
|
||||
if (!string.IsNullOrEmpty(Properties.Settings.Default.HandhistoryDir))
|
||||
{
|
||||
textBoxHH.Text = Properties.Settings.Default.HandhistoryDir;
|
||||
}
|
||||
}
|
||||
private void btnSelect_Click(object sender, EventArgs e)
|
||||
{
|
||||
using (var fbd = new FolderBrowserDialog())
|
||||
{
|
||||
DialogResult result = fbd.ShowDialog();
|
||||
|
||||
if (result == DialogResult.OK && !string.IsNullOrWhiteSpace(fbd.SelectedPath))
|
||||
{
|
||||
string[] files = Directory.GetFiles(fbd.SelectedPath);
|
||||
textBoxHH.Text = fbd.SelectedPath;
|
||||
}
|
||||
}
|
||||
}
|
||||
private void toggleRun_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (toggleRun.Checked)
|
||||
{
|
||||
// Check if handhistory dir is valid
|
||||
if (!HelperMethods.is_valid_run_dir(textBoxHH))
|
||||
{
|
||||
toggleRun.Checked = false;
|
||||
return;
|
||||
}
|
||||
|
||||
// Spawn backgroundworker
|
||||
BackgroundWorker backgroundworker = new BackgroundWorker
|
||||
{
|
||||
WorkerReportsProgress = true,
|
||||
WorkerSupportsCancellation = true,
|
||||
};
|
||||
backgroundworker.DoWork += BackgroundWorkerUploadAllOnDoWork;
|
||||
backgroundworker.RunWorkerCompleted += BackgroundWorkerUploadAllCompleted;
|
||||
backgroundworker.RunWorkerAsync();
|
||||
btnSelect.Enabled = false; // Disable Select button
|
||||
labelUploadAllStatus.Text = "Uploading ...";
|
||||
}
|
||||
}
|
||||
private void BackgroundWorkerUploadAllOnDoWork(object sender, DoWorkEventArgs e)
|
||||
{
|
||||
BackgroundWorker worker = (BackgroundWorker)sender;
|
||||
DirectoryInfo d = new DirectoryInfo(textBoxHH.Text);
|
||||
FileInfo[] Files = d.GetFiles("*.txt");
|
||||
List<FileInfo> UploadAllList = new List<FileInfo>();
|
||||
|
||||
foreach (FileInfo file in Files)
|
||||
{
|
||||
if (!worker.CancellationPending)
|
||||
{
|
||||
if (toggleRun.Checked == false)
|
||||
{
|
||||
worker.CancelAsync();
|
||||
}
|
||||
|
||||
// File-by-File upload
|
||||
UploadAllList.Clear();
|
||||
|
||||
// Update the last write time.
|
||||
File.SetLastWriteTime(file.FullName, DateTime.Now);
|
||||
|
||||
// Add to UploadAllList
|
||||
UploadAllList.Add(file);
|
||||
|
||||
// Upload files
|
||||
HelperMethods.UploadFiles(UploadAllList);
|
||||
|
||||
UploadAllFileCount++;
|
||||
}
|
||||
else
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
private void BackgroundWorkerUploadAllCompleted(object sender, RunWorkerCompletedEventArgs e)
|
||||
{
|
||||
// Done messages
|
||||
string UploadAllTimeStamp = UploadAllFileCount + " files successfully uploaded @ " + DateTime.Now.ToString("yyyy/dd/M HH:mm:ss");
|
||||
labelUploadAllStatus.Text = UploadAllTimeStamp;
|
||||
MessageBox.Show(UploadAllTimeStamp);
|
||||
|
||||
// Save
|
||||
Properties.Settings.Default.UploadAllTimeStamp = UploadAllTimeStamp;
|
||||
Properties.Settings.Default.Save();
|
||||
|
||||
// Reset
|
||||
UploadAllFileCount = 0;
|
||||
toggleRun.Checked = false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
||||
Reference in New Issue
Block a user