From d973ba9512cdf33116bc2b422ba914bee252916a Mon Sep 17 00:00:00 2001 From: Daniel Carvalho Liedke Date: Mon, 7 Dec 2020 21:01:12 -0300 Subject: [PATCH] Autosave Profile and Keybindings file selected to be able to start faster the AutoHotkey --- .../ConfigurationForm/App.config | 15 ++++++ .../ConfigurationForm/ConfigForm.cs | 17 +++++++ .../Properties/Settings.Designer.cs | 46 +++++++++++++------ .../Properties/Settings.settings | 17 ++++--- 4 files changed, 76 insertions(+), 19 deletions(-) diff --git a/ConfigurationForm/ConfigurationForm/App.config b/ConfigurationForm/ConfigurationForm/App.config index 88fa402..bbe057e 100644 --- a/ConfigurationForm/ConfigurationForm/App.config +++ b/ConfigurationForm/ConfigurationForm/App.config @@ -1,6 +1,21 @@  + + +
+ + + + + + + + + + + + \ No newline at end of file diff --git a/ConfigurationForm/ConfigurationForm/ConfigForm.cs b/ConfigurationForm/ConfigurationForm/ConfigForm.cs index 4b405f4..e24d340 100644 --- a/ConfigurationForm/ConfigurationForm/ConfigForm.cs +++ b/ConfigurationForm/ConfigurationForm/ConfigForm.cs @@ -104,6 +104,14 @@ public ConfigForm() m_TabControlPoint = new Point(5, tableLayoutPanel2.Size.Height); m_TabControlOffset = new Size(5, tableLayoutPanel2.Size.Height + tableLayoutPanel1.Size.Height); + + // Load the selected profile and keybindings file if we have values + if (!string.IsNullOrEmpty(Properties.Settings.Default.ProfileFile) && + !string.IsNullOrEmpty(Properties.Settings.Default.KeybindingsFile)) + { + profilesComboBox.Text = Properties.Settings.Default.ProfileFile; + keybindingsComboBox.Text = Properties.Settings.Default.KeybindingsFile; + } } private void PopulateComboBox(IniTypeInfo iniTypeInfo) @@ -223,6 +231,15 @@ protected override void OnClosing(CancelEventArgs e) if (m_SelectedIniPath == null) return; + // Save the selected profile and keybindings file if we have values + if (profilesComboBox.Text!= "(Select INI)" && keybindingsComboBox.Text != "(Select INI)") + { + Properties.Settings.Default.ProfileFile = profilesComboBox.Text; + Properties.Settings.Default.KeybindingsFile = keybindingsComboBox.Text; + Properties.Settings.Default.Save(); + Properties.Settings.Default.Reload(); + } + IniParserHelper.PrintIniData(m_SelectedIniData); var result = diff --git a/ConfigurationForm/ConfigurationForm/Properties/Settings.Designer.cs b/ConfigurationForm/ConfigurationForm/Properties/Settings.Designer.cs index 9ede026..6286d31 100644 --- a/ConfigurationForm/ConfigurationForm/Properties/Settings.Designer.cs +++ b/ConfigurationForm/ConfigurationForm/Properties/Settings.Designer.cs @@ -8,23 +8,43 @@ // //------------------------------------------------------------------------------ -namespace ConfigurationForm.Properties -{ - - +namespace ConfigurationForm.Properties { + + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] - internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase - { - + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.8.1.0")] + internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { + private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); - - public static Settings Default - { - get - { + + public static Settings Default { + get { return defaultInstance; } } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("")] + public string ProfileFile { + get { + return ((string)(this["ProfileFile"])); + } + set { + this["ProfileFile"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("")] + public string KeybindingsFile { + get { + return ((string)(this["KeybindingsFile"])); + } + set { + this["KeybindingsFile"] = value; + } + } } } diff --git a/ConfigurationForm/ConfigurationForm/Properties/Settings.settings b/ConfigurationForm/ConfigurationForm/Properties/Settings.settings index 3964565..2c98503 100644 --- a/ConfigurationForm/ConfigurationForm/Properties/Settings.settings +++ b/ConfigurationForm/ConfigurationForm/Properties/Settings.settings @@ -1,7 +1,12 @@  - - - - - - + + + + + + + + + + + \ No newline at end of file