From 171a68f4f191c3d4e74be6f08029bd6d75b11418 Mon Sep 17 00:00:00 2001 From: Awbugl Date: Wed, 22 Mar 2023 22:48:43 +0800 Subject: [PATCH] Update GlobalConfig.cs --- Core/GlobalConfig.cs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) 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; } }