feat(autoupdate): detect install type

This commit is contained in:
2026-03-10 17:13:42 +01:00
parent 1366481931
commit 41b3725faa
6 changed files with 151 additions and 39 deletions

View File

@@ -6,6 +6,7 @@ using System.Threading.Tasks;
using System.Windows.Forms;
using CarManagerV3.Forms;
using CarManagerV3.Manager;
using CarManagerV3.Util;
namespace CarManagerV3
{
@@ -65,8 +66,19 @@ namespace CarManagerV3
{
if (Updater.IsUpdateAvailable(Properties.Settings.Default.AllowPrerelease))
{
UpdatePromptForm updatePrompt = new UpdatePromptForm(Updater.GetCurrentVersion(true), Updater.GetLatestVersion(Properties.Settings.Default.AllowPrerelease));
updatePrompt.ShowDialog();
if (InstallModeDetector.IsInstalledViaMsi())
{
UpdatePromptForm updatePrompt = new UpdatePromptForm(Updater.GetCurrentVersion(true), Updater.GetLatestVersion(Properties.Settings.Default.AllowPrerelease));
updatePrompt.ShowDialog();
} else
{
DialogResult updateResult = MessageBox.Show($"A new version of Car Manager is available! \nYour Version: {Updater.GetCurrentVersion(true)} \nLatest Version: {Updater.GetLatestVersion(Properties.Settings.Default.AllowPrerelease)} \n\nDo you want to open the Git repository to download the update?", "Update Available", MessageBoxButtons.YesNo, MessageBoxIcon.Information);
if (updateResult == DialogResult.Yes)
{
Updater.OpenReleasePage(Updater.GetLatestVersion(Properties.Settings.Default.AllowPrerelease));
}
}
}
}
catch (Exception ex)