From be3d3928382d95b6d211901268951029cca25a60 Mon Sep 17 00:00:00 2001 From: Cyberboss Date: Tue, 14 Nov 2017 12:53:00 -0500 Subject: [PATCH] Removes remnants of .NET config from server --- TGS.Server/DeprecatedInstanceConfig.cs | 78 +--------------------- TGS.Server/Properties/Settings.Designer.cs | 26 -------- TGS.Server/Properties/Settings.settings | 5 -- TGS.Server/TGS.Server.csproj | 9 --- 4 files changed, 2 insertions(+), 116 deletions(-) delete mode 100644 TGS.Server/Properties/Settings.Designer.cs delete mode 100644 TGS.Server/Properties/Settings.settings diff --git a/TGS.Server/DeprecatedInstanceConfig.cs b/TGS.Server/DeprecatedInstanceConfig.cs index 3297e7423b..8f06074e44 100644 --- a/TGS.Server/DeprecatedInstanceConfig.cs +++ b/TGS.Server/DeprecatedInstanceConfig.cs @@ -11,82 +11,8 @@ namespace TGS.Server /// /// The default directory /// - const string DefaultInstallationPath = "C:\\tgstation-server-3"; - - /// - /// Convert the settings version 6 .NET settings file to a config json - /// - /// An based off the old .NET setting file - public static IInstanceConfig CreateFromNETSettings() - { - var Config = Properties.Settings.Default; - var result = new DeprecatedInstanceConfig(Helpers.NormalizePath(LoadPreviousNetPropertyOrDefault("ServerDirectory", "C:\\tgstation-server-3"))); - // using nameof for sanity where possible - result.ProjectName = LoadPreviousNetPropertyOrDefault(nameof(ProjectName), result.ProjectName); - result.Port = LoadPreviousNetPropertyOrDefault("ServerPort", result.Port); - result.CommitterName = LoadPreviousNetPropertyOrDefault(nameof(CommitterName), result.CommitterName); - result.CommitterEmail = LoadPreviousNetPropertyOrDefault(nameof(CommitterEmail), result.CommitterEmail); - result.Security = LoadPreviousNetPropertyOrDefault("ServerSecurity", result.Security); - result.Autostart = LoadPreviousNetPropertyOrDefault("DDAutoStart", result.Autostart); - result.ChatProviderData = LoadPreviousNetPropertyOrDefault(nameof(ChatProviderData), result.ChatProviderData); - result.ChatProviderEntropy = LoadPreviousNetPropertyOrDefault(nameof(ChatProviderEntropy), result.ChatProviderEntropy); - result.ReattachRequired = LoadPreviousNetPropertyOrDefault("ReattachToDD", result.ReattachRequired); - result.ReattachProcessID = LoadPreviousNetPropertyOrDefault("ReattachPID", result.ReattachProcessID); - result.ReattachPort = LoadPreviousNetPropertyOrDefault(nameof(ReattachPort), result.ReattachPort); - result.ReattachCommsKey = LoadPreviousNetPropertyOrDefault(nameof(ReattachCommsKey), result.ReattachCommsKey); - result.ReattachAPIVersion = LoadPreviousNetPropertyOrDefault(nameof(ReattachAPIVersion), result.ReattachAPIVersion); - result.AutoUpdateInterval = LoadPreviousNetPropertyOrDefault(nameof(AutoUpdateInterval), result.AutoUpdateInterval); - result.AuthorizedUserGroupSID = LoadPreviousNetPropertyOrDefault("AuthorizedGroupSID", result.AuthorizedUserGroupSID); - result.MigrateToCurrentVersion(); - return result; - } - - /// - /// Loads a previous .NET config and returns it or some if it wasn't set - /// - /// The type of the - /// The config key of the property - /// The default value of the - /// The if it exists, otherwise the - static T LoadPreviousNetPropertyOrDefault(string property, T defaultValue) - { - //try it the simple way first - try - { - var result = (T)Properties.Settings.Default.GetPreviousVersion(property); - return result == null ? defaultValue : result; - } - catch - { - try - { - //.NET is fucking stupid - //If we don't have the correct property in our *CURRENT* .settings file it will automatically throw an exception when it tries to load it - //Which means we can never fucking delete config settings - //Which is fucking retarded - //This hooks into the settings provider and forces it to load it anyway - var Config = Properties.Settings.Default; - var Provider = Config.Properties["SettingsVersion"].Provider; - - var sp = new SettingsProperty(property) - { - PropertyType = typeof(T), - DefaultValue = defaultValue, - Provider = Provider - }; - - var ProviderInterface = Provider as IApplicationSettingsProvider; - - var result = ProviderInterface.GetPreviousVersion(Config.Context, sp); - if (result != null && result.PropertyValue != null) - return (T)result.PropertyValue; - } - catch { } - //f u c k i t - return defaultValue; - } - } - + const string DefaultInstallationPath = "C:\\TGSTATION-SERVER-3"; + /// /// Construct a . Used by the deserializer /// diff --git a/TGS.Server/Properties/Settings.Designer.cs b/TGS.Server/Properties/Settings.Designer.cs deleted file mode 100644 index c667781590..0000000000 --- a/TGS.Server/Properties/Settings.Designer.cs +++ /dev/null @@ -1,26 +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 TGS.Server.Properties { - - - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.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; - } - } - } -} diff --git a/TGS.Server/Properties/Settings.settings b/TGS.Server/Properties/Settings.settings deleted file mode 100644 index 8e615f25fd..0000000000 --- a/TGS.Server/Properties/Settings.settings +++ /dev/null @@ -1,5 +0,0 @@ - - - - - \ No newline at end of file diff --git a/TGS.Server/TGS.Server.csproj b/TGS.Server/TGS.Server.csproj index 9eebed48f1..349c09be39 100644 --- a/TGS.Server/TGS.Server.csproj +++ b/TGS.Server/TGS.Server.csproj @@ -110,11 +110,6 @@ - - True - True - Settings.settings - @@ -128,10 +123,6 @@ Designer - - SettingsSingleFileGenerator - Settings.Designer.cs -