diff --git a/Artemis/Artemis/ArtemisBootstrapper.cs b/Artemis/Artemis/ArtemisBootstrapper.cs index 6635c2415..b65e01154 100644 --- a/Artemis/Artemis/ArtemisBootstrapper.cs +++ b/Artemis/Artemis/ArtemisBootstrapper.cs @@ -30,6 +30,7 @@ namespace Artemis DllManager.RestoreLogitechDll(); // Check compatibility before trying to boot further CompatibilityService.CheckRivaTuner(); + Updater.CleanSquirrel(); Initialize(); BindSpecialValues(); diff --git a/Artemis/Artemis/Utilities/Updater.cs b/Artemis/Artemis/Utilities/Updater.cs index 4d5c3fd5e..b5d6ce37f 100644 --- a/Artemis/Artemis/Utilities/Updater.cs +++ b/Artemis/Artemis/Utilities/Updater.cs @@ -147,7 +147,7 @@ namespace Artemis.Utilities private static object ConvertBytesToMegabytes(long bytes) { - return Math.Round((bytes / 1024f) / 1024f, 2); + return Math.Round(bytes / 1024f / 1024f, 2); } /// @@ -189,6 +189,29 @@ namespace Artemis.Utilities } } + /// + /// Removes the old Squirrel-based version of Artemis if present + /// + public static void CleanSquirrel() + { + var squirrelPath = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + "\\Artemis"; + if (!Directory.Exists(squirrelPath)) + return; + + var psi = new ProcessStartInfo + { + FileName = squirrelPath + "\\Update.exe", + Arguments = "--uninstall", + Verb = "runas" + }; + + var process = new System.Diagnostics.Process {StartInfo = psi}; + process.Start(); + process.WaitForExit(); + + Directory.Delete(squirrelPath, true); + } + /// /// JSON default value handling can only go so far, so the update will take care of defaults /// on the offsets if they are null @@ -217,4 +240,4 @@ namespace Artemis.Utilities offsetSettings.Save(); } } -} \ No newline at end of file +}