From b310110c0863219d3ae568e4ccba6b20982de5cc Mon Sep 17 00:00:00 2001 From: NicoAICP Date: Wed, 1 Jul 2020 09:27:48 +0200 Subject: [PATCH] Fixed Issue where new bases would require to delete your key files to enter the tkey correctly --- UWUVCI AIO WPF/Models/MainViewModel.cs | 35 ++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/UWUVCI AIO WPF/Models/MainViewModel.cs b/UWUVCI AIO WPF/Models/MainViewModel.cs index aa8c398..f6464ab 100644 --- a/UWUVCI AIO WPF/Models/MainViewModel.cs +++ b/UWUVCI AIO WPF/Models/MainViewModel.cs @@ -2129,7 +2129,42 @@ namespace UWUVCI_AIO_WPF } KeyFile.ExportFile(temp, console); } + else + { + FixupKeys(l, console); + } + } + private void FixupKeys(List l, GameConsoles console) + { + string file = $@"bin\keys\{console.ToString().ToLower()}.vck"; + var save = KeyFile.ReadBasesFromKeyFile(file); + List temp = new List(); + foreach(TKeys a in save) + { + temp.Add(a); + } + foreach (GameBases gb in l) + { + TKeys tempkey = new TKeys(); + bool check = false; + foreach(TKeys a in save) + { + if(a.Base.Name == gb.Name && a.Base.Region == gb.Region) + { + check = true; + break; + } + } + if (!check) + { + tempkey.Base = gb; + temp.Add(tempkey); + } + + } + File.Delete(file); + KeyFile.ExportFile(temp, console); } private void UpdateKeyFile(List l, GameConsoles console) {