Skip to content

Commit

Permalink
Fixed silent uninstall bug
Browse files Browse the repository at this point in the history
  • Loading branch information
valnoxy committed Dec 26, 2024
1 parent 3848a8b commit d40a66a
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 10 deletions.
11 changes: 9 additions & 2 deletions GoAwayEdge/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -151,14 +151,21 @@ public void Application_Startup(object sender, StartupEventArgs e)
return;
}

Configuration.InstallControlPanel = true;
Configuration.InitialEnvironment();
var result = InstallRoutine.Install(null);
Environment.Exit(result);
}
if (args.Contains("-u"))
{
InstallRoutine.Uninstall(null);
Environment.Exit(0);
if (IsAdministrator() == false)
{
ElevateAsAdmin(string.Join(" ", args));
Environment.Exit(0);
return;
}
var result = InstallRoutine.Uninstall(null);
Environment.Exit(result);
}
if (args.Contains("--update"))
{
Expand Down
13 changes: 7 additions & 6 deletions GoAwayEdge/Common/Installation/InstallRoutine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ public static int Install(object? sender, DoWorkEventArgs? e = null)
return 0;
}

public static void Uninstall(object? sender, DoWorkEventArgs? e = null)
public static int Uninstall(object? sender, DoWorkEventArgs? e = null)
{
var worker = sender as BackgroundWorker;
Logging.Log("Start uninstallation ...");
Expand All @@ -261,15 +261,15 @@ public static void Uninstall(object? sender, DoWorkEventArgs? e = null)
messageUi.ShowDialog();
});
Environment.Exit(1);
return;
return 1;
}
Process.Start(new ProcessStartInfo
{
FileName = Path.Combine(tempDir, "GoAwayEdge.exe"),
Arguments = "-u",
UseShellExecute = true
});
Environment.Exit(0);
Environment.Exit(3010);
}

// Remove installation directory
Expand All @@ -288,7 +288,7 @@ public static void Uninstall(object? sender, DoWorkEventArgs? e = null)
messageUi.ShowDialog();
});
Environment.Exit(1);
return;
return 1;
}

// Remove user directory
Expand All @@ -310,7 +310,7 @@ public static void Uninstall(object? sender, DoWorkEventArgs? e = null)
messageUi.ShowDialog();
});
Environment.Exit(1);
return;
return 1;
}

// Remove Ifeo & Uri handler from registry
Expand Down Expand Up @@ -359,7 +359,7 @@ public static void Uninstall(object? sender, DoWorkEventArgs? e = null)
messageUi.ShowDialog();
});
Environment.Exit(1);
return;
return 1;
}

// Clean up Task Scheduler
Expand Down Expand Up @@ -402,6 +402,7 @@ public static void Uninstall(object? sender, DoWorkEventArgs? e = null)
worker?.ReportProgress(100, "");
Logging.Log("Uninstallation finished.");
Console.WriteLine("Uninstallation finished.");
return 0;
}

internal static bool CopyItself(string pathTo, bool overwrite = false)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
-->
<Project>
<PropertyGroup>
<History>True|2024-12-26T14:09:04.1027404Z||;True|2024-12-26T15:03:19.0005711+01:00||;True|2024-12-25T17:22:09.8471194+01:00||;True|2024-08-13T19:39:30.3814052+02:00||;True|2024-08-13T19:35:07.3638159+02:00||;True|2024-08-13T01:10:27.4137217+02:00||;True|2024-08-13T01:06:17.9215774+02:00||;True|2024-08-13T00:56:54.4657665+02:00||;True|2024-08-13T00:49:21.1156303+02:00||;True|2024-08-13T00:45:56.3970427+02:00||;True|2024-08-13T00:25:23.5481220+02:00||;True|2024-08-12T22:11:19.4188626+02:00||;True|2024-08-12T22:10:38.2923046+02:00||;True|2024-08-12T22:08:45.6517147+02:00||;True|2024-07-30T00:22:22.2984409+02:00||;True|2024-07-30T00:18:17.4366719+02:00||;True|2024-07-30T00:17:49.8084336+02:00||;True|2024-07-22T18:41:59.8117684+02:00||;True|2024-06-18T00:28:22.3138517+02:00||;True|2024-06-18T00:16:46.9788815+02:00||;True|2024-06-09T20:14:23.6305404+02:00||;True|2024-06-09T19:02:49.2570274+02:00||;True|2024-06-09T18:47:29.9573023+02:00||;True|2024-06-09T18:46:39.8011527+02:00||;False|2024-06-09T18:46:05.6633541+02:00||;False|2024-06-09T18:45:59.2563619+02:00||;True|2024-02-18T17:16:27.0408261+01:00||;True|2024-02-18T17:15:41.3961034+01:00||;True|2024-02-18T17:11:58.7761728+01:00||;True|2024-02-18T17:08:57.9390623+01:00||;True|2024-02-18T17:08:26.6377454+01:00||;True|2024-02-18T17:07:45.2050537+01:00||;True|2024-02-18T17:05:12.7495146+01:00||;True|2024-02-18T17:02:32.4549017+01:00||;True|2024-02-18T16:48:25.3074382+01:00||;True|2023-10-19T00:00:28.0962969+02:00||;True|2022-11-13T02:33:03.7406004+01:00||;True|2022-11-13T02:19:07.9073988+01:00||;True|2022-11-13T02:18:35.3043045+01:00||;True|2022-11-12T20:05:07.6366825+01:00||;False|2022-11-12T20:04:52.3576134+01:00||;True|2022-11-12T19:36:12.8480978+01:00||;</History>
<History>True|2024-12-26T14:22:32.4690057Z||;True|2024-12-26T15:09:04.1027404+01:00||;True|2024-12-26T15:03:19.0005711+01:00||;True|2024-12-25T17:22:09.8471194+01:00||;True|2024-08-13T19:39:30.3814052+02:00||;True|2024-08-13T19:35:07.3638159+02:00||;True|2024-08-13T01:10:27.4137217+02:00||;True|2024-08-13T01:06:17.9215774+02:00||;True|2024-08-13T00:56:54.4657665+02:00||;True|2024-08-13T00:49:21.1156303+02:00||;True|2024-08-13T00:45:56.3970427+02:00||;True|2024-08-13T00:25:23.5481220+02:00||;True|2024-08-12T22:11:19.4188626+02:00||;True|2024-08-12T22:10:38.2923046+02:00||;True|2024-08-12T22:08:45.6517147+02:00||;True|2024-07-30T00:22:22.2984409+02:00||;True|2024-07-30T00:18:17.4366719+02:00||;True|2024-07-30T00:17:49.8084336+02:00||;True|2024-07-22T18:41:59.8117684+02:00||;True|2024-06-18T00:28:22.3138517+02:00||;True|2024-06-18T00:16:46.9788815+02:00||;True|2024-06-09T20:14:23.6305404+02:00||;True|2024-06-09T19:02:49.2570274+02:00||;True|2024-06-09T18:47:29.9573023+02:00||;True|2024-06-09T18:46:39.8011527+02:00||;False|2024-06-09T18:46:05.6633541+02:00||;False|2024-06-09T18:45:59.2563619+02:00||;True|2024-02-18T17:16:27.0408261+01:00||;True|2024-02-18T17:15:41.3961034+01:00||;True|2024-02-18T17:11:58.7761728+01:00||;True|2024-02-18T17:08:57.9390623+01:00||;True|2024-02-18T17:08:26.6377454+01:00||;True|2024-02-18T17:07:45.2050537+01:00||;True|2024-02-18T17:05:12.7495146+01:00||;True|2024-02-18T17:02:32.4549017+01:00||;True|2024-02-18T16:48:25.3074382+01:00||;True|2023-10-19T00:00:28.0962969+02:00||;True|2022-11-13T02:33:03.7406004+01:00||;True|2022-11-13T02:19:07.9073988+01:00||;True|2022-11-13T02:18:35.3043045+01:00||;True|2022-11-12T20:05:07.6366825+01:00||;False|2022-11-12T20:04:52.3576134+01:00||;True|2022-11-12T19:36:12.8480978+01:00||;</History>
<LastFailureDetails />
</PropertyGroup>
</Project>
7 changes: 6 additions & 1 deletion GoAwayEdge/UserInterface/Setup/Pages/Installation.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public Installation()
applyBackgroundWorker.WorkerSupportsCancellation = true;
if (Configuration.Uninstall)
{
applyBackgroundWorker.DoWork += InstallRoutine.Uninstall;
applyBackgroundWorker.DoWork += InstallRoutine_Uninstall;
}
else
{
Expand All @@ -41,5 +41,10 @@ private static void InstallRoutine_Install(object? sender, DoWorkEventArgs e)
{
e.Result = InstallRoutine.Install(sender, e);
}

private static void InstallRoutine_Uninstall(object? sender, DoWorkEventArgs e)
{
e.Result = InstallRoutine.Uninstall(sender, e);
}
}
}

0 comments on commit d40a66a

Please sign in to comment.