From 82b32eaf422462cbe89634383358163a70a8dbce Mon Sep 17 00:00:00 2001 From: fyr77 Date: Tue, 4 Aug 2020 17:51:48 +0200 Subject: [PATCH] fix self-deletion --- EnvyUpdate/MainWindow.xaml.cs | 9 +++++---- EnvyUpdate/Util.cs | 2 ++ 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/EnvyUpdate/MainWindow.xaml.cs b/EnvyUpdate/MainWindow.xaml.cs index 55e5e2b..df9454d 100644 --- a/EnvyUpdate/MainWindow.xaml.cs +++ b/EnvyUpdate/MainWindow.xaml.cs @@ -210,16 +210,17 @@ namespace EnvyUpdate chkAutostart.IsEnabled = false; chkAutostart.IsChecked = false; } - if ((GlobalVars.exepath == GlobalVars.appdata) && File.Exists(GlobalVars.appdata + "EnvyUpdate.exe")) - Util.SelfDelete(); - else if (File.Exists(GlobalVars.appdata + "EnvyUpdate.exe")) - File.Delete(GlobalVars.appdata + "EnvyUpdate.exe"); File.Delete(GlobalVars.appdata + "desktop.envy"); File.Delete(GlobalVars.appdata + "mobile.envy"); File.Delete(GlobalVars.startup + "\\EnvyUpdate.lnk"); File.Delete(GlobalVars.startmenu + "\\EnvyUpdate.lnk"); + + if ((GlobalVars.exepath == GlobalVars.appdata) && File.Exists(GlobalVars.appdata + "EnvyUpdate.exe")) + Util.SelfDelete(); + else if (File.Exists(GlobalVars.appdata + "EnvyUpdate.exe")) + File.Delete(GlobalVars.appdata + "EnvyUpdate.exe"); } else chkInstall.IsChecked = true; diff --git a/EnvyUpdate/Util.cs b/EnvyUpdate/Util.cs index 32290b5..ba34e5c 100644 --- a/EnvyUpdate/Util.cs +++ b/EnvyUpdate/Util.cs @@ -187,6 +187,8 @@ namespace EnvyUpdate }; process.StartInfo = startInfo; process.Start(); + + Environment.Exit(2); } public static int GetIDs(string IDtype) {