From 81c6269a3d43de0661cbfe3bb497a184e35f00e3 Mon Sep 17 00:00:00 2001 From: ZestyTS Date: Thu, 4 Aug 2022 18:23:01 -0700 Subject: [PATCH] Fixed Paths and awaited async function --- UWUVCI AIO WPF/Classes/KeyFile.cs | 2 +- UWUVCI AIO WPF/Models/MainViewModel.cs | 16 +++++++++------- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/UWUVCI AIO WPF/Classes/KeyFile.cs b/UWUVCI AIO WPF/Classes/KeyFile.cs index e3177aa..f0b456e 100644 --- a/UWUVCI AIO WPF/Classes/KeyFile.cs +++ b/UWUVCI AIO WPF/Classes/KeyFile.cs @@ -33,7 +33,7 @@ namespace UWUVCI_AIO_WPF.Classes public static void ExportFile(List precomp, GameConsoles console) { CheckAndFixFolder("bin\\keys"); - Stream createConfigStream = new FileStream($@"bin\keys\{console.ToString().ToLower()}.vck", FileMode.Create, FileAccess.Write); + Stream createConfigStream = new FileStream(Path.Combine(Directory.GetCurrentDirectory(), $@"bin\keys\{console.ToString().ToLower()}.vck"), FileMode.Create, FileAccess.Write); GZipStream compressedStream = new GZipStream(createConfigStream, CompressionMode.Compress); IFormatter formatter = new BinaryFormatter(); formatter.Serialize(compressedStream, precomp); diff --git a/UWUVCI AIO WPF/Models/MainViewModel.cs b/UWUVCI AIO WPF/Models/MainViewModel.cs index a46a465..35a8507 100644 --- a/UWUVCI AIO WPF/Models/MainViewModel.cs +++ b/UWUVCI AIO WPF/Models/MainViewModel.cs @@ -1994,7 +1994,7 @@ namespace UWUVCI_AIO_WPF } private void CreateSettingIfNotExist(List l, GameConsoles console) { - string file = $@"bin\keys\{console.ToString().ToLower()}.vck"; + string file = Path.Combine(Directory.GetCurrentDirectory(), $@"bin\keys\{console.ToString().ToLower()}.vck"); if (!File.Exists(file)) { List temp = new List(); @@ -2014,7 +2014,7 @@ namespace UWUVCI_AIO_WPF } private void FixupKeys(List l, GameConsoles console) { - string file = $@"bin\keys\{console.ToString().ToLower()}.vck"; + string file = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, $@"bin\keys\{console.ToString().ToLower()}.vck"); var save = KeyFile.ReadBasesFromKeyFile(file); List temp = new List(); foreach (TKeys a in save) @@ -2045,10 +2045,10 @@ namespace UWUVCI_AIO_WPF } private void UpdateKeyFile(List l, GameConsoles console) { - string file = $@"bin\keys\{console.ToString().ToLower()}.vck"; + string file = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, $@"bin\keys\{console.ToString().ToLower()}.vck"); if (File.Exists(file)) { - List keys = KeyFile.ReadBasesFromKeyFile($@"bin\keys\{console.ToString().ToLower()}.vck"); + List keys = KeyFile.ReadBasesFromKeyFile(file); List newTK = new List(); foreach (GameBases gb in l) { @@ -2169,7 +2169,8 @@ namespace UWUVCI_AIO_WPF } public bool isKeySet(GameBases bases) { - var temp = KeyFile.ReadBasesFromKeyFile($@"bin\keys\{GetConsoleOfBase(bases).ToString().ToLower()}.vck"); + string file = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, $@"bin\keys\{GetConsoleOfBase(bases).ToString().ToLower()}.vck"); + var temp = KeyFile.ReadBasesFromKeyFile(file); foreach (TKeys t in temp) { if (t.Base.Name == bases.Name && t.Base.Region == bases.Region) @@ -2215,7 +2216,8 @@ namespace UWUVCI_AIO_WPF } public TKeys getTkey(GameBases bases) { - var temp = KeyFile.ReadBasesFromKeyFile($@"bin\keys\{GetConsoleOfBase(bases).ToString().ToLower()}.vck"); + string file = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, $@"bin\keys\{GetConsoleOfBase(bases).ToString().ToLower()}.vck"); + var temp = KeyFile.ReadBasesFromKeyFile(file); foreach (TKeys t in temp) if (t.Base.Name == bases.Name && t.Base.Region == bases.Region) @@ -2229,7 +2231,7 @@ namespace UWUVCI_AIO_WPF ValidatePathsStillExist(); if (Task.Run(() => CheckForInternetConnectionAsync()).GetAwaiter().GetResult()) { - Task.Run(() => { Injection.Download(this); }); + Task.Run(() => Injection.Download(this)).GetAwaiter(); DownloadWait dw = new DownloadWait("Downloading Base - Please Wait", "", this); try