diff --git a/src/ARKServerManager/App.config b/src/ARKServerManager/App.config index 53c0f76e..e4fa4128 100644 --- a/src/ARKServerManager/App.config +++ b/src/ARKServerManager/App.config @@ -365,6 +365,9 @@ https://discord.gg/cJdHJSG + + 3072 + diff --git a/src/ARKServerManager/App.xaml.cs b/src/ARKServerManager/App.xaml.cs index 30b02f45..26cdd66d 100644 --- a/src/ARKServerManager/App.xaml.cs +++ b/src/ARKServerManager/App.xaml.cs @@ -1,5 +1,6 @@ using System; using System.ComponentModel; +using System.Configuration; using System.Diagnostics; using System.Globalization; using System.IO; @@ -50,43 +51,12 @@ namespace ServerManagerTool public App() { - if (string.IsNullOrWhiteSpace(Config.Default.ServerManagerUniqueKey)) - { - Config.Default.ServerManagerUniqueKey = Guid.NewGuid().ToString(); - } - - if (!string.IsNullOrWhiteSpace(Config.Default.DataDir)) - { - Config.Default.DataDir = IOUtils.NormalizeFolder(Config.Default.DataDir); - } - - if (!string.IsNullOrWhiteSpace(Config.Default.ConfigDirectory)) - { - Config.Default.ConfigDirectory = IOUtils.NormalizeFolder(Config.Default.ConfigDirectory); - } - - if (!string.IsNullOrWhiteSpace(Config.Default.BackupPath)) - { - Config.Default.BackupPath = IOUtils.NormalizeFolder(Config.Default.BackupPath); - } - - if (!string.IsNullOrWhiteSpace(Config.Default.AutoUpdate_CacheDir)) - { - Config.Default.AutoUpdate_CacheDir = IOUtils.NormalizeFolder(Config.Default.AutoUpdate_CacheDir); - } - - App.Instance = this; + Instance = this; ApplicationStarted = false; Args = string.Empty; BetaVersion = false; Title = string.Empty; Version = AppUtils.GetDeployedVersion(Assembly.GetEntryAssembly()); - - ServicePointManager.SecurityProtocol = SecurityUtils.GetSecurityProtocol(0xC00); // TLS12 - AppDomain.CurrentDomain.UnhandledException += ErrorHandling.CurrentDomain_UnhandledException; - - MigrateSettings(); - ReconfigureLogging(); } public bool ApplicationStarted @@ -195,6 +165,37 @@ namespace ServerManagerTool } } + private void CheckForValidSettings() + { + try + { + // test one property from both setting files + var upgradeConfigTest = Config.Default.UpgradeConfig; + upgradeConfigTest = CommonConfig.Default.UpgradeConfig; + + // no issues fetching the setting values, must have valid files. + return; + } + catch (ConfigurationErrorsException ex) + { + // one or more issues occurred when fetching the setting values. + // we need to delete the setting files. + + ConfigurationErrorsException exception = ex; + while (exception != null) + { + if (!string.IsNullOrWhiteSpace(exception.Filename) && exception.Filename.EndsWith("user.config")) + { + File.Delete(exception.Filename); + } + + exception = exception.InnerException as ConfigurationErrorsException; + } + + throw; + } + } + public static void DiscoverMachinePublicIP(bool forceOverride) { if (forceOverride || string.IsNullOrWhiteSpace(Config.Default.MachinePublicIP)) @@ -309,6 +310,50 @@ namespace ServerManagerTool { base.OnStartup(e); + try + { + CheckForValidSettings(); + } + catch (Exception ex) + { + var message = $"{ex.Message}\r\n\r\nTry restarting the server manager, if this keeps happening please report this crash to the Server Manager discord."; + var result = MessageBox.Show(message, "Server Manager crashed", MessageBoxButton.OK, MessageBoxImage.Exclamation); + Environment.Exit(1); + } + + MigrateSettings(); + + if (string.IsNullOrWhiteSpace(Config.Default.ServerManagerUniqueKey)) + { + Config.Default.ServerManagerUniqueKey = Guid.NewGuid().ToString(); + } + + if (!string.IsNullOrWhiteSpace(Config.Default.DataDir)) + { + Config.Default.DataDir = IOUtils.NormalizeFolder(Config.Default.DataDir); + } + + if (!string.IsNullOrWhiteSpace(Config.Default.ConfigDirectory)) + { + Config.Default.ConfigDirectory = IOUtils.NormalizeFolder(Config.Default.ConfigDirectory); + } + + if (!string.IsNullOrWhiteSpace(Config.Default.BackupPath)) + { + Config.Default.BackupPath = IOUtils.NormalizeFolder(Config.Default.BackupPath); + } + + if (!string.IsNullOrWhiteSpace(Config.Default.AutoUpdate_CacheDir)) + { + Config.Default.AutoUpdate_CacheDir = IOUtils.NormalizeFolder(Config.Default.AutoUpdate_CacheDir); + } + + ServicePointManager.SecurityProtocol = SecurityUtils.GetSecurityProtocol(Config.Default.ServicePointManager_SecurityProtocol); + + AppDomain.CurrentDomain.UnhandledException += ErrorHandling.CurrentDomain_UnhandledException; + + ReconfigureLogging(); + _globalizer = GlobalizedApplication.Instance; try { diff --git a/src/ARKServerManager/Config.Designer.cs b/src/ARKServerManager/Config.Designer.cs index 45ae9010..bb48af64 100644 --- a/src/ARKServerManager/Config.Designer.cs +++ b/src/ARKServerManager/Config.Designer.cs @@ -3255,5 +3255,14 @@ namespace ServerManagerTool { this["Alert_OnlinePlayerCountChange"] = value; } } + + [global::System.Configuration.ApplicationScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("3072")] + public int ServicePointManager_SecurityProtocol { + get { + return ((int)(this["ServicePointManager_SecurityProtocol"])); + } + } } } diff --git a/src/ARKServerManager/Config.settings b/src/ARKServerManager/Config.settings index c5f1fe1b..028fd1a4 100644 --- a/src/ARKServerManager/Config.settings +++ b/src/ARKServerManager/Config.settings @@ -893,5 +893,8 @@ Online Player Count: + + 3072 + \ No newline at end of file diff --git a/src/ARKServerManager/ErrorHandling.cs b/src/ARKServerManager/ErrorHandling.cs index 5e8f78d1..e8518a7f 100644 --- a/src/ARKServerManager/ErrorHandling.cs +++ b/src/ARKServerManager/ErrorHandling.cs @@ -30,7 +30,7 @@ namespace ServerManagerTool { var details = new StringBuilder(); details.AppendLine("ARK Server Manager Crash Report"); - details.AppendLine("Please report this crash to the Ark Server Manager forums - https://arkservermanager.freeforums.net"); + details.AppendLine($"Please report this crash to the Server Manager discord - {Config.Default.DiscordUrl}"); details.AppendLine(); details.AppendLine($"Assembly: {Assembly.GetExecutingAssembly()}"); @@ -64,7 +64,7 @@ namespace ServerManagerTool message.AppendLine($"Crash Dump: {crashFile}"); details.AppendLine(); details.AppendLine(); - message.AppendLine("Please report this crash to the Ark Server Manager forums - https://arkservermanager.freeforums.net"); + message.AppendLine($"Please report this crash to the Server Manager discord - {Config.Default.DiscordUrl}"); message.AppendLine("The crash log will now be opened in notepad."); var result = MessageBox.Show(message.ToString(), "ARK Server Manager crashed", MessageBoxButton.OK, MessageBoxImage.Exclamation); diff --git a/src/ARKServerManager/VersionFeed.xml b/src/ARKServerManager/VersionFeed.xml index 083ba99d..f1d7a9ff 100644 --- a/src/ARKServerManager/VersionFeed.xml +++ b/src/ARKServerManager/VersionFeed.xml @@ -9,10 +9,10 @@ urn:uuid:8CDA70CF-E8B8-4B9B-AD50-AD9A8B528E5B - 1.1.436 (1.1.436.1) - 1.1.436.1 + 1.1.436 (1.1.436.2) + 1.1.436.2 - 2022-07-15T00:00:00Z + 2022-07-16T00:00:00Z

@@ -20,6 +20,7 @@

  • Server Status - changed the server status code to stop the status cycling and to be more accurate.
  • +
  • Added a check for a valid configuration file when starting the server manager.\r\nIf config file is not valid, then it will delete the config file and shutdown the manager, with a message to restart the manager.

diff --git a/src/ARKServerManager/VersionFeedBeta.xml b/src/ARKServerManager/VersionFeedBeta.xml index 750127f9..6917c1de 100644 --- a/src/ARKServerManager/VersionFeedBeta.xml +++ b/src/ARKServerManager/VersionFeedBeta.xml @@ -5,7 +5,30 @@ Ark Server Manager Version Feed This is the Ark Server Manager beta version feed. - 2022-07-15T00:00:00Z + 2022-07-16T00:00:00Z + + + urn:uuid:8CDA70CF-E8B8-4B9B-AD50-AD9A8B528E5B + 1.1.436 (1.1.436.2) + 1.1.436.2 + + 2022-07-16T00:00:00Z + +
+

+ BUGFIX +
+

    +
  • Added a check for a valid configuration file when starting the server manager.\r\nIf config file is not valid, then it will delete the config file and shutdown the manager, with a message to restart the manager.
  • +
+

+
+
+ + bletch + bletch1971@hotmail.com + +
urn:uuid:8CDA70CF-E8B8-4B9B-AD50-AD9A8B528E5B diff --git a/src/ConanServerManager/App.config b/src/ConanServerManager/App.config index 866b2103..add373f6 100644 --- a/src/ConanServerManager/App.config +++ b/src/ConanServerManager/App.config @@ -284,6 +284,9 @@ https://discord.gg/cJdHJSG + + 3072 + diff --git a/src/ConanServerManager/App.xaml.cs b/src/ConanServerManager/App.xaml.cs index 83874b10..bc6664ed 100644 --- a/src/ConanServerManager/App.xaml.cs +++ b/src/ConanServerManager/App.xaml.cs @@ -1,5 +1,6 @@ using System; using System.ComponentModel; +using System.Configuration; using System.Diagnostics; using System.Globalization; using System.IO; @@ -49,43 +50,12 @@ namespace ServerManagerTool public App() { - if (string.IsNullOrWhiteSpace(Config.Default.ServerManagerUniqueKey)) - { - Config.Default.ServerManagerUniqueKey = Guid.NewGuid().ToString(); - } - - if (!string.IsNullOrWhiteSpace(Config.Default.DataPath)) - { - Config.Default.DataPath = IOUtils.NormalizeFolder(Config.Default.DataPath); - } - - if (!string.IsNullOrWhiteSpace(Config.Default.ConfigPath)) - { - Config.Default.ConfigPath = IOUtils.NormalizeFolder(Config.Default.ConfigPath); - } - - if (!string.IsNullOrWhiteSpace(Config.Default.BackupPath)) - { - Config.Default.BackupPath = IOUtils.NormalizeFolder(Config.Default.BackupPath); - } - - if (!string.IsNullOrWhiteSpace(Config.Default.AutoUpdate_CacheDir)) - { - Config.Default.AutoUpdate_CacheDir = IOUtils.NormalizeFolder(Config.Default.AutoUpdate_CacheDir); - } - - App.Instance = this; + Instance = this; ApplicationStarted = false; Args = string.Empty; BetaVersion = false; Title = string.Empty; Version = AppUtils.GetDeployedVersion(Assembly.GetEntryAssembly()); - - ServicePointManager.SecurityProtocol = SecurityUtils.GetSecurityProtocol(0xC00); // TLS12 - AppDomain.CurrentDomain.UnhandledException += ErrorHandling.CurrentDomain_UnhandledException; - - MigrateSettings(); - ReconfigureLogging(); } public bool ApplicationStarted @@ -194,6 +164,37 @@ namespace ServerManagerTool } } + private void CheckForValidSettings() + { + try + { + // test one property from both setting files + var upgradeConfigTest = Config.Default.UpgradeConfig; + upgradeConfigTest = CommonConfig.Default.UpgradeConfig; + + // no issues fetching the setting values, must have valid files. + return; + } + catch (ConfigurationErrorsException ex) + { + // one or more issues occurred when fetching the setting values. + // we need to delete the setting files. + + ConfigurationErrorsException exception = ex; + while (exception != null) + { + if (!string.IsNullOrWhiteSpace(exception.Filename) && exception.Filename.EndsWith("user.config")) + { + File.Delete(exception.Filename); + } + + exception = exception.InnerException as ConfigurationErrorsException; + } + + throw; + } + } + public static void DiscoverMachinePublicIP(bool forceOverride) { if (forceOverride || string.IsNullOrWhiteSpace(Config.Default.MachinePublicIP)) @@ -308,6 +309,50 @@ namespace ServerManagerTool { base.OnStartup(e); + try + { + CheckForValidSettings(); + } + catch (Exception ex) + { + var message = $"{ex.Message}\r\n\r\nTry restarting the server manager, if this keeps happening please report this crash to the Server Manager discord."; + var result = MessageBox.Show(message, "Server Manager crashed", MessageBoxButton.OK, MessageBoxImage.Exclamation); + Environment.Exit(1); + } + + MigrateSettings(); + + if (string.IsNullOrWhiteSpace(Config.Default.ServerManagerUniqueKey)) + { + Config.Default.ServerManagerUniqueKey = Guid.NewGuid().ToString(); + } + + if (!string.IsNullOrWhiteSpace(Config.Default.DataPath)) + { + Config.Default.DataPath = IOUtils.NormalizeFolder(Config.Default.DataPath); + } + + if (!string.IsNullOrWhiteSpace(Config.Default.ConfigPath)) + { + Config.Default.ConfigPath = IOUtils.NormalizeFolder(Config.Default.ConfigPath); + } + + if (!string.IsNullOrWhiteSpace(Config.Default.BackupPath)) + { + Config.Default.BackupPath = IOUtils.NormalizeFolder(Config.Default.BackupPath); + } + + if (!string.IsNullOrWhiteSpace(Config.Default.AutoUpdate_CacheDir)) + { + Config.Default.AutoUpdate_CacheDir = IOUtils.NormalizeFolder(Config.Default.AutoUpdate_CacheDir); + } + + ServicePointManager.SecurityProtocol = SecurityUtils.GetSecurityProtocol(Config.Default.ServicePointManager_SecurityProtocol); + + AppDomain.CurrentDomain.UnhandledException += ErrorHandling.CurrentDomain_UnhandledException; + + ReconfigureLogging(); + _globalizer = GlobalizedApplication.Instance; try { diff --git a/src/ConanServerManager/Config.Designer.cs b/src/ConanServerManager/Config.Designer.cs index 727e3171..0d4c399f 100644 --- a/src/ConanServerManager/Config.Designer.cs +++ b/src/ConanServerManager/Config.Designer.cs @@ -2447,5 +2447,14 @@ namespace ServerManagerTool { this["Alert_OnlinePlayerCountChange"] = value; } } + + [global::System.Configuration.ApplicationScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("3072")] + public int ServicePointManager_SecurityProtocol { + get { + return ((int)(this["ServicePointManager_SecurityProtocol"])); + } + } } } diff --git a/src/ConanServerManager/Config.settings b/src/ConanServerManager/Config.settings index 18907b1c..67f0befc 100644 --- a/src/ConanServerManager/Config.settings +++ b/src/ConanServerManager/Config.settings @@ -671,5 +671,8 @@ Online Player Count: + + 3072 + \ No newline at end of file diff --git a/src/ConanServerManager/ErrorHandling.cs b/src/ConanServerManager/ErrorHandling.cs index 0ba411ef..d4c3f468 100644 --- a/src/ConanServerManager/ErrorHandling.cs +++ b/src/ConanServerManager/ErrorHandling.cs @@ -29,7 +29,7 @@ namespace ServerManagerTool { var details = new StringBuilder(); details.AppendLine("Server Manager Crash Report"); - details.AppendLine($"Please report this crash to the Server Manager forums - {Config.Default.ServerManagerForumUrl}"); + details.AppendLine($"Please report this crash to the Server Manager discord - {Config.Default.DiscordUrl}"); details.AppendLine(); details.AppendLine($"Assembly: {Assembly.GetEntryAssembly()}"); @@ -64,7 +64,7 @@ namespace ServerManagerTool message.AppendLine($"Crash Dump: {crashFile}"); details.AppendLine(); details.AppendLine(); - message.AppendLine($"Please report this crash to the Server Manager forums - {Config.Default.ServerManagerForumUrl}"); + message.AppendLine($"Please report this crash to the Server Manager discord - {Config.Default.DiscordUrl}"); message.AppendLine("The crash log will now be opened in notepad."); var result = MessageBox.Show(message.ToString(), "Server Manager crashed", MessageBoxButton.OK, MessageBoxImage.Exclamation); diff --git a/src/ConanServerManager/VersionFeed.xml b/src/ConanServerManager/VersionFeed.xml index baa6a4fe..6f042b38 100644 --- a/src/ConanServerManager/VersionFeed.xml +++ b/src/ConanServerManager/VersionFeed.xml @@ -9,10 +9,10 @@ urn:uuid:8CDA70CF-E8B8-4B9B-AD50-AD9A8B528E5B - 1.1.79 (1.1.79.1) - 1.1.79.1 + 1.1.79 (1.1.79.2) + 1.1.79.2 - 2022-07-15T00:00:00Z + 2022-07-16T00:00:00Z

@@ -20,6 +20,7 @@

  • Server Status - changed the server status code to stop the status cycling and to be more accurate.
  • +
  • Added a check for a valid configuration file when starting the server manager.\r\nIf config file is not valid, then it will delete the config file and shutdown the manager, with a message to restart the manager.

diff --git a/src/ConanServerManager/VersionFeedBeta.xml b/src/ConanServerManager/VersionFeedBeta.xml index 20843139..09985a9e 100644 --- a/src/ConanServerManager/VersionFeedBeta.xml +++ b/src/ConanServerManager/VersionFeedBeta.xml @@ -5,7 +5,30 @@ Conan Server Manager Version Feed This is the Conan Server Manager beta version feed. - 2022-07-15T00:00:00Z + 2022-07-16T00:00:00Z + + + urn:uuid:8CDA70CF-E8B8-4B9B-AD50-AD9A8B528E5B + 1.1.79 (1.1.79.2) + 1.1.79.2 + + 2022-07-16T00:00:00Z + +
+

+ BUGFIX +
+

    +
  • Added a check for a valid configuration file when starting the server manager.\r\nIf config file is not valid, then it will delete the config file and shutdown the manager, with a message to restart the manager.
  • +
+

+
+
+ + bletch + bletch1971@hotmail.com + +
urn:uuid:8CDA70CF-E8B8-4B9B-AD50-AD9A8B528E5B