From d77ec3ab8fc112c1e177d442a5882474b750a81e Mon Sep 17 00:00:00 2001 From: Ivan Martell Date: Sun, 28 Jul 2024 00:27:18 +0900 Subject: [PATCH] Updater URL fixed --- LittleWarGameClient/DownloadInterceptor.cs | 2 +- LittleWarGameClient/GameForm.cs | 3 ++- LittleWarGameClient/VersionHandler.cs | 10 +++++++++- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/LittleWarGameClient/DownloadInterceptor.cs b/LittleWarGameClient/DownloadInterceptor.cs index 654e06d..31e00e8 100644 --- a/LittleWarGameClient/DownloadInterceptor.cs +++ b/LittleWarGameClient/DownloadInterceptor.cs @@ -25,7 +25,7 @@ protected override bool OnBeforeDownload(IWebBrowser chromiumWebBrowser, IBrowse n++; var ext = Path.GetExtension(downloadItem.SuggestedFileName); var filenameNoExt = Path.GetFileNameWithoutExtension(downloadItem.SuggestedFileName); - completePath = Path.Join(downloadsDirPath, $"{filenameNoExt}({n}).{ext}"); + completePath = Path.Join(downloadsDirPath, $"{filenameNoExt}({n}){ext}"); } callback.Continue(completePath, showDialog: false); return true; diff --git a/LittleWarGameClient/GameForm.cs b/LittleWarGameClient/GameForm.cs index b401a0b..2c21660 100644 --- a/LittleWarGameClient/GameForm.cs +++ b/LittleWarGameClient/GameForm.cs @@ -225,7 +225,8 @@ private void GameForm_Activated(object sender, EventArgs e) { CaptureCursor(); ResizeGameWindows(); - overlayForm.Visible = true; + if (!overlayForm.IsDisposed) + overlayForm.Visible = true; } private void GameForm_FormClosing(object sender, FormClosingEventArgs e) diff --git a/LittleWarGameClient/VersionHandler.cs b/LittleWarGameClient/VersionHandler.cs index 61922b6..f511969 100644 --- a/LittleWarGameClient/VersionHandler.cs +++ b/LittleWarGameClient/VersionHandler.cs @@ -39,6 +39,9 @@ public VersionHandler(Settings s) settings = s; var productVersion = System.Windows.Forms.Application.ProductVersion.Split('+').First(); CurrentVersion = new Version(productVersion); +#if DEBUG + CurrentVersion = new Version(0,0,0); +#endif LatestVersionObtained += CheckForUpdate; PerformCheck(); } @@ -56,7 +59,12 @@ internal virtual void CheckForUpdate(object? sender, EventArgs e) if (LatestVersion != null && RequiresUpdate()) if (DialogResult.OK == MessageBox.Show("An update is available. Press OK to download it and exit the game", "Update", MessageBoxButtons.OKCancel)) { - Process.Start(new ProcessStartInfo($"https://github.com/ivanpmartell/LittleWarGameClient/releases/download/v{LatestVersion}/lwg_client.zip") { UseShellExecute = true }); + var updateUrl = $"https://github.com/ivanpmartell/LittleWarGameClient/releases/download/v{LatestVersion}/"; + if (Environment.Is64BitProcess) + updateUrl += "lwg_clientx64.zip"; + else + updateUrl += "lwg_clientx86.zip"; + Process.Start(new ProcessStartInfo(updateUrl) { UseShellExecute = true }); System.Windows.Forms.Application.Exit(); } settings.SetLastUpdateChecked(DateTime.Now.Date);