Config fix

This commit is contained in:
Serge
2024-01-07 18:27:43 +01:00
parent 2be3b831ef
commit 8a2eec7823

View File

@@ -24,7 +24,8 @@ public static class AppConfig
if (File.Exists(startupPath + configName)) if (File.Exists(startupPath + configName))
{ {
configFile = startupPath + configName; configFile = startupPath + configName;
} else }
else
{ {
configFile = appPath + configName; configFile = appPath + configName;
} }
@@ -159,7 +160,8 @@ public static class AppConfig
string jsonString = JsonSerializer.Serialize(config, new JsonSerializerOptions { WriteIndented = true }); string jsonString = JsonSerializer.Serialize(config, new JsonSerializerOptions { WriteIndented = true });
try try
{ {
File.WriteAllText(configFile, jsonString); File.WriteAllText(configFile + ".bak", jsonString);
File.Copy(configFile + ".bak", configFile, true);
} }
catch (Exception e) catch (Exception e)
{ {
@@ -345,7 +347,7 @@ public static class AppConfig
public static bool IsSingleColor() public static bool IsSingleColor()
{ {
return ContainsModel("GA401") || ContainsModel("FX517Z") || ContainsModel("FX516P") || ContainsModel("X13") || IsARCNM() || ContainsModel("GA502IU"); return ContainsModel("GA401") || ContainsModel("FX517Z") || ContainsModel("FX516P") || ContainsModel("X13") || IsARCNM() || ContainsModel("GA502IU");
} }
public static bool IsStrix() public static bool IsStrix()
@@ -419,7 +421,8 @@ public static class AppConfig
{ {
var (bios, model) = GetBiosAndModel(); var (bios, model) = GetBiosAndModel();
return (Int32.Parse(bios) < 312); return (Int32.Parse(bios) < 312);
} catch }
catch
{ {
return false; return false;
} }