diff --git a/EnvyUpdate/DashboardPage.xaml.cs b/EnvyUpdate/DashboardPage.xaml.cs index 411a330..62f41bc 100644 --- a/EnvyUpdate/DashboardPage.xaml.cs +++ b/EnvyUpdate/DashboardPage.xaml.cs @@ -36,13 +36,6 @@ namespace EnvyUpdate { InitializeComponent(); - // Delete installed legacy versions - if (Directory.Exists(GlobalVars.appdata)) - { - Debug.LogToFile("INFO Found old appdata installation, uninstalling."); - UninstallAll(); - } - localDriv = Util.GetLocDriv(); Debug.LogToFile("INFO Local driver version: " + localDriv); @@ -269,32 +262,6 @@ namespace EnvyUpdate Process.Start(gpuURL); } - public void UninstallAll() - { - if (File.Exists(GlobalVars.startup + "\\EnvyUpdate.lnk")) - { - Debug.LogToFile("INFO Deleted startup entry."); - File.Delete(GlobalVars.startup + "\\EnvyUpdate.lnk"); - } - - if (File.Exists(GlobalVars.startmenu + "\\EnvyUpdate.lnk")) - { - Debug.LogToFile("INFO Deleted start menu entry."); - File.Delete(GlobalVars.startmenu + "\\EnvyUpdate.lnk"); - } - if ((GlobalVars.exedirectory == GlobalVars.appdata) && File.Exists(GlobalVars.appdata + "EnvyUpdate.exe")) - { - Debug.LogToFile("INFO Deleting EnvyUpdate appdata and self."); - MessageBox.Show(Properties.Resources.uninstall_legacy_message); - Util.SelfDelete(); - } - else if (Directory.Exists(GlobalVars.appdata)) - { - Debug.LogToFile("INFO Deleting EnvyUpdate appdata folder"); - Directory.Delete(GlobalVars.appdata, true); - } - } - private void switchStudioDriver_Unchecked(object sender, RoutedEventArgs e) { if (File.Exists(GlobalVars.exedirectory + "sd.envy")) diff --git a/EnvyUpdate/MainWindow.xaml.cs b/EnvyUpdate/MainWindow.xaml.cs index 672e8db..5353f49 100644 --- a/EnvyUpdate/MainWindow.xaml.cs +++ b/EnvyUpdate/MainWindow.xaml.cs @@ -54,6 +54,13 @@ namespace EnvyUpdate Environment.Exit(1); } + // Delete installed legacy versions + if (Directory.Exists(GlobalVars.appdata)) + { + Debug.LogToFile("INFO Found old appdata installation, uninstalling."); + Util.UninstallAll(); + } + if (!Util.IsNvidia()) { if (arguments.Contains("/fake")) diff --git a/EnvyUpdate/Util.cs b/EnvyUpdate/Util.cs index 9aa70cf..c9fec1f 100644 --- a/EnvyUpdate/Util.cs +++ b/EnvyUpdate/Util.cs @@ -526,6 +526,32 @@ namespace EnvyUpdate return gpuUrl; } + public static void UninstallAll() + { + if (System.IO.File.Exists(GlobalVars.startup + "\\EnvyUpdate.lnk")) + { + Debug.LogToFile("INFO Deleted startup entry."); + System.IO.File.Delete(GlobalVars.startup + "\\EnvyUpdate.lnk"); + } + + if (System.IO.File.Exists(GlobalVars.startmenu + "\\EnvyUpdate.lnk")) + { + Debug.LogToFile("INFO Deleted start menu entry."); + System.IO.File.Delete(GlobalVars.startmenu + "\\EnvyUpdate.lnk"); + } + if ((GlobalVars.exedirectory == GlobalVars.appdata) && System.IO.File.Exists(GlobalVars.appdata + "EnvyUpdate.exe")) + { + Debug.LogToFile("INFO Deleting EnvyUpdate appdata and self."); + MessageBox.Show(Properties.Resources.uninstall_legacy_message); + Util.SelfDelete(); + } + else if (Directory.Exists(GlobalVars.appdata)) + { + Debug.LogToFile("INFO Deleting EnvyUpdate appdata folder"); + Directory.Delete(GlobalVars.appdata, true); + } + } + public static void DownloadFile(string fileURL, string savePath) { //TODO Implement downloading