From 84a9376469588e92d53e9de61f4e0786628113f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kamil=20Trzci=C5=84ski?= Date: Fri, 2 Dec 2022 11:27:45 +0100 Subject: [PATCH] Use hand-mande `Settings.cs` --- SteamController/App.config | 10 +++--- SteamController/Context.cs | 10 ++---- SteamController/Controller.cs | 5 +-- SteamController/Settings.Designer.cs | 50 -------------------------- SteamController/Settings.cs | 43 ++++++++++++++++++++++ SteamController/Settings.settings | 12 ------- SteamController/SteamController.csproj | 12 ------- 7 files changed, 54 insertions(+), 88 deletions(-) delete mode 100644 SteamController/Settings.Designer.cs create mode 100644 SteamController/Settings.cs delete mode 100644 SteamController/Settings.settings diff --git a/SteamController/App.config b/SteamController/App.config index 7a9fc55..0ab8bdb 100644 --- a/SteamController/App.config +++ b/SteamController/App.config @@ -4,15 +4,17 @@
+ +
+ + + - - False - Desktop - + \ No newline at end of file diff --git a/SteamController/Context.cs b/SteamController/Context.cs index cd4283d..45b8ac6 100644 --- a/SteamController/Context.cs +++ b/SteamController/Context.cs @@ -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); } } } diff --git a/SteamController/Controller.cs b/SteamController/Controller.cs index e990829..3f67ac6 100644 --- a/SteamController/Controller.cs +++ b/SteamController/Controller.cs @@ -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 } }; diff --git a/SteamController/Settings.Designer.cs b/SteamController/Settings.Designer.cs deleted file mode 100644 index 1c541b2..0000000 --- a/SteamController/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 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; - } - } - } -} diff --git a/SteamController/Settings.cs b/SteamController/Settings.cs new file mode 100644 index 0000000..6aecc8d --- /dev/null +++ b/SteamController/Settings.cs @@ -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 ""; + } + } +} diff --git a/SteamController/Settings.settings b/SteamController/Settings.settings deleted file mode 100644 index 74d32a3..0000000 --- a/SteamController/Settings.settings +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - False - - - Desktop - - - \ No newline at end of file diff --git a/SteamController/SteamController.csproj b/SteamController/SteamController.csproj index 3b4458b..a9770be 100644 --- a/SteamController/SteamController.csproj +++ b/SteamController/SteamController.csproj @@ -44,11 +44,6 @@ True Resources.resx - - True - True - Settings.settings - @@ -58,11 +53,4 @@ - - - SettingsSingleFileGenerator - Settings.Designer.cs - - - \ No newline at end of file