From 28daaf9a4cbab732307aa93ea74756a637f02b79 Mon Sep 17 00:00:00 2001 From: Serge <5920850+seerge@users.noreply.github.com> Date: Tue, 24 Sep 2024 11:56:18 +0200 Subject: [PATCH] Config writing tweaks --- app/AppConfig.cs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/app/AppConfig.cs b/app/AppConfig.cs index c2899b54..2ab12789 100644 --- a/app/AppConfig.cs +++ b/app/AppConfig.cs @@ -12,7 +12,7 @@ public static class AppConfig private static string? _bios; private static Dictionary config = new Dictionary(); - private static System.Timers.Timer timer = new System.Timers.Timer(1000); + private static System.Timers.Timer timer = new System.Timers.Timer(2000); static AppConfig() { @@ -90,10 +90,13 @@ public static class AppConfig return; } - Thread.Sleep(500); + Thread.Sleep(1000); - if (File.ReadAllText(backup).Contains("}")) + var backupText = File.ReadAllText(backup); + + if (backupText.Contains("{") && backupText.Contains("}")) { + //Logger.WriteLine("Config written"); File.Copy(backup, configFile, true); } else @@ -219,6 +222,7 @@ public static class AppConfig private static void Write() { + timer.Stop(); timer.Start(); }