private async Task StartInstall() { //todo: for release build, make installer.Start call async //non-async call is for easy debuging try { //Reload tracker. GeneralInfo.LoadTracker(); //Uninstall previous version (if already installed) if (isInstalled) { Uninstall uninstall = new Uninstall(this, FileIO, fileManager); await Task.Run(uninstall.Start); //Do not uninstall jungle files. In the event of an error there would be no way to restore them. } //Install logic var installer = new Install_NEW(InstallerInfo, zipManager, this, FileIO, fileManager); //installer.Start(); await Task.Run(new Action(installer.Start)); ShutdownApp(); } catch (Exception ex) { SaveErrorLog(ex.ToString()); MessageBox.Show(string.Format("A critical exception occured that cannot be recovered from. The installer will now close.\n\nException:{0}", ex.ToString()), "Critical Exception", MessageBoxButton.OK, MessageBoxImage.Error); ShutdownApp(); } }
//State Init private void StateInit() { if (GeneralInfo.IsGameDirValid()) { GeneralInfo.LoadTracker(); isInstalled = !GeneralInfo.Tracker.Mod.newMod; GeneralInfo.isInstalled = isInstalled; } if (isInstalled) { //Set installstep for this InitialPrompt(); } else { if (InstallerInfo.HasInstallSteps()) { CurrentInstallState = InstallState.InstallSteps; InstallStepNext(); } else { InstallPrompt(); } } }
private void InitFileIO() { if (GeneralInfo.IsGameDirValid()) { //Only load the "data" cpks. FileIO = new Xv2FileIO(GeneralInfo.GameDir, true, new string[5] { "data2.cpk", "data1.cpk", "data0.cpk", "data.cpk", "data_d4_5_xv1.cpk" }); } }
private void InitGameDir() { GameDir = settings.GameDirectory; if (!GeneralInfo.IsGameDirValid()) { GameDir = FindGameDirectory(); settings.GameDirectory = GameDir; settings.SaveSettings(); } }
private async Task Uninstall() { if (GeneralInfo.IsGameDirValid()) { CurrentInstallState = InstallState.Uninstalling; SetBrushesForUninstalling(); await SetupInstallProcess(); //Reload tracker GeneralInfo.LoadTracker(); Uninstall uninstall = new Uninstall(this, FileIO, fileManager); //uninstall.Start(); //uninstall.SaveFiles(); try { await Task.Run(uninstall.Start); await Task.Run(uninstall.Uninstall_JungleFiles); await Task.Run(uninstall.SaveFiles); } catch (Exception ex) { SaveErrorLog(ex.ToString()); MessageBox.Show(string.Format("A critical exception occured while uninstalling that cannot be recovered from. The installer will now close.\n\nException:{0}", ex.ToString()), "Critical Exception", MessageBoxButton.OK, MessageBoxImage.Error); ShutdownApp(); } GeneralInfo.DeleteTracker(); MessageBox.Show("The mod was successfully uninstalled.", GeneralInfo.InstallerXmlInfo.InstallerName, MessageBoxButton.OK, MessageBoxImage.Information); ShutdownApp(); } else { MessageBox.Show(String.Format("The directory where the game was installed could not be located.\n\nSelect the correct directory using the Browse button and then try again. It should be named \"DB Xenoverse 2\"."), "Invalid Path", MessageBoxButton.OK, MessageBoxImage.Warning); } }
//Install private async Task Install() { if (GeneralInfo.IsGameDirValid()) { CurrentInstallState = InstallState.Installing; //Change UI SetBrushesForInstalling(); //Ensure everything needed for installing is initialized await SetupInstallProcess(); //Time to install, all other details have been confirmed StartInstall(); } else { MessageBox.Show(String.Format("The directory where the game was installed could not be located.\n\nSelect the correct directory using the Browse button and then try again. It should be named \"DB Xenoverse 2\"."), "Invalid Path", MessageBoxButton.OK, MessageBoxImage.Warning); } }