Use hand-mande Settings.cs

This commit is contained in:
Kamil Trzciński 2022-12-02 11:27:45 +01:00
parent 57b36c7e53
commit 84a9376469
7 changed files with 54 additions and 88 deletions

View file

@ -4,15 +4,17 @@
<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="EnableSteamDetection" serializeAs="String">
<value>False</value>
</setting>
<setting name="StartupProfile" serializeAs="String">
<value>Desktop</value>
</setting>
</SteamController.Settings>
</userSettings>
</applicationSettings>
</configuration>

View file

@ -82,14 +82,8 @@ namespace SteamController
foreach (var manager in Managers)
{
try
{
manager.Tick(this);
}
catch (Exception e)
{
TraceLine("Manager: {0}. Exception: {1}", manager, e);
}
try { manager.Tick(this); }
catch (Exception e) { TraceLine("Manager: Tick: {0}. Exception: {1}", manager, e); }
}
}

View file

@ -1,4 +1,4 @@
using CommonHelpers;
using CommonHelpers;
using ExternalHelpers;
using SteamController.Profiles;
using System.ComponentModel;
@ -304,7 +304,8 @@ namespace SteamController
{
Desktop = ProfilesSettings.BackPanelSettings.Desktop,
X360 = ProfilesSettings.BackPanelSettings.X360,
X360Rumble = ProfilesSettings.X360RumbleSettings.Default
X360Rumble = ProfilesSettings.X360RumbleSettings.Default,
Application = Settings.Default
}
};

View file

@ -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 SteamController {
[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("False")]
public bool EnableSteamDetection {
get {
return ((bool)(this["EnableSteamDetection"]));
}
set {
this["EnableSteamDetection"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("Desktop")]
public string StartupProfile {
get {
return ((string)(this["StartupProfile"]));
}
set {
this["StartupProfile"] = value;
}
}
}
}

View file

@ -0,0 +1,43 @@
using System.ComponentModel;
using System.Configuration;
namespace SteamController
{
[Category("Settings")]
[TypeConverter(typeof(ExpandableObjectConverter))]
internal sealed partial class Settings : ApplicationSettingsBase
{
public static readonly Settings Default = (Settings)Synchronized(new Settings());
public Settings()
{
PropertyChanged += delegate
{
Save();
};
}
[UserScopedSetting]
[DefaultSettingValue("False")]
[BrowsableAttribute(false)]
public bool EnableSteamDetection
{
get { return ((bool)(this["EnableSteamDetection"])); }
set { this["EnableSteamDetection"] = value; }
}
[ApplicationScopedSetting]
[DefaultSettingValue("Desktop")]
[BrowsableAttribute(false)]
public string StartupProfile
{
get { return ((string)(this["StartupProfile"])); }
set { this["StartupProfile"] = value; }
}
public override string ToString()
{
return "";
}
}
}

View file

@ -1,12 +0,0 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" GeneratedClassNamespace="SteamController" GeneratedClassName="Settings">
<Profiles />
<Settings>
<Setting Name="EnableSteamDetection" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">False</Value>
</Setting>
<Setting Name="StartupProfile" Type="System.String" Scope="User">
<Value Profile="(Default)">Desktop</Value>
</Setting>
</Settings>
</SettingsFile>

View file

@ -44,11 +44,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>
@ -58,11 +53,4 @@
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<None Update="Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
</ItemGroup>
</Project>