diff --git a/FanControl/App.config b/FanControl/App.config
deleted file mode 100644
index 58d4f4d..0000000
--- a/FanControl/App.config
+++ /dev/null
@@ -1,18 +0,0 @@
-
-
-
-
-
-
-
-
-
-
- Default
-
-
- True
-
-
-
-
\ No newline at end of file
diff --git a/FanControl/FanControl.csproj b/FanControl/FanControl.csproj
index ea1fbf8..3049cb7 100644
--- a/FanControl/FanControl.csproj
+++ b/FanControl/FanControl.csproj
@@ -21,22 +21,10 @@
-
-
- True
- True
- Settings.settings
-
-
-
PreserveNewest
-
- SettingsSingleFileGenerator
- Settings.Designer.cs
-
diff --git a/FanControl/FanControlForm.cs b/FanControl/FanControlForm.cs
index 0d6bd30..633488b 100644
--- a/FanControl/FanControlForm.cs
+++ b/FanControl/FanControlForm.cs
@@ -26,7 +26,7 @@ namespace FanControl
notifyIcon.Text = Text;
notifyIcon.Visible = true;
- TopMost = Properties.Settings.Default.AlwaysOnTop;
+ TopMost = Settings.Default.AlwaysOnTop;
toolStripMenuItemAlwaysOnTop.Checked = TopMost;
toolStripMenuItemAlwaysOnTopContext.Checked = TopMost;
@@ -45,15 +45,7 @@ namespace FanControl
fanModeSelectMenu.Items.Add(item);
}
- try
- {
- var fanMode = Enum.Parse(typeof(FanMode), Properties.Settings.Default.FanMode);
- setFanMode((FanMode)fanMode);
- }
- catch (System.ArgumentException)
- {
- setFanMode(FanMode.Default);
- }
+ setFanMode(Settings.Default.FanMode);
propertyGrid1.SelectedObject = fanControl;
propertyGrid1.ExpandAllGridItems();
@@ -85,8 +77,7 @@ namespace FanControl
private void setFanMode(FanMode mode)
{
fanControl.SetMode(mode);
- Properties.Settings.Default["FanMode"] = mode.ToString();
- Properties.Settings.Default.Save();
+ Settings.Default.FanMode = mode;
foreach (ToolStripItem menuItem in contextMenu.Items)
{
@@ -188,8 +179,7 @@ namespace FanControl
TopMost = !TopMost;
toolStripMenuItemAlwaysOnTop.Checked = TopMost;
toolStripMenuItemAlwaysOnTopContext.Checked = TopMost;
- Properties.Settings.Default.AlwaysOnTop = toolStripMenuItemAlwaysOnTop.Checked;
- Properties.Settings.Default.Save();
+ Settings.Default.AlwaysOnTop = toolStripMenuItemAlwaysOnTop.Checked;
}
}
}
diff --git a/FanControl/Properties/Settings.Designer.cs b/FanControl/Properties/Settings.Designer.cs
deleted file mode 100644
index 86d43fb..0000000
--- a/FanControl/Properties/Settings.Designer.cs
+++ /dev/null
@@ -1,50 +0,0 @@
-//------------------------------------------------------------------------------
-//
-// This code was generated by a tool.
-// Runtime Version:4.0.30319.42000
-//
-// Changes to this file may cause incorrect behavior and will be lost if
-// the code is regenerated.
-//
-//------------------------------------------------------------------------------
-
-namespace FanControl.Properties {
-
-
- [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
- [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.3.0.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 {
- return defaultInstance;
- }
- }
-
- [global::System.Configuration.UserScopedSettingAttribute()]
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- [global::System.Configuration.DefaultSettingValueAttribute("Default")]
- public string FanMode {
- get {
- return ((string)(this["FanMode"]));
- }
- set {
- this["FanMode"] = value;
- }
- }
-
- [global::System.Configuration.UserScopedSettingAttribute()]
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- [global::System.Configuration.DefaultSettingValueAttribute("True")]
- public bool AlwaysOnTop {
- get {
- return ((bool)(this["AlwaysOnTop"]));
- }
- set {
- this["AlwaysOnTop"] = value;
- }
- }
- }
-}
diff --git a/FanControl/Properties/Settings.settings b/FanControl/Properties/Settings.settings
deleted file mode 100644
index fb58c07..0000000
--- a/FanControl/Properties/Settings.settings
+++ /dev/null
@@ -1,12 +0,0 @@
-
-
-
-
-
- Default
-
-
- True
-
-
-
\ No newline at end of file
diff --git a/FanControl/Settings.cs b/FanControl/Settings.cs
new file mode 100644
index 0000000..04ae3c4
--- /dev/null
+++ b/FanControl/Settings.cs
@@ -0,0 +1,26 @@
+using CommonHelpers;
+
+namespace FanControl
+{
+ internal sealed class Settings : BaseSettings
+ {
+ public static readonly Settings Default = new Settings();
+
+ public Settings() : base("Settings")
+ {
+ TouchSettings = true;
+ }
+
+ public FanMode FanMode
+ {
+ get { return Get("FanMode", CommonHelpers.FanMode.Default); }
+ set { Set("FanMode", value); }
+ }
+
+ public bool AlwaysOnTop
+ {
+ get { return Get("AlwaysOnTop", true); }
+ set { Set("AlwaysOnTop", value); }
+ }
+ }
+}