Store PowerControl settings in .ini

This commit is contained in:
Kamil Trzciński 2022-12-08 10:43:10 +01:00
parent 1ffc9255e6
commit 1d6043cab0
6 changed files with 59 additions and 158 deletions

View file

@ -47,11 +47,6 @@
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<Compile Update="Settings.Designer.cs">
<DesignTimeSharedInput>True</DesignTimeSharedInput>
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
</Compile>
</ItemGroup>
<ItemGroup>
@ -77,10 +72,6 @@
<None Update="Resources\RyzenAdj\WinRing0x64.sys">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
</ItemGroup>
</Project>

View file

@ -14,10 +14,6 @@ namespace PowerControl
[STAThread]
static void Main()
{
#if DEBUG
Settings.Default.EnableExperimentalFeatures = true;
#endif
if (Settings.Default.EnableExperimentalFeatures)
{
for (int i = 0; !VangoghGPU.IsSupported; i++)

View file

@ -1,98 +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 PowerControl {
[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.ApplicationScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("Ctrl+Win+Numpad8")]
public string MenuUpKey {
get {
return ((string)(this["MenuUpKey"]));
}
}
[global::System.Configuration.ApplicationScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("Ctrl+Win+Numpad2")]
public string MenuDownKey {
get {
return ((string)(this["MenuDownKey"]));
}
}
[global::System.Configuration.ApplicationScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("Ctrl+Win+Numpad4")]
public string MenuLeftKey {
get {
return ((string)(this["MenuLeftKey"]));
}
}
[global::System.Configuration.ApplicationScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("Ctrl+Win+Numpad6")]
public string MenuRightKey {
get {
return ((string)(this["MenuRightKey"]));
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("True")]
public bool EnableNeptuneController {
get {
return ((bool)(this["EnableNeptuneController"]));
}
set {
this["EnableNeptuneController"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("True")]
public bool EnableVolumeControls {
get {
return ((bool)(this["EnableVolumeControls"]));
}
set {
this["EnableVolumeControls"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("False")]
public bool EnableExperimentalFeatures {
get {
return ((bool)(this["EnableExperimentalFeatures"]));
}
set {
this["EnableExperimentalFeatures"] = value;
}
}
}
}

59
PowerControl/Settings.cs Normal file
View file

@ -0,0 +1,59 @@
using CommonHelpers;
namespace PowerControl
{
internal sealed class Settings : BaseSettings
{
public static readonly Settings Default = new Settings();
public Settings() : base("Settings")
{
TouchSettings = true;
}
public string MenuUpKey
{
get { return Get("MenuUpKey", "Ctrl+Win+Numpad8"); }
set { Set("MenuUpKey", value); }
}
public string MenuDownKey
{
get { return Get("MenuDownKey", "Ctrl+Win+Numpad2"); }
set { Set("MenuDownKey", value); }
}
public string MenuLeftKey
{
get { return Get("MenuLeftKey", "Ctrl+Win+Numpad6"); }
set { Set("MenuLeftKey", value); }
}
public string MenuRightKey
{
get { return Get("MenuRightKey", "Ctrl+Win+Numpad6"); }
set { Set("MenuRightKey", value); }
}
public bool EnableNeptuneController
{
get { return Get<bool>("EnableNeptuneController", true); }
set { Set("EnableNeptuneController", value); }
}
public bool EnableVolumeControls
{
get { return Get<bool>("EnableVolumeControls", true); }
set { Set("EnableVolumeControls", value); }
}
public bool EnableExperimentalFeatures
{
#if DEBUG
get { return true; }
#else
get { return false; }
#endif
}
}
}

View file

@ -1,27 +0,0 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" GeneratedClassNamespace="PowerControl" GeneratedClassName="Settings">
<Profiles />
<Settings>
<Setting Name="MenuUpKey" Type="System.String" Scope="Application">
<Value Profile="(Default)">Ctrl+Win+Numpad8</Value>
</Setting>
<Setting Name="MenuDownKey" Type="System.String" Scope="Application">
<Value Profile="(Default)">Ctrl+Win+Numpad2</Value>
</Setting>
<Setting Name="MenuLeftKey" Type="System.String" Scope="Application">
<Value Profile="(Default)">Ctrl+Win+Numpad4</Value>
</Setting>
<Setting Name="MenuRightKey" Type="System.String" Scope="Application">
<Value Profile="(Default)">Ctrl+Win+Numpad6</Value>
</Setting>
<Setting Name="EnableNeptuneController" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">True</Value>
</Setting>
<Setting Name="EnableVolumeControls" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">True</Value>
</Setting>
<Setting Name="EnableExperimentalFeatures" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">False</Value>
</Setting>
</Settings>
</SettingsFile>

View file

@ -1,20 +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="SteamController.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
</sectionGroup>
<sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
<section name="SteamController.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</sectionGroup>
</configSections>
<userSettings>
</userSettings>
<applicationSettings>
<SteamController.Settings>
<setting name="StartupProfile" serializeAs="String">
<value>Desktop</value>
</setting>
</SteamController.Settings>
</applicationSettings>
</configuration>