From 81232dff413cbe02f5d1b1908fa7c4b27807e671 Mon Sep 17 00:00:00 2001 From: K4ryuu <104531589+K4ryuu@users.noreply.github.com> Date: Sun, 5 Nov 2023 17:13:22 +0100 Subject: [PATCH] revert: CFG Auto Update --- src/CFG.cs | 30 ++++++++---------------------- 1 file changed, 8 insertions(+), 22 deletions(-) diff --git a/src/CFG.cs b/src/CFG.cs index 12fe433..773a2ed 100644 --- a/src/CFG.cs +++ b/src/CFG.cs @@ -16,30 +16,16 @@ public void CheckConfig(string moduleDirectory) { CreateAndWriteFile(path); } - else - { - using (FileStream fs = new FileStream(path, FileMode.Open, FileAccess.Read)) - using (StreamReader sr = new StreamReader(fs)) - { - // Deserialize the JSON from the file and load the configuration. - config = JsonSerializer.Deserialize(sr.ReadToEnd())!; - } - if (config != null && config.ChatPrefix != null) - config.ChatPrefix = ModifiedChatPrefix(config.ChatPrefix); - - // Check if the FFAMode is missing in the loaded configuration - if (config!.FFAMode == default) - { - config.FFAMode = false; - // Serialize the updated configuration and write it back to the file - string jsonConfig = JsonSerializer.Serialize(config, new JsonSerializerOptions() - { - WriteIndented = true - }); - File.WriteAllText(path, jsonConfig); - } + using (FileStream fs = new FileStream(path, FileMode.Open, FileAccess.Read)) + using (StreamReader sr = new StreamReader(fs)) + { + // Deserialize the JSON from the file and load the configuration. + config = JsonSerializer.Deserialize(sr.ReadToEnd())!; } + + if (config != null && config.ChatPrefix != null) + config.ChatPrefix = ModifiedChatPrefix(config.ChatPrefix); } private static void CreateAndWriteFile(string path)