Reimplemented error handling for SettingsFile

This commit is contained in:
2023-08-06 17:14:57 +03:00
parent ed3128b940
commit 361ed37362
9 changed files with 235 additions and 76 deletions

View File

@@ -163,16 +163,9 @@ public class Program
private static async Task PreLoadComponents(string[] args)
{
await Initialize();
if (!Directory.Exists("./Data/Resources") || !File.Exists("./Data/Resources/URLs.json"))
await Installer.SetupPluginDatabase();
URLs = new SettingsDictionary<string, string>("./Data/Resources/URLs.json");
Logger.LogEvent += (message, type, isInternal) =>
{
if (isInternal) return;
if (type == LogLevel.INFO)
Console.ForegroundColor = ConsoleColor.Green;
else if (type == LogLevel.WARNING)
@@ -186,6 +179,12 @@ public class Program
Console.ResetColor();
};
if (!Directory.Exists("./Data/Resources") || !File.Exists("./Data/Resources/URLs.json"))
await Installer.SetupPluginDatabase();
URLs = new SettingsDictionary<string, string>("./Data/Resources/URLs.json");
Console.WriteLine("Loading resources ...");
@@ -212,8 +211,7 @@ public class Program
Logger.Log(ex.ToString(), "Bot", LogLevel.ERROR);
}
}
var onlineSettingsList = await ServerCom.ReadTextFromURL(URLs["Versions"]);
foreach (var key in onlineSettingsList)
{