Added automatic removal of Squirrel version

This commit is contained in:
SpoinkyNL committed 2017-11-28 21:26:28 +01:00
1 parent 9b7b0bcaf4
commit efa2d6614d
2 files changed
+26 -2

No files matched your search

+1
View File
@@ -30,6 +30,7 @@ namespace Artemis
DllManager.RestoreLogitechDll();
// Check compatibility before trying to boot further
CompatibilityService.CheckRivaTuner();
Updater.CleanSquirrel();
Initialize();
BindSpecialValues();
+25 -2
View File
@@ -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);
}
/// <summary>
@@ -189,6 +189,29 @@ namespace Artemis.Utilities
}
}
/// <summary>
/// Removes the old Squirrel-based version of Artemis if present
/// </summary>
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);
}
/// <summary>
/// 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();
}
}
}
}