-Uninstall argument for Steam

This commit is contained in:
Jaex 2015-09-12 02:05:31 +03:00
parent 355af54cb3
commit 4f5b65a9ee
2 changed files with 29 additions and 0 deletions

View file

@ -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_, MessageBox.Show(Resources.ApplicationSettingsForm_cbSteamShowInApp_CheckedChanged_For_settings_to_take_effect_ShareX_needs_to_be_reopened_from_Steam_,
"ShareX", MessageBoxButtons.OK, MessageBoxIcon.Information); "ShareX", MessageBoxButtons.OK, MessageBoxIcon.Information);
} }
public static void Uninstall()
{
CreateStartupShortcut(false);
CreateShellContextMenuButton(false);
CreateSendToMenuButton(false);
}
} }
} }

View file

@ -253,6 +253,10 @@ private static void Main(string[] args)
CLI = new CLIManager(args); CLI = new CLIManager(args);
CLI.ParseCommands(); 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 if (CheckAdminTasks()) return; // If ShareX opened just for be able to execute task as Admin
IsMultiInstance = CLI.IsCommandExist("multi", "m"); IsMultiInstance = CLI.IsCommandExist("multi", "m");
@ -571,5 +575,23 @@ private static bool CheckAdminTasks()
return false; return false;
} }
private static bool CheckUninstall()
{
if (CLI.IsCommandExist("Uninstall"))
{
try
{
IntegrationHelpers.Uninstall();
}
catch
{
}
return true;
}
return false;
}
} }
} }