Skip to content

Commit

Permalink
Warn about in-place downgrades
Browse files Browse the repository at this point in the history
  • Loading branch information
pizzaboxer committed Aug 27, 2024
1 parent bac13eb commit 9a412ea
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Bloxstrap/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -220,8 +220,10 @@ protected override void OnStartup(StartupEventArgs e)

Locale.Set(Settings.Prop.Locale);

#if !DEBUG
if (!LaunchSettings.UninstallFlag.Active)
Installer.HandleUpgrade();
#endif

LaunchHandler.ProcessLaunchArgs();
}
Expand Down
15 changes: 15 additions & 0 deletions Bloxstrap/Installer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,18 @@ public static void HandleUpgrade()
if (MD5Hash.FromFile(Paths.Process) == MD5Hash.FromFile(Paths.Application))
return;

if (currentVer is not null && existingVer is not null && Utilities.CompareVersions(currentVer, existingVer) == VersionComparison.LessThan)
{
var result = Frontend.ShowMessageBox(
Strings.InstallChecker_VersionLessThanInstalled,
MessageBoxImage.Question,
MessageBoxButton.YesNo
);

if (result != MessageBoxResult.Yes)
return;
}

// silently upgrade version if the command line flag is set or if we're launching from an auto update
if (!App.LaunchSettings.UpgradeFlag.Active && !isAutoUpgrade)
{
Expand Down Expand Up @@ -466,6 +478,9 @@ public static void HandleUpgrade()
App.FastFlags.Save();
}

if (currentVer is null)
return;

if (isAutoUpgrade)
{
Utilities.ShellExecute($"https://github.com/{App.ProjectRepository}/wiki/Release-notes-for-Bloxstrap-v{currentVer}");
Expand Down
11 changes: 11 additions & 0 deletions Bloxstrap/Resources/Strings.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions Bloxstrap/Resources/Strings.resx
Original file line number Diff line number Diff line change
Expand Up @@ -1142,4 +1142,9 @@ If not, then please report this exception to the maintainers of this fork. Do NO
<data name="Menu.UnsavedChanges" xml:space="preserve">
<value>You have unsaved changes. Are you sure you want to close without saving?</value>
</data>
<data name="InstallChecker.VersionLessThanInstalled" xml:space="preserve">
<value>The version of Bloxstrap you've launched is older than the version you currently have installed.
Issues may occur and your settings may be altered. A reinstall is recommended.
Are you sure you want to continue?</value>
</data>
</root>

0 comments on commit 9a412ea

Please sign in to comment.