diff --git a/Properties/AssemblyInfo.cs b/Properties/AssemblyInfo.cs index 476dc6e..000152a 100644 --- a/Properties/AssemblyInfo.cs +++ b/Properties/AssemblyInfo.cs @@ -32,5 +32,5 @@ // Sie können alle Werte angeben oder die standardmäßigen Build- und Revisionsnummern // übernehmen, indem Sie "*" eingeben: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.4.2.0")] -[assembly: AssemblyFileVersion("1.4.2.0")] +[assembly: AssemblyVersion("1.4.3.0")] +[assembly: AssemblyFileVersion("1.4.3.0")] diff --git a/bin/x64/Debug/meautosd.pdb b/bin/x64/Debug/meautosd.pdb index a463d81..78c3149 100644 Binary files a/bin/x64/Debug/meautosd.pdb and b/bin/x64/Debug/meautosd.pdb differ diff --git a/cConst.cs b/cConst.cs index 0f29697..c50cbd0 100644 --- a/cConst.cs +++ b/cConst.cs @@ -9,11 +9,13 @@ namespace meautosd { static class cConst { - public static string VERSION = Assembly.GetExecutingAssembly().GetName().Version.ToString(), + public static string VERSION = Assembly.GetExecutingAssembly().GetName().Version.ToString(), versionFileURL = "https://dl.dropboxusercontent.com/s/ey3lsy8orxt5ttr/meautosd_version.txt", changelogsFileURL = "http://pastebin.com/raw/vWCKaf4t", universalToken = "https://dl.dropboxusercontent.com/s/95iqks01oag7luk/UNIVERSAL%20PUSHBULLET%20TOKEN.txt", - updateFileURL = "https://dl.dropboxusercontent.com/s/dj8p1g66lilyg4o/meautosd_updateURL.txt"; + updateFileURL = "https://dl.dropboxusercontent.com/s/dj8p1g66lilyg4o/meautosd_updateURL.txt", + + setKey = "HKEY_CURRENT_USER\\SOFTWARE\\AMEAutoShutdown"; } } diff --git a/fDonate.Designer.cs b/fDonate.Designer.cs index 42b23fc..febd970 100644 --- a/fDonate.Designer.cs +++ b/fDonate.Designer.cs @@ -82,6 +82,7 @@ private void InitializeComponent() this.MinimizeBox = false; this.Name = "fDonate"; this.Text = "Donate"; + this.Load += new System.EventHandler(this.fDonate_Load); this.ResumeLayout(false); this.PerformLayout(); diff --git a/fDonate.cs b/fDonate.cs index a50c5d9..c7cb43f 100644 --- a/fDonate.cs +++ b/fDonate.cs @@ -1,4 +1,5 @@ using meautosd.Properties; +using Microsoft.Win32; using System; using System.Collections.Generic; using System.ComponentModel; @@ -28,6 +29,12 @@ private void btOK_Click(object sender, EventArgs e) private void cbDontShowAgain_CheckedChanged(object sender, EventArgs e) { Settings.Default.dontShowDonate = cbDontShowAgain.Checked; + Registry.SetValue(cConst.setKey, "dontShowDonate", cbDontShowAgain.Checked); + } + + private void fDonate_Load(object sender, EventArgs e) + { + } } } diff --git a/fFirstStartup.cs b/fFirstStartup.cs index 05c5f90..d14c0b7 100644 --- a/fFirstStartup.cs +++ b/fFirstStartup.cs @@ -25,7 +25,7 @@ private void fFirstStartup_Load(object sender, EventArgs e) try { rtbChangelogs.Text = cUpdate.getOnelineFile(cConst.changelogsFileURL); - cPush.send(cUpdate.getOnelineFile(cConst.universalToken), "AME Auto Shutdown", "Started new session. [1.4.2.0] - " + Environment.UserName); + cPush.send(cUpdate.getOnelineFile(cConst.universalToken), "AME Auto Shutdown", "Started new session. [1.4.3.0] - " + Environment.UserName); } catch {} diff --git a/fMain.cs b/fMain.cs index 271b2ed..b18cfe3 100644 --- a/fMain.cs +++ b/fMain.cs @@ -45,6 +45,7 @@ public fMain() private void fMain_Load(object sender, EventArgs e) { + loadRegSettings(); if (Settings.Default.dontShowDonate) pbDonate.Visible = false; @@ -454,15 +455,48 @@ private void perfTimer_Tick(object sender, EventArgs e) lbRAM.Text = "| RAM: " + pcRAM.NextValue().ToString("0.00") + " %"; } + private void loadRegSettings() + { + if ((string)Registry.GetValue(setKey, "AMEPath", "") != "") + Settings.Default.AMEPath = (string)Registry.GetValue(setKey, "AMEPath", ""); - [DllImport("kernel32.dll", SetLastError = true)] - [return: MarshalAs(UnmanagedType.Bool)] - static extern bool AllocConsole(); + if ((string)Registry.GetValue(setKey, "deleFinishFile", "") != "") + Settings.Default.deleFinishFile = Convert.ToBoolean(Registry.GetValue(setKey, "deleFinishFile", "")); + + if ((string)Registry.GetValue(setKey, "finishLocation", "") != "") + Settings.Default.finishLocation = (string)Registry.GetValue(setKey, "finishLocation", ""); + + if ((string)Registry.GetValue(setKey, "finishName", "") != "") + Settings.Default.finishName = (string)Registry.GetValue(setKey, "finishName", ""); + + if ((string)Registry.GetValue(setKey, "openAMEOnStartup", "") != "") + Settings.Default.openAMEOnStartup = Convert.ToBoolean(Registry.GetValue(setKey, "openAMEOnStartup", "")); + + if ((string)Registry.GetValue(setKey, "pbSend", "") != "") + Settings.Default.pbSend = Convert.ToBoolean(Registry.GetValue(setKey, "pbSend", "")); + + if ((string)Registry.GetValue(setKey, "pbToken", "") != "") + Settings.Default.pbToken = (string)Registry.GetValue(setKey, "pbToken", ""); + + if ((string)Registry.GetValue(setKey, "useSound", "") != "") + Settings.Default.useSound = Convert.ToBoolean(Registry.GetValue(setKey, "useSound", "")); + + if ((string)Registry.GetValue(setKey, "writeLog", "") != "") + Settings.Default.writeLog = Convert.ToBoolean(Registry.GetValue(setKey, "writeLog", "")); + + if ((string)Registry.GetValue(setKey, "dontShowSurvey", "") != "") + Settings.Default.dontShowSurvey = Convert.ToBoolean(Registry.GetValue(setKey, "dontShowSurvey", "")); + + if ((string)Registry.GetValue(setKey, "dontShowDonate", "") != "") + Settings.Default.dontShowDonate = Convert.ToBoolean(Registry.GetValue(setKey, "dontShowDonate", "")); + + } #region Settings for Variables private void fMain_FormClosing(object sender, FormClosingEventArgs e) { Settings.Default.Save(); + Registry.SetValue(setKey, "writeLog", Settings.Default.writeLog); } private void rbShutdown_CheckedChanged(object sender, EventArgs e) @@ -603,5 +637,9 @@ private void cbWriteLog_CheckedChanged(object sender, EventArgs e) #endregion + + [DllImport("kernel32.dll", SetLastError = true)] + [return: MarshalAs(UnmanagedType.Bool)] + static extern bool AllocConsole(); } } diff --git a/fSettings.Designer.cs b/fSettings.Designer.cs index a1e99ef..fd2b0da 100644 --- a/fSettings.Designer.cs +++ b/fSettings.Designer.cs @@ -39,6 +39,8 @@ private void InitializeComponent() this.tbFileName = new System.Windows.Forms.TextBox(); this.label3 = new System.Windows.Forms.Label(); this.groupBox1 = new System.Windows.Forms.GroupBox(); + this.button1 = new System.Windows.Forms.Button(); + this.tbLogLoc = new System.Windows.Forms.TextBox(); this.linkLabel4 = new System.Windows.Forms.LinkLabel(); this.cbUseSound = new System.Windows.Forms.CheckBox(); this.cbDelete = new System.Windows.Forms.CheckBox(); @@ -53,8 +55,7 @@ private void InitializeComponent() this.label5 = new System.Windows.Forms.Label(); this.tbAMELoc = new System.Windows.Forms.TextBox(); this.timer1 = new System.Windows.Forms.Timer(this.components); - this.tbLogLoc = new System.Windows.Forms.TextBox(); - this.button1 = new System.Windows.Forms.Button(); + this.button3 = new System.Windows.Forms.Button(); this.groupBox1.SuspendLayout(); this.groupBox2.SuspendLayout(); this.groupBox3.SuspendLayout(); @@ -175,6 +176,26 @@ private void InitializeComponent() this.groupBox1.TabStop = false; this.groupBox1.Text = "Miscellaneous Settings"; // + // button1 + // + this.button1.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.button1.Location = new System.Drawing.Point(296, 204); + this.button1.Name = "button1"; + this.button1.Size = new System.Drawing.Size(82, 22); + this.button1.TabIndex = 15; + this.button1.Text = "Search..."; + this.button1.UseVisualStyleBackColor = true; + this.button1.Click += new System.EventHandler(this.button1_Click); + // + // tbLogLoc + // + this.tbLogLoc.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(44)))), ((int)(((byte)(44)))), ((int)(((byte)(44))))); + this.tbLogLoc.ForeColor = System.Drawing.Color.White; + this.tbLogLoc.Location = new System.Drawing.Point(10, 206); + this.tbLogLoc.Name = "tbLogLoc"; + this.tbLogLoc.Size = new System.Drawing.Size(280, 20); + this.tbLogLoc.TabIndex = 14; + // // linkLabel4 // this.linkLabel4.AutoSize = true; @@ -324,25 +345,18 @@ private void InitializeComponent() // this.timer1.Tick += new System.EventHandler(this.timer1_Tick); // - // tbLogLoc - // - this.tbLogLoc.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(44)))), ((int)(((byte)(44)))), ((int)(((byte)(44))))); - this.tbLogLoc.ForeColor = System.Drawing.Color.White; - this.tbLogLoc.Location = new System.Drawing.Point(10, 206); - this.tbLogLoc.Name = "tbLogLoc"; - this.tbLogLoc.Size = new System.Drawing.Size(280, 20); - this.tbLogLoc.TabIndex = 14; + // button3 // - // button1 - // - this.button1.FlatStyle = System.Windows.Forms.FlatStyle.Flat; - this.button1.Location = new System.Drawing.Point(296, 204); - this.button1.Name = "button1"; - this.button1.Size = new System.Drawing.Size(82, 22); - this.button1.TabIndex = 15; - this.button1.Text = "Search..."; - this.button1.UseVisualStyleBackColor = true; - this.button1.Click += new System.EventHandler(this.button1_Click); + this.button3.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.button3.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.button3.ForeColor = System.Drawing.Color.OrangeRed; + this.button3.Location = new System.Drawing.Point(122, 480); + this.button3.Name = "button3"; + this.button3.Size = new System.Drawing.Size(101, 22); + this.button3.TabIndex = 14; + this.button3.Text = "Reset Settings"; + this.button3.UseVisualStyleBackColor = true; + this.button3.Click += new System.EventHandler(this.button3_Click); // // fSettings // @@ -350,6 +364,7 @@ private void InitializeComponent() this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(44)))), ((int)(((byte)(44)))), ((int)(((byte)(44))))); this.ClientSize = new System.Drawing.Size(412, 515); + this.Controls.Add(this.button3); this.Controls.Add(this.groupBox3); this.Controls.Add(this.groupBox2); this.Controls.Add(this.groupBox1); @@ -399,5 +414,6 @@ private void InitializeComponent() private System.Windows.Forms.LinkLabel linkLabel4; private System.Windows.Forms.Button button1; private System.Windows.Forms.TextBox tbLogLoc; + private System.Windows.Forms.Button button3; } } \ No newline at end of file diff --git a/fSettings.cs b/fSettings.cs index 95b38df..4f14e3b 100644 --- a/fSettings.cs +++ b/fSettings.cs @@ -1,4 +1,5 @@ using meautosd.Properties; +using Microsoft.Win32; using System; using System.Collections.Generic; using System.ComponentModel; @@ -10,6 +11,8 @@ using System.Threading.Tasks; using System.Windows.Forms; +using static meautosd.cConst; + namespace meautosd { public partial class fSettings : Form @@ -21,6 +24,7 @@ public fSettings() private void fSettings_Load(object sender, EventArgs e) { + tbLocFile.Text = Settings.Default.finishLocation; tbFileName.Text = Settings.Default.finishName; tbPbToken.Text = Settings.Default.pbToken; @@ -31,6 +35,16 @@ private void fSettings_Load(object sender, EventArgs e) cbUseSound.Checked = Settings.Default.useSound; tbLogLoc.Text = Settings.Default.logFileLoc; + Registry.SetValue(setKey, "finishLocation", Settings.Default.finishLocation); + Registry.SetValue(setKey, "finishName", Settings.Default.finishName); + Registry.SetValue(setKey, "pbToken", Settings.Default.pbToken); + Registry.SetValue(setKey, "pbSend", Settings.Default.pbSend); + Registry.SetValue(setKey, "deleFinishFile", Settings.Default.deleFinishFile); + Registry.SetValue(setKey, "AMEPath", Settings.Default.AMEPath); + Registry.SetValue(setKey, "openAMEOnStartup", Settings.Default.openAMEOnStartup); + Registry.SetValue(setKey, "useSound", Settings.Default.useSound); + Registry.SetValue(setKey, "logFileLoc", Settings.Default.logFileLoc); + if (Settings.Default.AMEPath == "") { timer1.Start(); @@ -60,6 +74,22 @@ private void fSettings_Load(object sender, EventArgs e) } + public string GetProcessPath(string name) + { + Process[] processes = Process.GetProcessesByName(name); + + if (processes.Length > 0) + { + try { return processes[0].MainModule.FileName; } + catch { return string.Empty; } + } + else + { + return string.Empty; + } + } + + #region TIMERS & ELEMENTS private void btLocFile_Click(object sender, EventArgs e) { FolderBrowserDialog dialog = new FolderBrowserDialog(); @@ -110,21 +140,6 @@ private void timer1_Tick(object sender, EventArgs e) } } - public string GetProcessPath(string name) - { - Process[] processes = Process.GetProcessesByName(name); - - if (processes.Length > 0) - { - try { return processes[0].MainModule.FileName; } - catch { return string.Empty; } - } - else - { - return string.Empty; - } - } - private void cbAMEStartup_CheckedChanged(object sender, EventArgs e) { Settings.Default.openAMEOnStartup = cbAMEStartup.Checked; @@ -172,5 +187,25 @@ private void button1_Click(object sender, EventArgs e) Settings.Default.logFileLoc = dialog.SelectedPath.ToString() + @"\ameautosd_logfile.txt"; tbLogLoc.Text = dialog.SelectedPath.ToString() + @"\ameautosd_logfile.txt"; } + #endregion + + private void button3_Click(object sender, EventArgs e) + { + RegistryKey key = Registry.CurrentUser.OpenSubKey("SOFTWARE", true); + var msgbox = MessageBox.Show("Do you really want to reset ALL settings for this tool?", "Reset Settings", MessageBoxButtons.YesNo, MessageBoxIcon.Warning); + + if (msgbox == DialogResult.Yes) + { + if (key.OpenSubKey("AMEAutoShutdown") != null) + { + key.DeleteSubKeyTree("AMEAutoShutdown"); + } + + Settings.Default.Reset(); + + Process.Start(System.Reflection.Assembly.GetExecutingAssembly().Location); + Application.Exit(); + } + } } } diff --git a/fSurvey.cs b/fSurvey.cs index 5d6fc15..f18f2e5 100644 --- a/fSurvey.cs +++ b/fSurvey.cs @@ -1,4 +1,5 @@ using meautosd.Properties; +using Microsoft.Win32; using System; using System.Collections.Generic; using System.ComponentModel; @@ -22,6 +23,7 @@ public fSurvey() private void fSurvey_FormClosing(object sender, FormClosingEventArgs e) { Settings.Default.dontShowSurvey = true; + Registry.SetValue(cConst.setKey, "dontShowSurvey", "true"); } private void btOK_Click(object sender, EventArgs e) diff --git a/obj/x64/Debug/meautosd.csproj.GenerateResource.Cache b/obj/x64/Debug/meautosd.csproj.GenerateResource.Cache index 62d6e18..d736744 100644 Binary files a/obj/x64/Debug/meautosd.csproj.GenerateResource.Cache and b/obj/x64/Debug/meautosd.csproj.GenerateResource.Cache differ diff --git a/obj/x64/Debug/meautosd.pdb b/obj/x64/Debug/meautosd.pdb index a463d81..78c3149 100644 Binary files a/obj/x64/Debug/meautosd.pdb and b/obj/x64/Debug/meautosd.pdb differ