private async void VerifyGame() { await Task.Yield(); ResultGameVerification result = GameVerification.VerifyGame(model.PathToSkyrim, ""); if (result.IsGameFound) { model.SkyrimVersion = result.GameVersion.ToString(); if (result.IsSKSEFound) { model.SKSEVersion = result.SKSEVersion.ToString(); } else { model.SKSEVersion = Res.SKSENotFound; } Result = result; model.CanInstall = true; } else { model.SkyrimVersion = Res.GameNotFound; model.SKSEVersion = "-"; model.CanInstall = false; } }
public static ResultGameVerification CheckSkyrim() { string pathToSkyrim = Settings.PathToSkyrim; ResultGameVerification result = default; try { if (string.IsNullOrEmpty(pathToSkyrim) || !Directory.Exists(pathToSkyrim) || !File.Exists($"{pathToSkyrim}\\SkyrimSE.exe")) { result.IsGameFound = false; result.NeedInstall = true; return(result); } result = VerifyGame(pathToSkyrim, null); } catch (Exception er) { Logger.FatalError("CheckPathToSkyrim", er); MessageBox.Show(Res.InitError, Res.Error); result.NeedInstall = true; } return(result); }
private async Task CheckGameNew() { ResultGameVerification result = CheckSkyrim(); ModVersion.Load(); FileWatcher.Init(); if (!Mods.ExistMod("SKSE") && !result.IsSKSEFound && MessageBox.Show(Res.SKSENotFound, Res.Warning, MessageBoxButton.YesNo) == MessageBoxResult.Yes) { blockMainBtn = true; await GetSKSE(); Mods.EnableMod("SKSE"); blockMainBtn = false; } else if (Mods.ExistMod("SKSE")) { Mods.EnableMod("SKSE"); } try { if (!result.IsRuFixConsoleFound && ModVersion.HasRuFixConsole == null && MessageBox.Show(Res.SSERFix, Res.Warning, MessageBoxButton.YesNo) == MessageBoxResult.Yes) { blockMainBtn = true; if (!Mods.ExistMod("RuFixConsole")) { await GetRuFixConsole(); } Mods.EnableMod("RuFixConsole"); ModVersion.HasRuFixConsole = true; ModVersion.Save(); blockMainBtn = false; } else { ModVersion.HasRuFixConsole = result.IsRuFixConsoleFound; ModVersion.Save(); } } catch (Exception er) { blockMainBtn = false; Logger.FatalError("CheckGameNew_SSERFix", er); } }
private ResultGameVerification CheckSkyrim() { string pathToSkyrim = Settings.PathToSkyrim; ResultGameVerification result = default; try { do { while (string.IsNullOrEmpty(pathToSkyrim) || !Directory.Exists(pathToSkyrim)) { string path = GameVerification.GetGameFolder(); if (string.IsNullOrEmpty(path)) { App.AppCurrent.Shutdown(); Close(); } pathToSkyrim = path; } result = GameVerification.VerifyGame(pathToSkyrim, null); if (result.IsGameFound) { if (Settings.PathToSkyrim != pathToSkyrim) { Settings.PathToSkyrim = pathToSkyrim; Settings.Save(); } break; } pathToSkyrim = null; MessageBox.Show(Res.SkyrimNotFound, Res.Error); } while (true); } catch (Exception er) { Logger.FatalError("CheckPathToSkyrim", er); MessageBox.Show(Res.InitError, Res.Error); Close(); } return(result); }
internal static ResultGameVerification VerifyGame(string pathToGameFolder, string pathToVerificationFile) { ResultGameVerification result = new ResultGameVerification(); if (File.Exists($"{pathToGameFolder}\\SkyrimSE.exe")) { result.IsGameFound = true; string ver = FileVersionInfo.GetVersionInfo($"{pathToGameFolder}\\SkyrimSE.exe").FileVersion; try { result.GameVersion = new Version(ver); } catch { Logger.Error("VersionRead", new Exception($"Raw vesrion {ver}")); } result.UnSafeGameFilesDictionary = VerifyGameFiles(); result.IsGameSafe = result.UnSafeGameFilesDictionary.Count == 0; } else { return(result); } if (File.Exists($"{pathToGameFolder}\\skse64_loader.exe")) { result.IsSKSEFound = true; string ver = FileVersionInfo.GetVersionInfo($"{pathToGameFolder}\\skse64_loader.exe").FileVersion.Replace(", ", "."); try { result.SKSEVersion = new Version(ver); } catch { Logger.Error("VersionReadSKSE", new Exception($"Raw vesrion {ver}")); } result.UnSafeSKSEFilesDictionary = VerifySKSEFiles(); result.IsSKSESafe = result.UnSafeSKSEFilesDictionary.Count == 0; } if (Directory.Exists($"{pathToGameFolder}\\Data\\Interface")) { result.IsRuFixConsoleFound = true; } result.IsModFound = FindMod(); return(result); }
private async Task CheckGameOld() { ResultGameVerification result = CheckSkyrim(); ModVersion.Load(); FileWatcher.Init(); if (!result.IsSKSEFound && MessageBox.Show(Res.SKSENotFound, Res.Warning, MessageBoxButton.YesNo) == MessageBoxResult.Yes) { blockMainBtn = true; await InstallSKSE(); blockMainBtn = false; } try { if (!result.IsRuFixConsoleFound && ModVersion.HasRuFixConsole == null && MessageBox.Show(Res.SSERFix, Res.Warning, MessageBoxButton.YesNo) == MessageBoxResult.Yes) { blockMainBtn = true; await InstallRuFixConsole(); ModVersion.Save(); blockMainBtn = false; } else { ModVersion.HasRuFixConsole = result.IsRuFixConsoleFound; ModVersion.Save(); } } catch (Exception er) { blockMainBtn = false; Logger.FatalError("CheckGame_SSERFix", er); } }
private async Task CheckGame() { string pathToSkyrim = Settings.PathToSkyrim; ResultGameVerification result = default; try { do { while (string.IsNullOrEmpty(pathToSkyrim) || !Directory.Exists(pathToSkyrim)) { string path = GameVerification.GetGameFolder(); if (string.IsNullOrEmpty(path)) { App.AppCurrent.Shutdown(); Close(); return; } pathToSkyrim = path; } result = GameVerification.VerifyGame(pathToSkyrim, null); if (result.IsGameFound) { if (Settings.PathToSkyrim != pathToSkyrim) { Settings.PathToSkyrim = pathToSkyrim; Settings.Save(); } break; } pathToSkyrim = null; MessageBox.Show(Res.SkyrimNotFound, Res.Error); } while (true); } catch (Exception er) { Logger.FatalError("Wind_Loaded_1", er); MessageBox.Show(Res.InitError, Res.Error); Close(); } ModVersion.Load(); FileWatcher.Init(); try { if (!result.IsSKSEFound && MessageBox.Show(Res.SKSENotFound, Res.Warning, MessageBoxButton.YesNo) == MessageBoxResult.Yes) { await InstallSKSE(); } if (!result.IsRuFixConsoleFound && ModVersion.HasRuFixConsole == null && MessageBox.Show(Res.SSERFix, Res.Warning, MessageBoxButton.YesNo) == MessageBoxResult.Yes) { await InstallRuFixConsole(); ModVersion.Save(); } else { ModVersion.HasRuFixConsole = result.IsRuFixConsoleFound; ModVersion.Save(); } } catch (Exception er) { Logger.FatalError("Wind_Loaded_2", er); } }