private void ButtonManageSaves_Click(object sender, EventArgs e) { if (_saveManagementWindow != null) { _saveManagementWindow.Close(); } _saveManagementWindow = new FormSaves(rtw2Installation); _saveManagementWindow.ShowDialog(); var name = _saveManagementWindow.SelectedGameName; if (name != null) { var exe = Path.Combine(Program.Rtw2ExecutableDirectory, "Games", name, "RTW2.exe"); var bytes = File.ReadAllBytes(exe); var checksum = Program.GetChecksum(bytes); var version = _rtw2VersionRegistry.Rtw2Versions.First(v => v.Checksum == checksum); rtw2Installation = new Rtw2Installation(version, Path.GetDirectoryName(exe)); UpdateListViews(); RefreshRtw2InstallData(); SelectedSavelabel.Text = $"Game: {name} (RTW2 v{rtw2Installation.InstalledVersion.Version})"; ButtonSinglePlayer.Enabled = true; } else { SelectedSavelabel.Text = "No game selected"; ButtonSinglePlayer.Enabled = false; } }
private void UpdateRtw2() { var dialog = MessageBox.Show($"RTW2 v{_rtw2VersionRegistry.Rtw2Versions.Max()?.Version} is available. Download now? This is safe and won't affect your existing games.", "Download new RTW2 version", MessageBoxButtons.YesNo); if (dialog != DialogResult.Yes) { return; } try { // TODO var thread = new Thread(() => { var rtw2_files = Installer.GetLatestRtw2Patch(); var clean = new Rtw2Installation(_rtw2VersionRegistry.CurrentRtw2Version, Path.Combine(Program.Rtw2ExecutableDirectory, "Clean")); clean.UpdateRtw2(rtw2_files); }); thread.Start(); var progress = new FormProgress(thread) { Text = "Launching Rule the Waves 2 patcher" }; progress.ShowDialog(); RefreshRtw2InstallData(); MessageBox.Show($"Update complete - you can now start new games using RTW2 {_rtw2VersionRegistry.CurrentRtw2Version.Version}!"); } catch (Exception ecp) { Log.Error("Failed to update RTW2", ecp); Program.OpenBrowser(@"https://nws-online.proboards.com/board/27/rule-waves-2"); } }
private void FormMain_Load(object sender, EventArgs e) { try { Icon = new Icon(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Thalassic.ico")); } catch { Log.Debug("Failed to load icon"); } _ = MessageBox.Show(new Form { TopMost = true }, "Thalassic will check for updates and then launch, this might take a moment."); Cursor = Cursors.WaitCursor; // Only check mirrors for new versions at app startup _rtw2VersionRegistry.Update(_modRegistry.Mirrors); rtw2Installation = new Rtw2Installation(_rtw2VersionRegistry.CurrentRtw2Version, Path.Combine(Program.Rtw2ExecutableDirectory, "Clean")); _modRegistry.Update(true); RefreshRtw2InstallData(); UpdateListViews(); Cursor = Cursors.Default; }
public FormSaves(Rtw2Installation rtw2Installation) { InitializeComponent(); _rtw2Installation = rtw2Installation; }