diff --git a/.vs/FloatToolGUI/v16/.suo b/.vs/FloatToolGUI/v16/.suo index 770d425..7197bba 100644 Binary files a/.vs/FloatToolGUI/v16/.suo and b/.vs/FloatToolGUI/v16/.suo differ diff --git a/FloatToolGUI/Form1.Designer.cs b/FloatToolGUI/Form1.Designer.cs index 9552ca6..ff4f0d1 100644 --- a/FloatToolGUI/Form1.Designer.cs +++ b/FloatToolGUI/Form1.Designer.cs @@ -41,6 +41,8 @@ private void InitializeComponent() this.label1 = new System.Windows.Forms.Label(); this.comboBox1 = new System.Windows.Forms.ComboBox(); this.groupBox2 = new System.Windows.Forms.GroupBox(); + this.checkBox3 = new System.Windows.Forms.CheckBox(); + this.checkBox2 = new System.Windows.Forms.CheckBox(); this.label7 = new System.Windows.Forms.Label(); this.label6 = new System.Windows.Forms.Label(); this.label5 = new System.Windows.Forms.Label(); @@ -51,8 +53,6 @@ private void InitializeComponent() this.button2 = new System.Windows.Forms.Button(); this.groupBox3 = new System.Windows.Forms.GroupBox(); this.textBox2 = new System.Windows.Forms.TextBox(); - this.checkBox2 = new System.Windows.Forms.CheckBox(); - this.checkBox3 = new System.Windows.Forms.CheckBox(); this.groupBox1.SuspendLayout(); this.groupBox2.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.numericUpDown2)).BeginInit(); @@ -62,16 +62,16 @@ private void InitializeComponent() // // textBox1 // - this.textBox1.Location = new System.Drawing.Point(336, 19); + this.textBox1.Location = new System.Drawing.Point(336, 20); this.textBox1.Name = "textBox1"; - this.textBox1.Size = new System.Drawing.Size(267, 20); + this.textBox1.Size = new System.Drawing.Size(267, 21); this.textBox1.TabIndex = 0; this.textBox1.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; this.textBox1.TextChanged += new System.EventHandler(this.textBox1_TextChanged); // // groupBox1 // - this.groupBox1.Controls.Add(this.button1); + this.groupBox1.BackColor = System.Drawing.Color.Transparent; this.groupBox1.Controls.Add(this.label4); this.groupBox1.Controls.Add(this.checkBox1); this.groupBox1.Controls.Add(this.label3); @@ -81,7 +81,8 @@ private void InitializeComponent() this.groupBox1.Controls.Add(this.label2); this.groupBox1.Controls.Add(this.label1); this.groupBox1.Controls.Add(this.comboBox1); - this.groupBox1.Location = new System.Drawing.Point(12, 27); + this.groupBox1.Font = new System.Drawing.Font("Georgia", 9F, System.Drawing.FontStyle.Italic, System.Drawing.GraphicsUnit.Point, ((byte)(204))); + this.groupBox1.Location = new System.Drawing.Point(12, 12); this.groupBox1.Name = "groupBox1"; this.groupBox1.Size = new System.Drawing.Size(610, 83); this.groupBox1.TabIndex = 3; @@ -91,29 +92,30 @@ private void InitializeComponent() // button1 // this.button1.Enabled = false; - this.button1.Location = new System.Drawing.Point(491, 52); + this.button1.Location = new System.Drawing.Point(224, 107); this.button1.Name = "button1"; - this.button1.Size = new System.Drawing.Size(113, 21); + this.button1.Size = new System.Drawing.Size(10, 177); this.button1.TabIndex = 10; this.button1.Text = "Проверить"; this.button1.UseVisualStyleBackColor = true; + this.button1.Visible = false; // // label4 // this.label4.AutoSize = true; - this.label4.Location = new System.Drawing.Point(221, 22); + this.label4.Location = new System.Drawing.Point(215, 23); this.label4.Name = "label4"; - this.label4.Size = new System.Drawing.Size(99, 13); + this.label4.Size = new System.Drawing.Size(114, 15); this.label4.TabIndex = 9; this.label4.Text = "Полное название:"; // // checkBox1 // this.checkBox1.AutoSize = true; - this.checkBox1.Location = new System.Drawing.Point(224, 54); + this.checkBox1.Location = new System.Drawing.Point(252, 52); this.checkBox1.Name = "checkBox1"; this.checkBox1.RightToLeft = System.Windows.Forms.RightToLeft.Yes; - this.checkBox1.Size = new System.Drawing.Size(76, 17); + this.checkBox1.Size = new System.Drawing.Size(84, 19); this.checkBox1.TabIndex = 8; this.checkBox1.Text = ":StatTrack"; this.checkBox1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; @@ -123,14 +125,15 @@ private void InitializeComponent() // label3 // this.label3.AutoSize = true; - this.label3.Location = new System.Drawing.Point(306, 55); + this.label3.Location = new System.Drawing.Point(362, 53); this.label3.Name = "label3"; - this.label3.Size = new System.Drawing.Size(57, 13); + this.label3.Size = new System.Drawing.Size(70, 15); this.label3.TabIndex = 7; this.label3.Text = "Качество:"; // // comboBox3 // + this.comboBox3.Cursor = System.Windows.Forms.Cursors.Hand; this.comboBox3.FormattingEnabled = true; this.comboBox3.Items.AddRange(new object[] { "Factory New", @@ -138,41 +141,45 @@ private void InitializeComponent() "Field-Tested", "Well-Worn", "Battle-Scarred"}); - this.comboBox3.Location = new System.Drawing.Point(363, 52); + this.comboBox3.Location = new System.Drawing.Point(433, 50); this.comboBox3.Name = "comboBox3"; - this.comboBox3.Size = new System.Drawing.Size(121, 21); + this.comboBox3.Size = new System.Drawing.Size(170, 23); this.comboBox3.TabIndex = 6; + this.comboBox3.Text = "Field-Tested"; this.comboBox3.SelectedIndexChanged += new System.EventHandler(this.comboBox3_SelectedIndexChanged); // // comboBox2 // + this.comboBox2.Cursor = System.Windows.Forms.Cursors.Hand; this.comboBox2.FormattingEnabled = true; - this.comboBox2.Location = new System.Drawing.Point(78, 52); + this.comboBox2.Location = new System.Drawing.Point(105, 47); this.comboBox2.Name = "comboBox2"; - this.comboBox2.Size = new System.Drawing.Size(132, 21); + this.comboBox2.Size = new System.Drawing.Size(132, 23); this.comboBox2.TabIndex = 5; + this.comboBox2.Text = "Predator"; this.comboBox2.SelectedIndexChanged += new System.EventHandler(this.comboBox2_SelectedIndexChanged); // // label2 // this.label2.AutoSize = true; - this.label2.Location = new System.Drawing.Point(22, 55); + this.label2.Location = new System.Drawing.Point(14, 22); this.label2.Name = "label2"; - this.label2.Size = new System.Drawing.Size(35, 13); + this.label2.Size = new System.Drawing.Size(40, 15); this.label2.TabIndex = 4; this.label2.Text = "Скин:"; // // label1 // this.label1.AutoSize = true; - this.label1.Location = new System.Drawing.Point(6, 22); + this.label1.Location = new System.Drawing.Point(14, 51); this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(69, 13); + this.label1.Size = new System.Drawing.Size(82, 15); this.label1.TabIndex = 3; this.label1.Text = "Тип оружия:"; // // comboBox1 // + this.comboBox1.Cursor = System.Windows.Forms.Cursors.Hand; this.comboBox1.FormattingEnabled = true; this.comboBox1.Items.AddRange(new object[] { "AK-47", @@ -209,10 +216,11 @@ private void InitializeComponent() "UMP-45", "USP-S", "XM1014"}); - this.comboBox1.Location = new System.Drawing.Point(78, 18); + this.comboBox1.Location = new System.Drawing.Point(72, 19); this.comboBox1.Name = "comboBox1"; - this.comboBox1.Size = new System.Drawing.Size(132, 21); + this.comboBox1.Size = new System.Drawing.Size(132, 23); this.comboBox1.TabIndex = 2; + this.comboBox1.Text = "Nova"; this.comboBox1.SelectedIndexChanged += new System.EventHandler(this.comboBox1_SelectedIndexChanged); // // groupBox2 @@ -227,19 +235,41 @@ private void InitializeComponent() this.groupBox2.Controls.Add(this.textBox3); this.groupBox2.Controls.Add(this.progressBar1); this.groupBox2.Controls.Add(this.button2); - this.groupBox2.Location = new System.Drawing.Point(12, 117); + this.groupBox2.Font = new System.Drawing.Font("Microsoft Tai Le", 8.25F, System.Drawing.FontStyle.Italic, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.groupBox2.ForeColor = System.Drawing.Color.Black; + this.groupBox2.Location = new System.Drawing.Point(12, 102); this.groupBox2.Name = "groupBox2"; this.groupBox2.Size = new System.Drawing.Size(210, 182); this.groupBox2.TabIndex = 4; this.groupBox2.TabStop = false; this.groupBox2.Text = "Подбор"; // + // checkBox3 + // + this.checkBox3.AutoSize = true; + this.checkBox3.Location = new System.Drawing.Point(100, 96); + this.checkBox3.Name = "checkBox3"; + this.checkBox3.Size = new System.Drawing.Size(110, 18); + this.checkBox3.TabIndex = 9; + this.checkBox3.Text = "По возрастанию"; + this.checkBox3.UseVisualStyleBackColor = true; + // + // checkBox2 + // + this.checkBox2.AutoSize = true; + this.checkBox2.Location = new System.Drawing.Point(7, 96); + this.checkBox2.Name = "checkBox2"; + this.checkBox2.Size = new System.Drawing.Size(91, 18); + this.checkBox2.TabIndex = 8; + this.checkBox2.Text = "Сортировать"; + this.checkBox2.UseVisualStyleBackColor = true; + // // label7 // this.label7.AutoSize = true; this.label7.Location = new System.Drawing.Point(3, 73); this.label7.Name = "label7"; - this.label7.Size = new System.Drawing.Size(53, 13); + this.label7.Size = new System.Drawing.Size(53, 14); this.label7.TabIndex = 7; this.label7.Text = "Пропуск:"; // @@ -248,7 +278,7 @@ private void InitializeComponent() this.label6.AutoSize = true; this.label6.Location = new System.Drawing.Point(3, 47); this.label6.Name = "label6"; - this.label6.Size = new System.Drawing.Size(69, 13); + this.label6.Size = new System.Drawing.Size(69, 14); this.label6.TabIndex = 6; this.label6.Text = "Количество:"; // @@ -257,7 +287,7 @@ private void InitializeComponent() this.label5.AutoSize = true; this.label5.Location = new System.Drawing.Point(3, 22); this.label5.Name = "label5"; - this.label5.Size = new System.Drawing.Size(85, 13); + this.label5.Size = new System.Drawing.Size(85, 14); this.label5.TabIndex = 5; this.label5.Text = "Нужный флоат:"; // @@ -270,7 +300,7 @@ private void InitializeComponent() 0, 0}); this.numericUpDown2.Name = "numericUpDown2"; - this.numericUpDown2.Size = new System.Drawing.Size(116, 20); + this.numericUpDown2.Size = new System.Drawing.Size(116, 21); this.numericUpDown2.TabIndex = 4; this.numericUpDown2.Value = new decimal(new int[] { 20, @@ -287,7 +317,7 @@ private void InitializeComponent() 0, 0}); this.numericUpDown1.Name = "numericUpDown1"; - this.numericUpDown1.Size = new System.Drawing.Size(116, 20); + this.numericUpDown1.Size = new System.Drawing.Size(116, 21); this.numericUpDown1.TabIndex = 3; this.numericUpDown1.Value = new decimal(new int[] { 100, @@ -299,14 +329,13 @@ private void InitializeComponent() // this.textBox3.Location = new System.Drawing.Point(88, 19); this.textBox3.Name = "textBox3"; - this.textBox3.Size = new System.Drawing.Size(116, 20); + this.textBox3.Size = new System.Drawing.Size(116, 21); this.textBox3.TabIndex = 2; this.textBox3.Text = "0.250000000"; // // progressBar1 // this.progressBar1.Location = new System.Drawing.Point(7, 119); - this.progressBar1.Maximum = 40; this.progressBar1.Name = "progressBar1"; this.progressBar1.Size = new System.Drawing.Size(197, 21); this.progressBar1.Step = 1; @@ -314,6 +343,7 @@ private void InitializeComponent() // // button2 // + this.button2.Cursor = System.Windows.Forms.Cursors.Hand; this.button2.Location = new System.Drawing.Point(6, 146); this.button2.Name = "button2"; this.button2.Size = new System.Drawing.Size(198, 30); @@ -325,15 +355,19 @@ private void InitializeComponent() // groupBox3 // this.groupBox3.Controls.Add(this.textBox2); - this.groupBox3.Location = new System.Drawing.Point(236, 117); + this.groupBox3.Font = new System.Drawing.Font("Segoe UI", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204))); + this.groupBox3.Location = new System.Drawing.Point(236, 100); this.groupBox3.Name = "groupBox3"; - this.groupBox3.Size = new System.Drawing.Size(386, 182); + this.groupBox3.Size = new System.Drawing.Size(386, 184); this.groupBox3.TabIndex = 5; this.groupBox3.TabStop = false; this.groupBox3.Text = "Результат"; // // textBox2 // + this.textBox2.BackColor = System.Drawing.Color.Gray; + this.textBox2.BorderStyle = System.Windows.Forms.BorderStyle.None; + this.textBox2.Cursor = System.Windows.Forms.Cursors.Default; this.textBox2.Location = new System.Drawing.Point(7, 19); this.textBox2.Multiline = true; this.textBox2.Name = "textBox2"; @@ -343,38 +377,24 @@ private void InitializeComponent() this.textBox2.TabIndex = 0; this.textBox2.Text = "Добро пожаловать в FloatTool!\r\nИнструмент для создания флоатов при помощи крафтов" + " CS:GO"; - // - // checkBox2 - // - this.checkBox2.AutoSize = true; - this.checkBox2.Location = new System.Drawing.Point(7, 96); - this.checkBox2.Name = "checkBox2"; - this.checkBox2.Size = new System.Drawing.Size(91, 17); - this.checkBox2.TabIndex = 8; - this.checkBox2.Text = "Сортировать"; - this.checkBox2.UseVisualStyleBackColor = true; - // - // checkBox3 - // - this.checkBox3.AutoSize = true; - this.checkBox3.Location = new System.Drawing.Point(100, 96); - this.checkBox3.Name = "checkBox3"; - this.checkBox3.Size = new System.Drawing.Size(110, 17); - this.checkBox3.TabIndex = 9; - this.checkBox3.Text = "По возрастанию"; - this.checkBox3.UseVisualStyleBackColor = true; + this.textBox2.TextChanged += new System.EventHandler(this.textBox2_TextChanged); // // FloatTool // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(634, 311); + this.BackColor = System.Drawing.Color.Gray; + this.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center; + this.ClientSize = new System.Drawing.Size(630, 287); + this.Controls.Add(this.button1); this.Controls.Add(this.groupBox3); this.Controls.Add(this.groupBox2); this.Controls.Add(this.groupBox1); + this.ForeColor = System.Drawing.Color.Navy; + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); - this.MaximumSize = new System.Drawing.Size(650, 350); - this.MinimumSize = new System.Drawing.Size(650, 350); + this.MaximumSize = new System.Drawing.Size(650, 330); + this.MinimumSize = new System.Drawing.Size(650, 330); this.Name = "FloatTool"; this.Text = "FloatTool"; this.Load += new System.EventHandler(this.Form1_Load); diff --git a/FloatToolGUI/Form1.cs b/FloatToolGUI/Form1.cs index 6324b65..2860433 100644 --- a/FloatToolGUI/Form1.cs +++ b/FloatToolGUI/Form1.cs @@ -9,6 +9,7 @@ using System.Linq; using System.Net; using System.Text; +using System.Threading; using System.Threading.Tasks; using System.Windows.Forms; @@ -16,6 +17,7 @@ namespace FloatToolGUI { public partial class FloatTool : Form { + Thread thread1; public static string ToExactString(double d) { if (double.IsPositiveInfinity(d)) @@ -222,22 +224,27 @@ public void parseCraft(double[] inputs, List outputs, string want, bool //} if (flot.StartsWith(want) || ("" + flotOrigin).StartsWith(want.Replace(".", ","))) { - textBox2.Text += "Коомбинация найдена!" + Environment.NewLine; - textBox2.Text += "Возможный флоат: " + flotOrigin + Environment.NewLine; - //textBox2.Text += "IEEE754: " + flot + Environment.NewLine; - textBox2.Text += "Список флоатов: ["; - for (int i = 0; i < 10; i++) + this.Invoke((MethodInvoker)(() => { - textBox2.Text += inputs[i]; - if (i != 9) - { - textBox2.Text += ", "; - } - else + textBox2.Text += "Коомбинация найдена!" + Environment.NewLine; + textBox2.Text += "Возможный флоат: " + flotOrigin + Environment.NewLine; + textBox2.Text += "Список флоатов: ["; + for (int i = 0; i < 10; i++) { - textBox2.Text += "]" + Environment.NewLine +"======================================" + Environment.NewLine; + textBox2.Text += inputs[i]; + if (i != 9) + { + textBox2.Text += ", "; + } + else + { + textBox2.Text += "]" + Environment.NewLine + "======================================" + Environment.NewLine; + } } } + )); + + //textBox2.Text += "IEEE754: " + flot + Environment.NewLine; return; } } @@ -262,7 +269,23 @@ public FloatTool() private void Form1_Load(object sender, EventArgs e) { + thread1 = new Thread(StartCalculation); + comboBox2.Items.Clear(); + using (StreamReader r = new StreamReader("itemData.json")) + { + string json = r.ReadToEnd(); + dynamic items = JsonConvert.DeserializeObject(json); + foreach (var skin in items) + { + if (skin["name"].ToString().Split('|')[0].TrimEnd() == comboBox1.Text) + { + Console.WriteLine(skin["name"].ToString().Split('|')[1].Remove(0, 1)); + comboBox2.Items.Add(skin["name"].ToString().Split('|')[1].Remove(0, 1)); + } + } + } + updateSearchStr(); } private void textBox1_TextChanged(object sender, EventArgs e) @@ -310,22 +333,39 @@ private void comboBox3_SelectedIndexChanged(object sender, EventArgs e) updateSearchStr(); } - private void button2_Click(object sender, EventArgs e) + private void StartCalculation() { - textBox2.Text = "Добро пожаловать в FloatTool!" + Environment.NewLine + "Инструмент для создания флоатов при помощи крафтов CS:GO"; - textBox2.Text += "Время начала процесса: "+ DateTime.Now.ToString("h:mm:ss tt"); + this.Invoke((MethodInvoker)(() => + { + textBox2.Text = "Добро пожаловать в FloatTool!" + Environment.NewLine + "Инструмент для создания флоатов при помощи крафтов CS:GO" + Environment.NewLine; + textBox2.Text += "Время начала процесса: " + DateTime.Now.ToString("hh:mm:ss tt") + Environment.NewLine; + button2.Text = "Стоп"; + } + )); + string count = "" + numericUpDown1.Value; string start = "" + numericUpDown2.Value; string wanted = textBox3.Text; string q = textBox1.Text; string url = "https://steamcommunity.com/market/listings/730/" + q + "/render/?query=&language=russian&count=" + count + "&start=" + start + "¤cy=5"; - textBox2.Text += Environment.NewLine + "Загрузка скинов с торговой площадки..." + Environment.NewLine; + this.Invoke((MethodInvoker)(() => + { + textBox2.Text += "Загрузка скинов с торговой площадки..." + Environment.NewLine; + progressBar1.Maximum = int.Parse(count); + progressBar1.Value = 0; + } + )); + List floats = new List(); using (WebClient wc = new WebClient()) { string json = wc.DownloadString(url); dynamic r = JsonConvert.DeserializeObject(json); - textBox2.Text += "Получение флоатов..." + Environment.NewLine; + this.Invoke((MethodInvoker)(() => + { + textBox2.Text += "Получение флоатов..." + Environment.NewLine; + } + )); int counter = 0; foreach (var el in r["listinginfo"]) { @@ -348,8 +388,12 @@ private void button2_Click(object sender, EventArgs e) Console.Write(""); } } - int loaded = (int)Math.Round(40 * ((float)counter / int.Parse(count))); - progressBar1.Value = loaded; + this.Invoke((MethodInvoker)(() => + { + progressBar1.Value = counter; + } + )); + } } if (checkBox2.Checked) @@ -368,7 +412,12 @@ private void button2_Click(object sender, EventArgs e) //foreach (double v in floats) { // Console.WriteLine(v); //} - textBox2.Text += "Поиск ауткамов..." + Environment.NewLine; + this.Invoke((MethodInvoker)(() => + { + textBox2.Text += "Поиск ауткамов..." + Environment.NewLine; + } + )); + string currData = getSkinData(q.Split('(')[0].TrimEnd()); List craftList = new List(); using (StreamReader r = new StreamReader("itemData.json")) @@ -388,7 +437,11 @@ private void button2_Click(object sender, EventArgs e) } } } - textBox2.Text += "Ауткамы найдены! Начинаю подбор..." + Environment.NewLine + Environment.NewLine; + this.Invoke((MethodInvoker)(() => + { + textBox2.Text += "Ауткамы найдены! Начинаю подбор..." + Environment.NewLine + Environment.NewLine; + } + )); //return; double[] pool = floats.ToArray(); int n = floats.Count; @@ -419,7 +472,30 @@ private void button2_Click(object sender, EventArgs e) // iter++; } - textBox2.Text += "Программа завершила проверку всех комбинаций!" + Environment.NewLine; + this.Invoke((MethodInvoker)(() => + { + textBox2.Text += "Программа завершила проверку всех комбинаций!" + Environment.NewLine; + } + )); + + } + + private void button2_Click(object sender, EventArgs e) + { + if(button2.Text == "Старт") { + thread1.Start(); + } + else + { + thread1.Abort(); + button2.Text = "Старт"; + } + } + + private void textBox2_TextChanged(object sender, EventArgs e) + { + textBox1.SelectionStart = textBox1.Text.Length; + textBox2.ScrollToCaret(); } } } diff --git a/README.md b/README.md index 0ddada0..12723b7 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,3 @@ # FloatTool-GUI Tool written on C# to calculate floats that gonna be created by trade ups in csgo +![Program Working](https://github.com/Nemeshio/FloatTool-GUI/tree/master/doc/program.png) \ No newline at end of file diff --git a/doc/program.png b/doc/program.png new file mode 100644 index 0000000..ec16313 Binary files /dev/null and b/doc/program.png differ