This commit is contained in:
Jakob 2023-07-14 11:46:12 +02:00
parent e42fbf9b2a
commit 99267bdf9d
3 changed files with 33 additions and 33 deletions

View file

@ -36,13 +36,6 @@ namespace EnvyUpdate
{ {
InitializeComponent(); InitializeComponent();
// Delete installed legacy versions
if (Directory.Exists(GlobalVars.appdata))
{
Debug.LogToFile("INFO Found old appdata installation, uninstalling.");
UninstallAll();
}
localDriv = Util.GetLocDriv(); localDriv = Util.GetLocDriv();
Debug.LogToFile("INFO Local driver version: " + localDriv); Debug.LogToFile("INFO Local driver version: " + localDriv);
@ -269,32 +262,6 @@ namespace EnvyUpdate
Process.Start(gpuURL); 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) private void switchStudioDriver_Unchecked(object sender, RoutedEventArgs e)
{ {
if (File.Exists(GlobalVars.exedirectory + "sd.envy")) if (File.Exists(GlobalVars.exedirectory + "sd.envy"))

View file

@ -54,6 +54,13 @@ namespace EnvyUpdate
Environment.Exit(1); 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 (!Util.IsNvidia())
{ {
if (arguments.Contains("/fake")) if (arguments.Contains("/fake"))

View file

@ -526,6 +526,32 @@ namespace EnvyUpdate
return gpuUrl; 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) public static void DownloadFile(string fileURL, string savePath)
{ {
//TODO Implement downloading //TODO Implement downloading