diff --git a/ShareX/IntegrationHelpers.cs b/ShareX/IntegrationHelpers.cs index 1400b42e1..c1403bcd3 100644 --- a/ShareX/IntegrationHelpers.cs +++ b/ShareX/IntegrationHelpers.cs @@ -98,5 +98,12 @@ public static void SteamShowInApp(bool inapp) MessageBox.Show(Resources.ApplicationSettingsForm_cbSteamShowInApp_CheckedChanged_For_settings_to_take_effect_ShareX_needs_to_be_reopened_from_Steam_, "ShareX", MessageBoxButtons.OK, MessageBoxIcon.Information); } + + public static void Uninstall() + { + CreateStartupShortcut(false); + CreateShellContextMenuButton(false); + CreateSendToMenuButton(false); + } } } \ No newline at end of file diff --git a/ShareX/Program.cs b/ShareX/Program.cs index 452793056..236741c16 100644 --- a/ShareX/Program.cs +++ b/ShareX/Program.cs @@ -253,6 +253,10 @@ private static void Main(string[] args) CLI = new CLIManager(args); CLI.ParseCommands(); +#if STEAM + if (CheckUninstall()) return; // Steam will run ShareX with -Uninstall when uninstalling +#endif + if (CheckAdminTasks()) return; // If ShareX opened just for be able to execute task as Admin IsMultiInstance = CLI.IsCommandExist("multi", "m"); @@ -571,5 +575,23 @@ private static bool CheckAdminTasks() return false; } + + private static bool CheckUninstall() + { + if (CLI.IsCommandExist("Uninstall")) + { + try + { + IntegrationHelpers.Uninstall(); + } + catch + { + } + + return true; + } + + return false; + } } } \ No newline at end of file