mirror of
https://github.com/jkocon/g-helper.git
synced 2026-02-23 13:00:52 +01:00
Backup config reading https://github.com/seerge/g-helper/issues/2978
This commit is contained in:
@@ -41,10 +41,19 @@ public static class AppConfig
|
|||||||
{
|
{
|
||||||
config = JsonSerializer.Deserialize<Dictionary<string, object>>(text);
|
config = JsonSerializer.Deserialize<Dictionary<string, object>>(text);
|
||||||
}
|
}
|
||||||
catch
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Logger.WriteLine("Broken config: " + text);
|
Logger.WriteLine($"Broken config: {ex.Message} {text}");
|
||||||
Init();
|
try
|
||||||
|
{
|
||||||
|
text = File.ReadAllText(configFile + ".bak");
|
||||||
|
config = JsonSerializer.Deserialize<Dictionary<string, object>>(text);
|
||||||
|
}
|
||||||
|
catch (Exception exb)
|
||||||
|
{
|
||||||
|
Logger.WriteLine($"Broken backup config: {exb.Message} {text}");
|
||||||
|
Init();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
Reference in New Issue
Block a user