Add -upgrade installer arg (#47)

This commit is contained in:
pizzaboxer 2023-01-02 11:47:42 +00:00
parent 2b21720894
commit b950488ed7
2 changed files with 24 additions and 8 deletions

View File

@ -23,11 +23,21 @@ namespace Bloxstrap.Helpers
if (installedVersionInfo.ProductVersion != currentVersionInfo.ProductVersion)
{
DialogResult result = Program.ShowMessageBox(
$"The version of {Program.ProjectName} you've launched is different to the version you currently have installed.\nWould you like to update your currently installed version?",
MessageBoxIcon.Question,
MessageBoxButtons.YesNo
);
DialogResult result;
if (Program.IsUpgrade)
{
result = DialogResult.Yes;
}
else
{
result = Program.ShowMessageBox(
$"The version of {Program.ProjectName} you've launched is different to the version you currently have installed.\nWould you like to upgrade your currently installed version?",
MessageBoxIcon.Question,
MessageBoxButtons.YesNo
);
}
if (result == DialogResult.Yes)
{
@ -42,9 +52,11 @@ namespace Bloxstrap.Helpers
MessageBoxButtons.OK
);
new Preferences().ShowDialog();
Program.Exit();
if (!Program.IsQuiet)
{
new Preferences().ShowDialog();
Program.Exit();
}
}
}

View File

@ -36,6 +36,7 @@ namespace Bloxstrap
public static bool IsQuiet { get; private set; } = false;
public static bool IsUninstall { get; private set; } = false;
public static bool IsNoLaunch { get; private set; } = false;
public static bool IsUpgrade { get; private set; } = false;
public static string LocalAppData { get; private set; } = null!;
public static string StartMenu { get; private set; } = null!;
@ -87,6 +88,9 @@ namespace Bloxstrap
if (Array.IndexOf(args, "-nolaunch") != -1)
IsNoLaunch = true;
if (Array.IndexOf(args, "-upgrade") != -1)
IsUpgrade = true;
}
// check if installed