diff --git a/Core/GlobalConfig.cs b/Core/GlobalConfig.cs index 1e19f3c..8cdb10c 100644 --- a/Core/GlobalConfig.cs +++ b/Core/GlobalConfig.cs @@ -52,11 +52,11 @@ internal static void Init() Environment.Exit(0); } - Config = JsonConvert.DeserializeObject(File.ReadAllText("apiconfig.json"))!; + Config = JsonConvert.DeserializeObject(File.ReadAllText(apiconfig))!; var tokens = Path.Combine(AppContext.BaseDirectory, "tokens.json"); if (!File.Exists(tokens)) File.WriteAllText(tokens, "[]"); - Tokens = JsonConvert.DeserializeObject>(File.ReadAllText("tokens.json"))!; + Tokens = JsonConvert.DeserializeObject>(File.ReadAllText(tokens))!; Directory.CreateDirectory(Path.Combine(Config.DataPath, "log")); Directory.CreateDirectory(Path.Combine(Config.DataPath, "database")); @@ -74,8 +74,8 @@ internal static void Init() Console.WriteLine("cert file not found, get infomation from main server..."); Dictionary json = CertResponse.GetContent(); - File.WriteAllBytes(Config.CertFileName, Convert.FromBase64String(json["cert"])); - + File.WriteAllBytes(arccert, Convert.FromBase64String(json["cert"])); + Console.WriteLine("cert file created."); } } @@ -95,7 +95,7 @@ internal static void CheckUpdate() Console.WriteLine("Register account task completed."); } } - + BackgroundService.ArcUpdate(); Console.Clear(); } @@ -105,12 +105,12 @@ internal static void Reload(string fileName) switch (fileName) { case "apiconfig.json": - Config = JsonConvert.DeserializeObject(File.ReadAllText("apiconfig.json"))!; + Config = JsonConvert.DeserializeObject(File.ReadAllText(Path.Combine(AppContext.BaseDirectory, "apiconfig.json")))!; ArcaeaFetch.Init(); break; case "tokens.json": - Tokens = JsonConvert.DeserializeObject>(File.ReadAllText("tokens.json"))!; + Tokens = JsonConvert.DeserializeObject>(File.ReadAllText(Path.Combine(AppContext.BaseDirectory, "tokens.json")))!; break; } }