From 00191dca93e6272cdcbadaac40f349a74866b213 Mon Sep 17 00:00:00 2001 From: michioxd Date: Fri, 9 Feb 2024 19:50:47 +0700 Subject: [PATCH] 1.2 --- MainForm.Designer.cs | 30 +++++++++++++++--------------- MainForm.cs | 26 +++++++++++++------------- TinyDRPC.csproj | 3 ++- TinyDRPC.iss | 2 +- Utils/Configuration.cs | 8 ++++---- 5 files changed, 35 insertions(+), 34 deletions(-) diff --git a/MainForm.Designer.cs b/MainForm.Designer.cs index 4cfa287..baf1c3d 100644 --- a/MainForm.Designer.cs +++ b/MainForm.Designer.cs @@ -67,6 +67,7 @@ private void InitializeComponent() label15 = new Label(); linkLabel3 = new LinkLabel(); tabPage3 = new TabPage(); + checkUpdateOnStartup = new CheckBox(); checkUpdateBtn = new Button(); runMinimized = new CheckBox(); saveState = new CheckBox(); @@ -83,7 +84,6 @@ private void InitializeComponent() toolStripSeparator1 = new ToolStripSeparator(); exitContext = new ToolStripMenuItem(); updateAvailableBtn = new Button(); - checkUpdateOnStartup = new CheckBox(); tabControl1.SuspendLayout(); tabPage1.SuspendLayout(); tabPage2.SuspendLayout(); @@ -481,6 +481,19 @@ private void InitializeComponent() tabPage3.Text = "Configuration"; tabPage3.UseVisualStyleBackColor = true; // + // checkUpdateOnStartup + // + checkUpdateOnStartup.AutoSize = true; + checkUpdateOnStartup.Checked = true; + checkUpdateOnStartup.CheckState = CheckState.Checked; + checkUpdateOnStartup.Location = new Point(6, 124); + checkUpdateOnStartup.Name = "checkUpdateOnStartup"; + checkUpdateOnStartup.Size = new Size(156, 19); + checkUpdateOnStartup.TabIndex = 12; + checkUpdateOnStartup.Text = "Check update on startup"; + checkUpdateOnStartup.UseVisualStyleBackColor = true; + checkUpdateOnStartup.CheckedChanged += checkUpdateOnStartup_CheckedChanged; + // // checkUpdateBtn // checkUpdateBtn.Location = new Point(6, 149); @@ -543,7 +556,7 @@ private void InitializeComponent() versionLabel.Name = "versionLabel"; versionLabel.Size = new Size(192, 15); versionLabel.TabIndex = 1; - versionLabel.Text = "Version: 1.1 - powered by michioxd"; + versionLabel.Text = "Version: 1.2 - powered by michioxd"; // // label2 // @@ -632,19 +645,6 @@ private void InitializeComponent() updateAvailableBtn.UseVisualStyleBackColor = true; updateAvailableBtn.Visible = false; // - // checkUpdateOnStartup - // - checkUpdateOnStartup.AutoSize = true; - checkUpdateOnStartup.Checked = true; - checkUpdateOnStartup.CheckState = CheckState.Checked; - checkUpdateOnStartup.Location = new Point(6, 124); - checkUpdateOnStartup.Name = "checkUpdateOnStartup"; - checkUpdateOnStartup.Size = new Size(156, 19); - checkUpdateOnStartup.TabIndex = 12; - checkUpdateOnStartup.Text = "Check update on startup"; - checkUpdateOnStartup.UseVisualStyleBackColor = true; - checkUpdateOnStartup.CheckedChanged += checkUpdateOnStartup_CheckedChanged; - // // MainForm // AutoScaleDimensions = new SizeF(7F, 15F); diff --git a/MainForm.cs b/MainForm.cs index aa79fb9..d77f8a7 100644 --- a/MainForm.cs +++ b/MainForm.cs @@ -9,7 +9,7 @@ namespace TinyDRPC { public partial class MainForm : Form { - public string CurrentVersion = "1.1"; + public string CurrentVersion = "1.2"; private DiscordRpcClient? drpc; public MainForm() @@ -119,18 +119,6 @@ private void MainForm_Load(object sender, EventArgs e) runMinimized.Enabled = runOnStartup.Checked; versionLabel.Text = $"Version: {CurrentVersion} - powered by michioxd"; - if (config.runMinimized && config.runOnStartup) - { - System.Threading.Timer timer = new System.Threading.Timer(new TimerCallback((obj) => - { - this.Invoke(new MethodInvoker(delegate () - { - tinyDrpcNotifyIcon.Visible = true; - Hide(); - })); - }), null, 50, Timeout.Infinite); - } - if (checkUpdateOnStartup.Checked) { CheckForUpdate(); @@ -145,6 +133,18 @@ private void MainForm_Load(object sender, EventArgs e) { case 0: _ = new DarkModeCS(this); break; } + + if (config.runMinimized && config.runOnStartup) + { + System.Threading.Timer timer = new System.Threading.Timer(new TimerCallback((obj) => + { + this.Invoke(new MethodInvoker(delegate () + { + tinyDrpcNotifyIcon.Visible = true; + Hide(); + })); + }), null, 100, Timeout.Infinite); + } } private void topText_TextChanged(object sender, EventArgs e) diff --git a/TinyDRPC.csproj b/TinyDRPC.csproj index 38d428a..09753f4 100644 --- a/TinyDRPC.csproj +++ b/TinyDRPC.csproj @@ -16,7 +16,8 @@ tinydrpc_100x100.png https://github.com/michioxd/TinyDRPC README.md - 1.1 + 1.2 + 1.2 diff --git a/TinyDRPC.iss b/TinyDRPC.iss index 581692d..f62ecb5 100644 --- a/TinyDRPC.iss +++ b/TinyDRPC.iss @@ -5,7 +5,7 @@ #include "CodeDependencies.iss" #define MyAppName "TinyDRPC" -#define MyAppVersion "1.1" +#define MyAppVersion "1.2" #define MyAppPublisher "michioxd" #define MyAppURL "https://github.com/michioxd/TinyDRPC" #define MyAppExeName "TinyDRPC.exe" diff --git a/Utils/Configuration.cs b/Utils/Configuration.cs index f85cba7..23d178d 100644 --- a/Utils/Configuration.cs +++ b/Utils/Configuration.cs @@ -39,11 +39,11 @@ public Configuration LoadConfiguration() foreach (string line in lines) { - string[] parts = line.Split('='); - if (parts.Length == 2) + int index = line.IndexOf('='); + if (index > 0) { - string key = parts[0].Trim(); - string value = parts[1].Trim(); + string key = line.Substring(0, index).Trim(); + string value = line.Substring(index + 1).Trim(); SetProperty(config, key, value); } }