mirror of
https://github.com/ayufan/steam-deck-tools.git
synced 2026-03-15 09:24:12 +01:00
Store FanControl settings in .ini
This commit is contained in:
parent
658898d632
commit
36d83032c7
|
|
@ -1,18 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<configuration>
|
||||
<configSections>
|
||||
<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
|
||||
<section name="FanControl.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
|
||||
</sectionGroup>
|
||||
</configSections>
|
||||
<userSettings>
|
||||
<FanControl.Properties.Settings>
|
||||
<setting name="FanMode" serializeAs="String">
|
||||
<value>Default</value>
|
||||
</setting>
|
||||
<setting name="AlwaysOnTop" serializeAs="String">
|
||||
<value>True</value>
|
||||
</setting>
|
||||
</FanControl.Properties.Settings>
|
||||
</userSettings>
|
||||
</configuration>
|
||||
|
|
@ -21,22 +21,10 @@
|
|||
<ProjectReference Include="..\ExternalHelpers\ExternalHelpers.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Update="Properties\Settings.Designer.cs">
|
||||
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Settings.settings</DependentUpon>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Update="inpoutx64.dll">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="Properties\Settings.settings">
|
||||
<Generator>SettingsSingleFileGenerator</Generator>
|
||||
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
50
FanControl/Properties/Settings.Designer.cs
generated
50
FanControl/Properties/Settings.Designer.cs
generated
|
|
@ -1,50 +0,0 @@
|
|||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// 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.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,12 +0,0 @@
|
|||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" GeneratedClassNamespace="FanControl.Properties" GeneratedClassName="Settings">
|
||||
<Profiles />
|
||||
<Settings>
|
||||
<Setting Name="FanMode" Type="System.String" Scope="User">
|
||||
<Value Profile="(Default)">Default</Value>
|
||||
</Setting>
|
||||
<Setting Name="AlwaysOnTop" Type="System.Boolean" Scope="User">
|
||||
<Value Profile="(Default)">True</Value>
|
||||
</Setting>
|
||||
</Settings>
|
||||
</SettingsFile>
|
||||
26
FanControl/Settings.cs
Normal file
26
FanControl/Settings.cs
Normal file
|
|
@ -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>("FanMode", CommonHelpers.FanMode.Default); }
|
||||
set { Set("FanMode", value); }
|
||||
}
|
||||
|
||||
public bool AlwaysOnTop
|
||||
{
|
||||
get { return Get<bool>("AlwaysOnTop", true); }
|
||||
set { Set("AlwaysOnTop", value); }
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue