Skip to content

Commit

Permalink
Add -upgrade installer arg (#47)
Browse files Browse the repository at this point in the history
  • Loading branch information
pizzaboxer committed Jan 2, 2023
1 parent 2b21720 commit b950488
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 8 deletions.
28 changes: 20 additions & 8 deletions Bloxstrap/Helpers/Updater.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,21 @@ public static void CheckInstalledVersion()

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)
{
Expand All @@ -42,9 +52,11 @@ public static void CheckInstalledVersion()
MessageBoxButtons.OK
);

new Preferences().ShowDialog();

Program.Exit();
if (!Program.IsQuiet)
{
new Preferences().ShowDialog();
Program.Exit();
}
}
}

Expand Down
4 changes: 4 additions & 0 deletions Bloxstrap/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ internal static class Program
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!;
Expand Down Expand Up @@ -87,6 +88,9 @@ static void Main(string[] args)

if (Array.IndexOf(args, "-nolaunch") != -1)
IsNoLaunch = true;

if (Array.IndexOf(args, "-upgrade") != -1)
IsUpgrade = true;
}

// check if installed
Expand Down

0 comments on commit b950488

Please sign in to comment.