diff --git a/FloatToolGUI.sln b/FloatToolGUI.sln index ca5cb94..ef3a7d2 100644 --- a/FloatToolGUI.sln +++ b/FloatToolGUI.sln @@ -5,16 +5,42 @@ VisualStudioVersion = 16.0.30011.22 MinimumVisualStudioVersion = 10.0.40219.1 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FloatToolGUI", "FloatToolGUI\FloatToolGUI.csproj", "{A5906B52-BA1B-481C-BF4C-3028EF52A925}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Updater", "Updater\Updater.csproj", "{239C41D8-4405-461B-9706-7C03D7A87903}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 Release|Any CPU = Release|Any CPU + Release|x64 = Release|x64 + Release|x86 = Release|x86 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {A5906B52-BA1B-481C-BF4C-3028EF52A925}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {A5906B52-BA1B-481C-BF4C-3028EF52A925}.Debug|Any CPU.Build.0 = Debug|Any CPU + {A5906B52-BA1B-481C-BF4C-3028EF52A925}.Debug|x64.ActiveCfg = Debug|x64 + {A5906B52-BA1B-481C-BF4C-3028EF52A925}.Debug|x64.Build.0 = Debug|x64 + {A5906B52-BA1B-481C-BF4C-3028EF52A925}.Debug|x86.ActiveCfg = Debug|Any CPU + {A5906B52-BA1B-481C-BF4C-3028EF52A925}.Debug|x86.Build.0 = Debug|Any CPU {A5906B52-BA1B-481C-BF4C-3028EF52A925}.Release|Any CPU.ActiveCfg = Release|Any CPU {A5906B52-BA1B-481C-BF4C-3028EF52A925}.Release|Any CPU.Build.0 = Release|Any CPU + {A5906B52-BA1B-481C-BF4C-3028EF52A925}.Release|x64.ActiveCfg = Release|x64 + {A5906B52-BA1B-481C-BF4C-3028EF52A925}.Release|x64.Build.0 = Release|x64 + {A5906B52-BA1B-481C-BF4C-3028EF52A925}.Release|x86.ActiveCfg = Release|Any CPU + {A5906B52-BA1B-481C-BF4C-3028EF52A925}.Release|x86.Build.0 = Release|Any CPU + {239C41D8-4405-461B-9706-7C03D7A87903}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {239C41D8-4405-461B-9706-7C03D7A87903}.Debug|Any CPU.Build.0 = Debug|Any CPU + {239C41D8-4405-461B-9706-7C03D7A87903}.Debug|x64.ActiveCfg = Debug|Any CPU + {239C41D8-4405-461B-9706-7C03D7A87903}.Debug|x64.Build.0 = Debug|Any CPU + {239C41D8-4405-461B-9706-7C03D7A87903}.Debug|x86.ActiveCfg = Debug|Any CPU + {239C41D8-4405-461B-9706-7C03D7A87903}.Debug|x86.Build.0 = Debug|Any CPU + {239C41D8-4405-461B-9706-7C03D7A87903}.Release|Any CPU.ActiveCfg = Release|Any CPU + {239C41D8-4405-461B-9706-7C03D7A87903}.Release|Any CPU.Build.0 = Release|Any CPU + {239C41D8-4405-461B-9706-7C03D7A87903}.Release|x64.ActiveCfg = Release|Any CPU + {239C41D8-4405-461B-9706-7C03D7A87903}.Release|x64.Build.0 = Release|Any CPU + {239C41D8-4405-461B-9706-7C03D7A87903}.Release|x86.ActiveCfg = Release|Any CPU + {239C41D8-4405-461B-9706-7C03D7A87903}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/FloatToolGUI/Benchmark.Designer.cs b/FloatToolGUI/Benchmark.Designer.cs index bdd6302..6d173e9 100644 --- a/FloatToolGUI/Benchmark.Designer.cs +++ b/FloatToolGUI/Benchmark.Designer.cs @@ -37,28 +37,27 @@ private void InitializeComponent() this.versionLabel2 = new System.Windows.Forms.Label(); this.label4 = new System.Windows.Forms.Label(); this.speedLabel = new System.Windows.Forms.Label(); - this.flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel(); - this.panel1 = new System.Windows.Forms.Panel(); - this.label7 = new System.Windows.Forms.Label(); - this.label6 = new System.Windows.Forms.Label(); - this.panel10 = new System.Windows.Forms.Panel(); - this.label17 = new System.Windows.Forms.Label(); - this.label18 = new System.Windows.Forms.Label(); + this.benchmarkScoreboardLayout = new System.Windows.Forms.FlowLayoutPanel(); + this.label1 = new System.Windows.Forms.Label(); + this.pictureBox1 = new System.Windows.Forms.PictureBox(); this.Updater = new System.Windows.Forms.Timer(this.components); this.customProgressBar1 = new FloatToolGUI.CustomProgressBar(); this.panel4 = new System.Windows.Forms.Panel(); this.label8 = new System.Windows.Forms.Label(); this.closeBtn = new System.Windows.Forms.Button(); this.panel3 = new System.Windows.Forms.Panel(); - this.panel2 = new System.Windows.Forms.Panel(); - this.label1 = new System.Windows.Forms.Label(); + this.benchmarkThreadsNumericUpdown = new System.Windows.Forms.NumericUpDown(); this.label2 = new System.Windows.Forms.Label(); - this.flowLayoutPanel1.SuspendLayout(); - this.panel1.SuspendLayout(); - this.panel10.SuspendLayout(); + this.ToolTip = new System.Windows.Forms.ToolTip(this.components); + this.warningPic = new System.Windows.Forms.PictureBox(); + this.panel1 = new System.Windows.Forms.Panel(); + this.updateBenchmarksButton = new System.Windows.Forms.Button(); + this.benchmarkScoreboardLayout.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit(); this.panel4.SuspendLayout(); this.panel3.SuspendLayout(); - this.panel2.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.benchmarkThreadsNumericUpdown)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.warningPic)).BeginInit(); this.SuspendLayout(); // // startBenchmarkBtn @@ -84,11 +83,12 @@ private void InitializeComponent() this.submitScoreBtn.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.submitScoreBtn.Font = new System.Drawing.Font("Inter", 12F); this.submitScoreBtn.ForeColor = System.Drawing.Color.White; - this.submitScoreBtn.Location = new System.Drawing.Point(394, 221); + this.submitScoreBtn.Location = new System.Drawing.Point(484, 221); this.submitScoreBtn.Name = "submitScoreBtn"; - this.submitScoreBtn.Size = new System.Drawing.Size(304, 29); + this.submitScoreBtn.Size = new System.Drawing.Size(214, 29); this.submitScoreBtn.TabIndex = 2; this.submitScoreBtn.Text = "Опубликовать"; + this.ToolTip.SetToolTip(this.submitScoreBtn, "Просьба не отправлять много запросов на сервер в связи с его скоростью"); this.submitScoreBtn.UseVisualStyleBackColor = false; this.submitScoreBtn.Click += new System.EventHandler(this.submitScoreBtn_Click); // @@ -129,7 +129,7 @@ private void InitializeComponent() // this.label4.AutoSize = true; this.label4.ForeColor = System.Drawing.Color.White; - this.label4.Location = new System.Drawing.Point(390, 151); + this.label4.Location = new System.Drawing.Point(390, 123); this.label4.Name = "label4"; this.label4.Size = new System.Drawing.Size(83, 19); this.label4.TabIndex = 3; @@ -140,102 +140,48 @@ private void InitializeComponent() // this.speedLabel.AutoSize = true; this.speedLabel.ForeColor = System.Drawing.Color.White; - this.speedLabel.Location = new System.Drawing.Point(390, 171); + this.speedLabel.Location = new System.Drawing.Point(390, 143); this.speedLabel.Name = "speedLabel"; this.speedLabel.Size = new System.Drawing.Size(43, 19); this.speedLabel.TabIndex = 3; this.speedLabel.Text = "0 к/с"; this.speedLabel.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; // - // flowLayoutPanel1 - // - this.flowLayoutPanel1.AutoScroll = true; - this.flowLayoutPanel1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(26)))), ((int)(((byte)(26)))), ((int)(((byte)(26))))); - this.flowLayoutPanel1.Controls.Add(this.panel1); - this.flowLayoutPanel1.Controls.Add(this.panel10); - this.flowLayoutPanel1.Controls.Add(this.panel2); - this.flowLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Left; - this.flowLayoutPanel1.FlowDirection = System.Windows.Forms.FlowDirection.TopDown; - this.flowLayoutPanel1.ForeColor = System.Drawing.Color.White; - this.flowLayoutPanel1.Location = new System.Drawing.Point(0, 0); - this.flowLayoutPanel1.Name = "flowLayoutPanel1"; - this.flowLayoutPanel1.Padding = new System.Windows.Forms.Padding(10); - this.flowLayoutPanel1.Size = new System.Drawing.Size(388, 333); - this.flowLayoutPanel1.TabIndex = 4; - this.flowLayoutPanel1.WrapContents = false; + // benchmarkScoreboardLayout + // + this.benchmarkScoreboardLayout.AutoScroll = true; + this.benchmarkScoreboardLayout.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(26)))), ((int)(((byte)(26)))), ((int)(((byte)(26))))); + this.benchmarkScoreboardLayout.Controls.Add(this.panel1); + this.benchmarkScoreboardLayout.Controls.Add(this.label1); + this.benchmarkScoreboardLayout.Controls.Add(this.pictureBox1); + this.benchmarkScoreboardLayout.Dock = System.Windows.Forms.DockStyle.Left; + this.benchmarkScoreboardLayout.FlowDirection = System.Windows.Forms.FlowDirection.TopDown; + this.benchmarkScoreboardLayout.ForeColor = System.Drawing.Color.White; + this.benchmarkScoreboardLayout.Location = new System.Drawing.Point(0, 0); + this.benchmarkScoreboardLayout.Name = "benchmarkScoreboardLayout"; + this.benchmarkScoreboardLayout.Padding = new System.Windows.Forms.Padding(10); + this.benchmarkScoreboardLayout.Size = new System.Drawing.Size(388, 333); + this.benchmarkScoreboardLayout.TabIndex = 4; + this.benchmarkScoreboardLayout.WrapContents = false; // - // panel1 + // label1 // - this.panel1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(151)))), ((int)(((byte)(10)))), ((int)(((byte)(27))))); - this.panel1.Controls.Add(this.label7); - this.panel1.Controls.Add(this.label6); - this.panel1.Location = new System.Drawing.Point(10, 12); - this.panel1.Margin = new System.Windows.Forms.Padding(0, 2, 0, 3); - this.panel1.Name = "panel1"; - this.panel1.Size = new System.Drawing.Size(350, 35); - this.panel1.TabIndex = 0; - // - // label7 - // - this.label7.AutoSize = true; - this.label7.Font = new System.Drawing.Font("Inter", 8F); - this.label7.ForeColor = System.Drawing.Color.White; - this.label7.Location = new System.Drawing.Point(3, 18); - this.label7.Name = "label7"; - this.label7.Size = new System.Drawing.Size(142, 14); - this.label7.TabIndex = 3; - this.label7.Text = "1021779 к/с (v.0.5.0 beta)"; - this.label7.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; - // - // label6 - // - this.label6.AutoSize = true; - this.label6.Font = new System.Drawing.Font("Inter", 8F); - this.label6.ForeColor = System.Drawing.Color.White; - this.label6.Location = new System.Drawing.Point(3, 3); - this.label6.Margin = new System.Windows.Forms.Padding(0); - this.label6.Name = "label6"; - this.label6.Size = new System.Drawing.Size(281, 14); - this.label6.TabIndex = 3; - this.label6.Text = "AMD Ryzen 5 2600 Six-Core Processor (12 Threads)"; - this.label6.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; - // - // panel10 - // - this.panel10.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(125)))), ((int)(((byte)(195))))); - this.panel10.Controls.Add(this.label17); - this.panel10.Controls.Add(this.label18); - this.panel10.ForeColor = System.Drawing.Color.Black; - this.panel10.Location = new System.Drawing.Point(10, 52); - this.panel10.Margin = new System.Windows.Forms.Padding(0, 2, 0, 3); - this.panel10.Name = "panel10"; - this.panel10.Size = new System.Drawing.Size(350, 35); - this.panel10.TabIndex = 19; - // - // label17 - // - this.label17.AutoSize = true; - this.label17.Font = new System.Drawing.Font("Inter", 8F); - this.label17.ForeColor = System.Drawing.Color.White; - this.label17.Location = new System.Drawing.Point(3, 18); - this.label17.Name = "label17"; - this.label17.Size = new System.Drawing.Size(141, 14); - this.label17.TabIndex = 3; - this.label17.Text = "934030 к/с (v.0.5.0 beta)"; - this.label17.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; - // - // label18 - // - this.label18.AutoSize = true; - this.label18.Font = new System.Drawing.Font("Inter", 8F); - this.label18.ForeColor = System.Drawing.Color.White; - this.label18.Location = new System.Drawing.Point(3, 3); - this.label18.Margin = new System.Windows.Forms.Padding(0); - this.label18.Name = "label18"; - this.label18.Size = new System.Drawing.Size(310, 14); - this.label18.TabIndex = 3; - this.label18.Text = "Intel(R) Core(TM) i5-7300HQ CPU @ 2.50GHz (4 Threads)"; - this.label18.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + this.label1.Location = new System.Drawing.Point(13, 116); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(361, 19); + this.label1.TabIndex = 5; + this.label1.Text = "Загрузка бенчмарков..."; + this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + // + // pictureBox1 + // + this.pictureBox1.Image = global::FloatToolGUI.Properties.Resources.loading; + this.pictureBox1.Location = new System.Drawing.Point(13, 138); + this.pictureBox1.Name = "pictureBox1"; + this.pictureBox1.Size = new System.Drawing.Size(362, 64); + this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom; + this.pictureBox1.TabIndex = 6; + this.pictureBox1.TabStop = false; // // Updater // @@ -260,13 +206,17 @@ private void InitializeComponent() // panel4 // this.panel4.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(31)))), ((int)(((byte)(31)))), ((int)(((byte)(31))))); + this.panel4.Controls.Add(this.updateBenchmarksButton); + this.panel4.Controls.Add(this.warningPic); + this.panel4.Controls.Add(this.label2); + this.panel4.Controls.Add(this.benchmarkThreadsNumericUpdown); this.panel4.Controls.Add(this.versionLabel2); this.panel4.Controls.Add(this.threadCountLabel); this.panel4.Controls.Add(this.cpuNameLabel); this.panel4.Controls.Add(this.startBenchmarkBtn); this.panel4.Controls.Add(this.customProgressBar1); this.panel4.Controls.Add(this.submitScoreBtn); - this.panel4.Controls.Add(this.flowLayoutPanel1); + this.panel4.Controls.Add(this.benchmarkScoreboardLayout); this.panel4.Controls.Add(this.label4); this.panel4.Controls.Add(this.speedLabel); this.panel4.Dock = System.Windows.Forms.DockStyle.Fill; @@ -321,42 +271,81 @@ private void InitializeComponent() this.panel3.TabIndex = 5; this.panel3.MouseDown += new System.Windows.Forms.MouseEventHandler(this.DragWindowMouseDown); // - // panel2 - // - this.panel2.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(118)))), ((int)(((byte)(185)))), ((int)(((byte)(0))))); - this.panel2.Controls.Add(this.label1); - this.panel2.Controls.Add(this.label2); - this.panel2.ForeColor = System.Drawing.Color.Black; - this.panel2.Location = new System.Drawing.Point(10, 92); - this.panel2.Margin = new System.Windows.Forms.Padding(0, 2, 0, 3); - this.panel2.Name = "panel2"; - this.panel2.Size = new System.Drawing.Size(350, 35); - this.panel2.TabIndex = 20; - // - // label1 - // - this.label1.AutoSize = true; - this.label1.Font = new System.Drawing.Font("Inter", 8F); - this.label1.ForeColor = System.Drawing.Color.Black; - this.label1.Location = new System.Drawing.Point(3, 18); - this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(133, 14); - this.label1.TabIndex = 3; - this.label1.Text = "10000 к/с (CUDA alpha)"; - this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + // benchmarkThreadsNumericUpdown + // + this.benchmarkThreadsNumericUpdown.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(56)))), ((int)(((byte)(56)))), ((int)(((byte)(56))))); + this.benchmarkThreadsNumericUpdown.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.benchmarkThreadsNumericUpdown.ForeColor = System.Drawing.Color.White; + this.benchmarkThreadsNumericUpdown.Location = new System.Drawing.Point(551, 190); + this.benchmarkThreadsNumericUpdown.Maximum = new decimal(new int[] { + 1024, + 0, + 0, + 0}); + this.benchmarkThreadsNumericUpdown.Minimum = new decimal(new int[] { + 1, + 0, + 0, + 0}); + this.benchmarkThreadsNumericUpdown.Name = "benchmarkThreadsNumericUpdown"; + this.benchmarkThreadsNumericUpdown.Size = new System.Drawing.Size(147, 25); + this.benchmarkThreadsNumericUpdown.TabIndex = 5; + this.benchmarkThreadsNumericUpdown.Value = new decimal(new int[] { + 12, + 0, + 0, + 0}); + this.benchmarkThreadsNumericUpdown.ValueChanged += new System.EventHandler(this.benchmarkThreadsNumericUpdown_ValueChanged); // // label2 // this.label2.AutoSize = true; - this.label2.Font = new System.Drawing.Font("Inter", 8F); - this.label2.ForeColor = System.Drawing.Color.Black; - this.label2.Location = new System.Drawing.Point(3, 3); - this.label2.Margin = new System.Windows.Forms.Padding(0); + this.label2.ForeColor = System.Drawing.Color.White; + this.label2.Location = new System.Drawing.Point(390, 192); this.label2.Name = "label2"; - this.label2.Size = new System.Drawing.Size(259, 14); - this.label2.TabIndex = 3; - this.label2.Text = "NVidia GeForce GTX 1660 Ti (1536 CUDA Cores)"; - this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + this.label2.Size = new System.Drawing.Size(75, 19); + this.label2.TabIndex = 6; + this.label2.Text = "Потоков:"; + this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + // + // ToolTip + // + this.ToolTip.ToolTipTitle = "Внимание"; + // + // warningPic + // + this.warningPic.Enabled = false; + this.warningPic.Location = new System.Drawing.Point(520, 190); + this.warningPic.Name = "warningPic"; + this.warningPic.Size = new System.Drawing.Size(25, 25); + this.warningPic.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom; + this.warningPic.TabIndex = 7; + this.warningPic.TabStop = false; + this.ToolTip.SetToolTip(this.warningPic, "Не рекомендуется указывать большее количество \r\nпотоков, чем имеется в вашем проц" + + "ессоре. \r\nСкорость будет значительно ниже."); + this.warningPic.Visible = false; + // + // panel1 + // + this.panel1.Location = new System.Drawing.Point(13, 13); + this.panel1.Name = "panel1"; + this.panel1.Size = new System.Drawing.Size(362, 100); + this.panel1.TabIndex = 7; + // + // updateBenchmarksButton + // + this.updateBenchmarksButton.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(56)))), ((int)(((byte)(56)))), ((int)(((byte)(56))))); + this.updateBenchmarksButton.FlatAppearance.BorderSize = 0; + this.updateBenchmarksButton.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.updateBenchmarksButton.Font = new System.Drawing.Font("Inter", 10F); + this.updateBenchmarksButton.ForeColor = System.Drawing.Color.White; + this.updateBenchmarksButton.Location = new System.Drawing.Point(394, 221); + this.updateBenchmarksButton.Name = "updateBenchmarksButton"; + this.updateBenchmarksButton.Size = new System.Drawing.Size(84, 29); + this.updateBenchmarksButton.TabIndex = 8; + this.updateBenchmarksButton.Text = "Обновить"; + this.updateBenchmarksButton.UseVisualStyleBackColor = false; + this.updateBenchmarksButton.Click += new System.EventHandler(this.updateBenchmarksButton_Click); // // Benchmark // @@ -370,17 +359,14 @@ private void InitializeComponent() this.Name = "Benchmark"; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; this.Text = "Бенчмарк"; - this.flowLayoutPanel1.ResumeLayout(false); - this.panel1.ResumeLayout(false); - this.panel1.PerformLayout(); - this.panel10.ResumeLayout(false); - this.panel10.PerformLayout(); + this.benchmarkScoreboardLayout.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit(); this.panel4.ResumeLayout(false); this.panel4.PerformLayout(); this.panel3.ResumeLayout(false); this.panel3.PerformLayout(); - this.panel2.ResumeLayout(false); - this.panel2.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)(this.benchmarkThreadsNumericUpdown)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.warningPic)).EndInit(); this.ResumeLayout(false); } @@ -395,20 +381,19 @@ private void InitializeComponent() private System.Windows.Forms.Label versionLabel2; private System.Windows.Forms.Label label4; private System.Windows.Forms.Label speedLabel; - private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel1; + private System.Windows.Forms.FlowLayoutPanel benchmarkScoreboardLayout; private System.Windows.Forms.Timer Updater; - private System.Windows.Forms.Panel panel1; - private System.Windows.Forms.Label label7; - private System.Windows.Forms.Label label6; private System.Windows.Forms.Panel panel4; private System.Windows.Forms.Label label8; private System.Windows.Forms.Button closeBtn; private System.Windows.Forms.Panel panel3; - private System.Windows.Forms.Panel panel10; - private System.Windows.Forms.Label label17; - private System.Windows.Forms.Label label18; - private System.Windows.Forms.Panel panel2; private System.Windows.Forms.Label label1; + private System.Windows.Forms.PictureBox pictureBox1; private System.Windows.Forms.Label label2; + private System.Windows.Forms.NumericUpDown benchmarkThreadsNumericUpdown; + private System.Windows.Forms.ToolTip ToolTip; + private System.Windows.Forms.PictureBox warningPic; + private System.Windows.Forms.Panel panel1; + private System.Windows.Forms.Button updateBenchmarksButton; } } \ No newline at end of file diff --git a/FloatToolGUI/Benchmark.cs b/FloatToolGUI/Benchmark.cs index dbc354c..7b437b2 100644 --- a/FloatToolGUI/Benchmark.cs +++ b/FloatToolGUI/Benchmark.cs @@ -30,9 +30,9 @@ public enum SearchMode public void parseCraft(List inputs, List outputs, string want) { - //List results = new List(); - decimal wantFloat; - decimal.TryParse(want, System.Globalization.NumberStyles.Any, CultureInfo.InvariantCulture, out wantFloat); + decimal wantFloat = 1; + if (CurrentSearchMode != SearchMode.Equal) + decimal.TryParse(want, System.Globalization.NumberStyles.Any, CultureInfo.InvariantCulture, out wantFloat); foreach (var item in outputs) { @@ -96,7 +96,7 @@ private void StartCalculation() Stopwatch timer = Stopwatch.StartNew(); - var threads = Environment.ProcessorCount; + int threads = (int)benchmarkThreadsNumericUpdown.Value; try { for (int i = 0; i < threads; i++) @@ -149,8 +149,10 @@ public Benchmark(string version) cpuNameLabel.Text = mo["Name"].ToString().Trim(); Logger.Log($"[{DateTime.Now}]: CPU Name: {cpuNameLabel.Text} ({threadCountLabel.Text})"); thread1 = new Thread(runCycle); - LoadStats(); - + benchmarkThreadsNumericUpdown.Value = Environment.ProcessorCount; + warningPic.Image = SystemIcons.Warning.ToBitmap(); + Thread t = new Thread(new ThreadStart(LoadStats)); + t.Start(); } private void startBenchmarkBtn_Click(object sender, EventArgs e) @@ -194,18 +196,22 @@ private void AddCpuToList(string cpu, string speed, string ver, bool bigMargin) AutoSize = true, ForeColor = foreColor }); - flowLayoutPanel1.Controls.Add(tmpPanel); + Invoke((MethodInvoker)(() => + { + benchmarkScoreboardLayout.Controls.Add(tmpPanel); + }) + ); + } private void LoadStats() { try { - flowLayoutPanel1.Controls.Clear(); WebRequest request = WebRequest.Create($"{uri}getBenchmarks.php"); request.Credentials = CredentialCache.DefaultCredentials; WebResponse response = request.GetResponse(); - + using (Stream dataStream = response.GetResponseStream()) { StreamReader reader = new StreamReader(dataStream); @@ -216,11 +222,12 @@ private void LoadStats() { var results = responseFromServer.Remove(responseFromServer.Length - 1).Split('&'); int index = 0; + Invoke((MethodInvoker)(() => { benchmarkScoreboardLayout.Controls.Clear(); })); foreach (var cpu in results) { index++; var items = cpu.Split('|'); - AddCpuToList(items[0], items[1], items[2], index== results.Length); + AddCpuToList(items[0], items[1], items[2], index == results.Length); } } } @@ -228,13 +235,15 @@ private void LoadStats() } catch(Exception ex) { - flowLayoutPanel1.Controls.Add(new Label - { - Text = "Произошла ошибка подключения", - AutoSize = true, - ForeColor = Color.White - }); - + Invoke((MethodInvoker)(() => { + benchmarkScoreboardLayout.Controls.Clear(); + benchmarkScoreboardLayout.Controls.Add(new Label + { + Text = "Произошла ошибка подключения", + AutoSize = true, + ForeColor = Color.White + }); + })); Logger.Log($"[{DateTime.Now}]: {{EXCEPTION}} {ex.Message}{Environment.NewLine}{ex.StackTrace}"); Logger.SaveCrashReport(); } @@ -245,7 +254,7 @@ private void submitScoreBtn_Click(object sender, EventArgs e) try { submitScoreBtn.Enabled = false; - HttpWebRequest req = (HttpWebRequest)WebRequest.Create($"{uri}addBenchmark.php?cpu={cpuNameLabel.Text} ({threadCountLabel.Text})&speed={speedLabel.Text.Split(' ')[0]}"); + HttpWebRequest req = (HttpWebRequest)WebRequest.Create($"{uri}addBenchmark.php?cpu={cpuNameLabel.Text} ({benchmarkThreadsNumericUpdown.Value.ToString()})&speed={speedLabel.Text.Split(' ')[0]}"); req.UserAgent = $"FloatTool/{versionLabel2.Text}"; HttpWebResponse res = (HttpWebResponse)req.GetResponse(); res.Close(); @@ -282,5 +291,44 @@ private void DragWindowMouseDown(object sender, MouseEventArgs e) SendMessage(Handle, WM_NCLBUTTONDOWN, HT_CAPTION, 0); } } + + private void benchmarkThreadsNumericUpdown_ValueChanged(object sender, EventArgs e) + { + if (benchmarkThreadsNumericUpdown.Value > Environment.ProcessorCount) + { + warningPic.Enabled = true; + warningPic.Visible = true; + } + else + { + warningPic.Enabled = false; + warningPic.Visible = false; + } + } + + private void updateBenchmarksButton_Click(object sender, EventArgs e) + { + benchmarkScoreboardLayout.Controls.Clear(); + + benchmarkScoreboardLayout.Controls.Add(new Panel { + Size = new Size(300, 100) + }); + benchmarkScoreboardLayout.Controls.Add(new Label + { + Size = new Size(361, 19), + Text = "Загрузка бенчмарков...", + AutoSize = false, + TextAlign = ContentAlignment.MiddleCenter + }); + benchmarkScoreboardLayout.Controls.Add(new PictureBox + { + Size = new Size(362, 64), + Image = Properties.Resources.loading, + SizeMode = PictureBoxSizeMode.Zoom + }); + + Thread t = new Thread(new ThreadStart(LoadStats)); + t.Start(); + } } } diff --git a/FloatToolGUI/Benchmark.resx b/FloatToolGUI/Benchmark.resx index 5aa4a44..016ad02 100644 --- a/FloatToolGUI/Benchmark.resx +++ b/FloatToolGUI/Benchmark.resx @@ -117,6 +117,9 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + 113, 17 + 17, 17 diff --git a/FloatToolGUI/Calculation.cs b/FloatToolGUI/Calculation.cs index 562c3e7..fd9586e 100644 --- a/FloatToolGUI/Calculation.cs +++ b/FloatToolGUI/Calculation.cs @@ -43,9 +43,9 @@ static public string craftF(List ingridients, float minFloat, float m { arrInput[i] = Convert.ToSingle(ingridients[i].WearValue); } - foreach (float f in arrInput) + for (int i = 0; i < 10; i++) { - avgFloat += Convert.ToSingle(f); + avgFloat += Convert.ToSingle(arrInput[i]); } avgFloat /= 10; return setprecission(((maxFloat - minFloat) * avgFloat) + minFloat, 10); diff --git a/FloatToolGUI/FloatToolGUI.csproj b/FloatToolGUI/FloatToolGUI.csproj index 7cb64a7..cb64433 100644 --- a/FloatToolGUI/FloatToolGUI.csproj +++ b/FloatToolGUI/FloatToolGUI.csproj @@ -193,6 +193,7 @@ + Always diff --git a/FloatToolGUI/Main.Designer.cs b/FloatToolGUI/Main.Designer.cs index 044208c..fc78aab 100644 --- a/FloatToolGUI/Main.Designer.cs +++ b/FloatToolGUI/Main.Designer.cs @@ -74,6 +74,7 @@ private void InitializeComponent() this.versionLabel = new System.Windows.Forms.Label(); this.label8 = new System.Windows.Forms.Label(); this.panel6 = new System.Windows.Forms.Panel(); + this.stattrackCheckBox = new FloatToolGUI.CustomControls.CustomToggleSwitch(); this.checkPossibilityBtn = new System.Windows.Forms.Button(); this.label3 = new System.Windows.Forms.Label(); this.outcomeSelectorComboBox = new System.Windows.Forms.ComboBox(); @@ -88,6 +89,7 @@ private void InitializeComponent() this.weaponSkinBox = new System.Windows.Forms.ComboBox(); this.panel5 = new System.Windows.Forms.Panel(); this.panel16 = new System.Windows.Forms.Panel(); + this.downloadProgressBar = new FloatToolGUI.CustomProgressBar(); this.searchmodeGreater_btn = new System.Windows.Forms.Button(); this.searchmodeEqual_btn = new System.Windows.Forms.Button(); this.searchmodeLess_btn = new System.Windows.Forms.Button(); @@ -110,8 +112,6 @@ private void InitializeComponent() this.panel2 = new System.Windows.Forms.Panel(); this.panel4 = new System.Windows.Forms.Panel(); this.WorkStatusUpdater = new System.Windows.Forms.Timer(this.components); - this.downloadProgressBar = new FloatToolGUI.CustomProgressBar(); - this.stattrackCheckBox = new FloatToolGUI.CustomControls.CustomToggleSwitch(); ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit(); this.splitContainer1.Panel1.SuspendLayout(); this.splitContainer1.Panel2.SuspendLayout(); @@ -373,6 +373,16 @@ private void InitializeComponent() resources.ApplyResources(this.panel6, "panel6"); this.panel6.Name = "panel6"; // + // stattrackCheckBox + // + this.stattrackCheckBox.Checked = false; + this.stattrackCheckBox.ForeColor = System.Drawing.Color.White; + resources.ApplyResources(this.stattrackCheckBox, "stattrackCheckBox"); + this.stattrackCheckBox.Name = "stattrackCheckBox"; + this.stattrackCheckBox.TurnedOffColor = System.Drawing.Color.FromArgb(((int)(((byte)(56)))), ((int)(((byte)(56)))), ((int)(((byte)(56))))); + this.stattrackCheckBox.TurnedOnColor = System.Drawing.Color.Green; + this.stattrackCheckBox.OnToggled += new System.EventHandler(this.SkinComboboxChanged); + // // checkPossibilityBtn // resources.ApplyResources(this.checkPossibilityBtn, "checkPossibilityBtn"); @@ -541,6 +551,18 @@ private void InitializeComponent() resources.ApplyResources(this.panel16, "panel16"); this.panel16.Name = "panel16"; // + // downloadProgressBar + // + resources.ApplyResources(this.downloadProgressBar, "downloadProgressBar"); + this.downloadProgressBar.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(32)))), ((int)(((byte)(32)))), ((int)(((byte)(32))))); + this.downloadProgressBar.ForeColor = System.Drawing.Color.White; + this.downloadProgressBar.Maximum = 100; + this.downloadProgressBar.Minimum = 0; + this.downloadProgressBar.Name = "downloadProgressBar"; + this.downloadProgressBar.ProgressColor = System.Drawing.Color.Green; + this.downloadProgressBar.ProgressFont = new System.Drawing.Font("Inter", 11.25F, System.Drawing.FontStyle.Bold); + this.downloadProgressBar.Value = 0F; + // // searchmodeGreater_btn // resources.ApplyResources(this.searchmodeGreater_btn, "searchmodeGreater_btn"); @@ -750,28 +772,6 @@ private void InitializeComponent() this.WorkStatusUpdater.Interval = 250; this.WorkStatusUpdater.Tick += new System.EventHandler(this.timer2_Tick); // - // downloadProgressBar - // - resources.ApplyResources(this.downloadProgressBar, "downloadProgressBar"); - this.downloadProgressBar.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(32)))), ((int)(((byte)(32)))), ((int)(((byte)(32))))); - this.downloadProgressBar.ForeColor = System.Drawing.Color.White; - this.downloadProgressBar.Maximum = 100; - this.downloadProgressBar.Minimum = 0; - this.downloadProgressBar.Name = "downloadProgressBar"; - this.downloadProgressBar.ProgressColor = System.Drawing.Color.Green; - this.downloadProgressBar.ProgressFont = new System.Drawing.Font("Inter", 11.25F, System.Drawing.FontStyle.Bold); - this.downloadProgressBar.Value = 0F; - // - // stattrackCheckBox - // - this.stattrackCheckBox.Checked = false; - this.stattrackCheckBox.ForeColor = System.Drawing.Color.White; - resources.ApplyResources(this.stattrackCheckBox, "stattrackCheckBox"); - this.stattrackCheckBox.Name = "stattrackCheckBox"; - this.stattrackCheckBox.TurnedOffColor = System.Drawing.Color.FromArgb(((int)(((byte)(56)))), ((int)(((byte)(56)))), ((int)(((byte)(56))))); - this.stattrackCheckBox.TurnedOnColor = System.Drawing.Color.Green; - this.stattrackCheckBox.OnToggled += new System.EventHandler(this.SkinComboboxChanged); - // // FloatTool // this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; diff --git a/FloatToolGUI/Main.cs b/FloatToolGUI/Main.cs index ffc7181..0b0d86e 100644 --- a/FloatToolGUI/Main.cs +++ b/FloatToolGUI/Main.cs @@ -23,6 +23,7 @@ using Microsoft.Win32; using System.Numerics; using Button = System.Windows.Forms.Button; +using System.Diagnostics; namespace FloatToolGUI { @@ -104,8 +105,9 @@ static public string getSkinData(string name) public void parseCraft(List inputs, List outputs, string want) { //List results = new List(); - decimal wantFloat; - decimal.TryParse(want, System.Globalization.NumberStyles.Any, CultureInfo.InvariantCulture, out wantFloat); + decimal wantFloat = 1; + if (CurrentSearchMode != SearchMode.Equal) + decimal.TryParse(want, System.Globalization.NumberStyles.Any, CultureInfo.InvariantCulture, out wantFloat); foreach (var item in outputs) { @@ -236,6 +238,33 @@ public void updateSearchStr() Logger.Log($"[{DateTime.Now.ToString()}]: Changed search skin to: {search}"); } + public void AutoUpdater() + { + string ver = versionLabel.Text; + string data = CheckUpdates(); + string lastver = data.Split('|')[0]; + Logger.Log($"Checked version is: {lastver}{newLine}Installed: {ver}"); + if (ver != lastver) + { + DialogResult result = MessageBox.Show( + $"Доступна версия {lastver}! Хотите обновить?", + "Доступно обновление", + MessageBoxButtons.YesNo, + MessageBoxIcon.Information, + MessageBoxDefaultButton.Button1, + MessageBoxOptions.DefaultDesktopOnly); + + if (result == DialogResult.Yes) + { + string strExeFilePath = System.Reflection.Assembly.GetExecutingAssembly().Location; + string strWorkPath = System.IO.Path.GetDirectoryName(strExeFilePath); + Process.Start($@"{strWorkPath}\Updater.exe", data.Split('|')[1]); + Invoke((MethodInvoker)(() => { Close(); } )); + } + } + } + + RegistryKey registryData; public FloatTool() { @@ -275,7 +304,9 @@ public FloatTool() string ver = versionLabel.Text; try { - ver = CheckUpdates(); + Thread updater = new Thread(AutoUpdater); + updater.Start(); + //ver = CheckUpdates(); } catch(Exception ex) { @@ -283,7 +314,7 @@ public FloatTool() Logger.SaveCrashReport(); } - Logger.Log($"Checked version is: {ver}{newLine}Installed: {versionLabel.Text}"); + /*Logger.Log($"Checked version is: {ver}{newLine}Installed: {versionLabel.Text}"); if (ver != versionLabel.Text) { DialogResult result = MessageBox.Show( @@ -296,7 +327,7 @@ public FloatTool() if (result == DialogResult.Yes) System.Diagnostics.Process.Start("https://github.com/Nemeshio/FloatTool-GUI/releases/latest"); - } + }*/ } Logger.Log($"[{DateTime.Now.ToString()}]: Initialized"); } diff --git a/FloatToolGUI/Main.resx b/FloatToolGUI/Main.resx index 3e90f1d..e1b0eb7 100644 --- a/FloatToolGUI/Main.resx +++ b/FloatToolGUI/Main.resx @@ -253,102 +253,18 @@ 65, 16 - - panel8 - - - System.Windows.Forms.Panel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - panel1 - - - 0 - - - panel7 - - - System.Windows.Forms.Panel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - panel1 - - - 1 - - - Fill - - - 0, 0 - - - 469, 458 - - - 7 - - - panel1 - - - System.Windows.Forms.Panel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - panel4 - - - 0 - - - panel13 - - - System.Windows.Forms.Panel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - panel8 - - - 0 - - - panel10 - - - System.Windows.Forms.Panel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - panel8 - - - 1 - - + Fill - - 0, 40 + + 0, 10 - - 469, 418 + + 459, 408 - + 2 - - panel8 - - - System.Windows.Forms.Panel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - panel1 - - - 0 - panel11 @@ -361,6 +277,18 @@ 0 + + Top + + + 0, 0 + + + 459, 10 + + + 3 + panel12 @@ -397,54 +325,6 @@ 0 - - Fill - - - 0, 10 - - - 459, 408 - - - 2 - - - panel11 - - - System.Windows.Forms.Panel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - panel13 - - - 0 - - - Top - - - 0, 0 - - - 459, 10 - - - 3 - - - panel12 - - - System.Windows.Forms.Panel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - panel13 - - - 1 - Left @@ -469,160 +349,28 @@ 1 - - panel9 - - - System.Windows.Forms.Panel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - panel7 - - - 0 - - - button5 - - - System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - panel7 - - - 1 - - - button4 + + Fill - - System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + 0, 40 - - panel7 + + 469, 418 - + 2 - - button3 - - - System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - panel7 - - - 3 - - - Top - - - 0, 0 - - - 469, 40 - - - 1 - - - panel7 + + panel8 - + System.Windows.Forms.Panel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - + panel1 - - 1 - - - benchmarkButton - - - System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - panel9 - - - 0 - - - settingsButton - - - System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - panel9 - - - 1 - - - MaximizeButton - - - System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - panel9 - - - 2 - - - minimizeBtn - - - System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - panel9 - - - 3 - - - closeBtn - - - System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - panel9 - - - 4 - - - Top - - - 0, 0 - - - 469, 40 - - - 3 - - - panel9 - - - System.Windows.Forms.Panel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - panel7 - - + 0 @@ -811,6 +559,30 @@ 4 + + Top + + + 0, 0 + + + 469, 40 + + + 3 + + + panel9 + + + System.Windows.Forms.Panel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + panel7 + + + 0 + Top, Right @@ -919,65 +691,53 @@ 3 - - label24 - - - System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - panel3 - - - 0 - - - versionLabel + + Top - - System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + 0, 0 - - panel3 + + 469, 40 - + 1 - - label8 + + panel7 - - System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + System.Windows.Forms.Panel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - panel3 + + panel1 - - 2 + + 1 - - Top + + Fill - + 0, 0 - - 427, 40 + + 469, 458 - - 0 + + 7 - - panel3 + + panel1 - + System.Windows.Forms.Panel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - panel2 + + panel4 - - 2 + + 0 Top, Right @@ -1028,13 +788,13 @@ 141, 19 - 40, 14 + 41, 14 1 - v.0.6.1 + v.0.7.0 versionLabel @@ -1081,6 +841,30 @@ 2 + + Top + + + 0, 0 + + + 427, 40 + + + 0 + + + panel3 + + + System.Windows.Forms.Panel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + panel2 + + + 2 + 86, 66 @@ -1621,286 +1405,76 @@ 132, 24 - - 5 - - - Predator - - - weaponSkinBox - - - System.Windows.Forms.ComboBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - panel6 - - - 12 - - - Top - - - 0, 40 - - - 427, 151 - - - 1 - - - panel6 - - - System.Windows.Forms.Panel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - panel2 - - - 1 - - - panel16 - - - System.Windows.Forms.Panel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - panel5 - - - 0 - - - panel15 - - - System.Windows.Forms.Panel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - panel5 - - - 1 - - - Fill - - - 0, 191 - - - 427, 267 - - - 0 - - - panel5 - - - System.Windows.Forms.Panel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - panel2 - - - 0 - - - downloadProgressBar - - - FloatToolGUI.CustomProgressBar, FloatTool, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null - - - panel16 - - - 0 - - - searchmodeGreater_btn - - - System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - panel16 - - - 1 - - - searchmodeEqual_btn - - - System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - panel16 - - - 2 - - - searchmodeLess_btn - - - System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - panel16 - - - 3 - - - searchModeLabel - - - System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - panel16 - - - 4 - - - label5 - - - System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - panel16 - - - 5 - - - quantityInput - - - System.Windows.Forms.NumericUpDown, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - panel16 - - - 6 - - - skipValueInput - - - System.Windows.Forms.NumericUpDown, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - panel16 - - - 7 - - - ascendingCheckBox - - - System.Windows.Forms.CheckBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - panel16 - - - 8 - - - label7 - - - System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - panel16 - - - 9 - - - label6 + + 5 - - System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + Predator - - panel16 + + weaponSkinBox - - 10 + + System.Windows.Forms.ComboBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - searchFloatInput + + panel6 - - System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + 12 - - panel16 + + Top - - 11 + + 0, 40 - - sortCheckBox + + 427, 151 - - System.Windows.Forms.CheckBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + 1 - - panel16 + + panel6 - - 12 + + System.Windows.Forms.Panel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - startBtn + + panel2 - - System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + 1 - - panel16 + + None - - 13 + + Inter, 9.75pt - - Fill + + 11, 161 - - 0, 0 + + 0, 0, 0, 0 - - 427, 191 + + 406, 24 - + 12 - - panel16 + + downloadProgressBar - - System.Windows.Forms.Panel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + FloatToolGUI.CustomProgressBar, FloatTool, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null - - panel5 + + panel16 - + 0 @@ -2332,89 +1906,29 @@ 13 - - speedStatusLabel - - - System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - panel15 - - - 0 - - - combinationsStatusLabel - - - System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - panel15 - - - 1 - - - gpuSearch_btn - - - System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - panel15 - - - 2 - - - label10 - - - System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - panel15 - - - 3 - - - threadCountInput - - - System.Windows.Forms.NumericUpDown, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - panel15 - - - 4 - - - Bottom + + Fill - - 0, 191 + + 0, 0 - - 427, 76 + + 427, 191 - - 11 + + 12 - - panel15 + + panel16 - + System.Windows.Forms.Panel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - + panel5 - - 1 + + 0 True @@ -2578,6 +2092,54 @@ 4 + + Bottom + + + 0, 191 + + + 427, 76 + + + 11 + + + panel15 + + + System.Windows.Forms.Panel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + panel5 + + + 1 + + + Fill + + + 0, 191 + + + 427, 267 + + + 0 + + + panel5 + + + System.Windows.Forms.Panel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + panel2 + + + 0 + Left @@ -2629,36 +2191,6 @@ 198, 16 - - None - - - Inter, 9.75pt - - - 11, 161 - - - 0, 0, 0, 0 - - - 406, 24 - - - 12 - - - downloadProgressBar - - - FloatToolGUI.CustomProgressBar, FloatTool, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null - - - panel16 - - - 0 - True diff --git a/FloatToolGUI/Properties/Resources.Designer.cs b/FloatToolGUI/Properties/Resources.Designer.cs index 52543d9..25b0cb1 100644 --- a/FloatToolGUI/Properties/Resources.Designer.cs +++ b/FloatToolGUI/Properties/Resources.Designer.cs @@ -120,6 +120,16 @@ internal static byte[] Inter_Regular { } } + /// + /// Поиск локализованного ресурса типа System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap loading { + get { + object obj = ResourceManager.GetObject("loading", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + /// /// Поиск локализованного ресурса типа System.Drawing.Bitmap. /// diff --git a/FloatToolGUI/Properties/Resources.resx b/FloatToolGUI/Properties/Resources.resx index aa34fd0..c8dac01 100644 --- a/FloatToolGUI/Properties/Resources.resx +++ b/FloatToolGUI/Properties/Resources.resx @@ -136,6 +136,9 @@ ..\Resources\Inter-Regular.ttf;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + ..\Resources\loading.gif;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + ..\Resources\mutedBlack.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a diff --git a/FloatToolGUI/Resources/loading.gif b/FloatToolGUI/Resources/loading.gif new file mode 100644 index 0000000..c527681 Binary files /dev/null and b/FloatToolGUI/Resources/loading.gif differ diff --git a/FloatToolGUI/Utils.cs b/FloatToolGUI/Utils.cs index e6e4e1a..6a90f63 100644 --- a/FloatToolGUI/Utils.cs +++ b/FloatToolGUI/Utils.cs @@ -61,7 +61,7 @@ public static string CheckUpdates() var json = response.Content.ReadAsStringAsync().Result; dynamic release = JsonConvert.DeserializeObject(json); - return release["tag_name"]; + return release["tag_name"]+"|"+release["assets"][0]["browser_download_url"]; } } } diff --git a/Updater/Program.cs b/Updater/Program.cs new file mode 100644 index 0000000..dd43509 --- /dev/null +++ b/Updater/Program.cs @@ -0,0 +1,53 @@ +using System; +using System.Diagnostics; +using System.IO; +using System.IO.Compression; +using System.Net; +using System.Reflection; + +namespace Updater +{ + class Program + { + static void ExtractToDirectory(ZipArchive archive, string destinationDirectoryName, bool overwrite) + { + if (!overwrite) + { + archive.ExtractToDirectory(destinationDirectoryName); + return; + } + foreach (ZipArchiveEntry file in archive.Entries) + { + string completeFileName = Path.Combine(destinationDirectoryName, file.FullName); + string directory = Path.GetDirectoryName(completeFileName); + + if (!Directory.Exists(directory)) + Directory.CreateDirectory(directory); + + if (file.Name != "" && file.Name != "Updater.exe") + file.ExtractToFile(completeFileName, true); + } + } + + static void Main(string[] args) + { + if(args.Length == 1) + { + try + { + using (var client = new WebClient()) + { + client.Headers.Add("User-Agent", + "Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.2; WOW64; Trident/6.0)"); + client.DownloadFile(args[0], "update.zip"); + using (ZipArchive zipArchive = ZipFile.OpenRead("update.zip")) + ExtractToDirectory(zipArchive, Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), true); + File.Delete("update.zip"); + Process.Start("FloatTool.exe", ""); + } + } + catch (Exception _) {} + } + } + } +} diff --git a/Updater/Properties/launchSettings.json b/Updater/Properties/launchSettings.json new file mode 100644 index 0000000..6783682 --- /dev/null +++ b/Updater/Properties/launchSettings.json @@ -0,0 +1,7 @@ +{ + "profiles": { + "Updater": { + "commandName": "Project" + } + } +} \ No newline at end of file diff --git a/Updater/Updater.csproj b/Updater/Updater.csproj new file mode 100644 index 0000000..f32f369 --- /dev/null +++ b/Updater/Updater.csproj @@ -0,0 +1,25 @@ + + + + WinExe + net472 + Updater.Program + Prevter + FloatTool Updater + Automatically installs updates from Github repository + false + false + true + + + + E:\PROJECTS\FloatTool-GUI\FloatToolGUI\bin\ + AnyCPU + true + + + + + + +