|
|
@ -22,8 +22,8 @@ |
|
|
|
if (!HasAdministratorPrivileges()) |
|
|
|
if (!HasAdministratorPrivileges()) |
|
|
|
{ |
|
|
|
{ |
|
|
|
Console.Error.WriteLine("Access Denied."); |
|
|
|
Console.Error.WriteLine("Access Denied."); |
|
|
|
Console.Error.WriteLine("Administrator permissions are needed to use the selected options."); |
|
|
|
Console.Error.WriteLine("Administrator permissions are needed to use this tool."); |
|
|
|
Console.Error.WriteLine("Use an administrator command prompt to complete these tasks."); |
|
|
|
Console.Error.WriteLine("Run the command again from an administrator command prompt."); |
|
|
|
return 740; // ERROR_ELEVATION_REQUIRED |
|
|
|
return 740; // ERROR_ELEVATION_REQUIRED |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -50,13 +50,8 @@ |
|
|
|
|
|
|
|
|
|
|
|
private static void MainConsole(string[] args) |
|
|
|
private static void MainConsole(string[] args) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (args.Length != 1) |
|
|
|
var command = args.Length == 1 ? args[0] : string.Empty; |
|
|
|
{ |
|
|
|
|
|
|
|
ShowHelp(); |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var command = args[0]; |
|
|
|
|
|
|
|
if (command.Equals("install", StringComparison.OrdinalIgnoreCase)) { |
|
|
|
if (command.Equals("install", StringComparison.OrdinalIgnoreCase)) { |
|
|
|
DoInstall(); |
|
|
|
DoInstall(); |
|
|
|
} |
|
|
|
} |
|
|
@ -64,6 +59,10 @@ |
|
|
|
{ |
|
|
|
{ |
|
|
|
DoUninstall(); |
|
|
|
DoUninstall(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
else if (command.Equals("reinstall", StringComparison.OrdinalIgnoreCase)) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
DoReinstall(); |
|
|
|
|
|
|
|
} |
|
|
|
else if (command.Equals("startup", StringComparison.OrdinalIgnoreCase)) |
|
|
|
else if (command.Equals("startup", StringComparison.OrdinalIgnoreCase)) |
|
|
|
{ |
|
|
|
{ |
|
|
|
DoStartup(); |
|
|
|
DoStartup(); |
|
|
@ -72,6 +71,10 @@ |
|
|
|
{ |
|
|
|
{ |
|
|
|
DoShutdown(); |
|
|
|
DoShutdown(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
ShowHelp(); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private static void ShowHelp() |
|
|
|
private static void ShowHelp() |
|
|
@ -82,10 +85,12 @@ |
|
|
|
Console.WriteLine("\t\tInstalls service"); |
|
|
|
Console.WriteLine("\t\tInstalls service"); |
|
|
|
Console.WriteLine($"\t{exeName} uninstall"); |
|
|
|
Console.WriteLine($"\t{exeName} uninstall"); |
|
|
|
Console.WriteLine("\t\tUninstalls service"); |
|
|
|
Console.WriteLine("\t\tUninstalls service"); |
|
|
|
|
|
|
|
Console.WriteLine($"\t{exeName} reinstall"); |
|
|
|
|
|
|
|
Console.WriteLine("\t\tReinstalls service (might be useful for some upgrades)"); |
|
|
|
Console.WriteLine($"\t{exeName} startup"); |
|
|
|
Console.WriteLine($"\t{exeName} startup"); |
|
|
|
Console.WriteLine("\t\tPerforms startup sequence"); |
|
|
|
Console.WriteLine("\t\tPerforms startup sequence (development command, does not affect services)"); |
|
|
|
Console.WriteLine($"\t{exeName} shutdown"); |
|
|
|
Console.WriteLine($"\t{exeName} shutdown"); |
|
|
|
Console.WriteLine("\t\tPerforms shutdown sequence"); |
|
|
|
Console.WriteLine("\t\tPerforms shutdown sequence (development command, does not affect services)"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private static void DoInstall() |
|
|
|
private static void DoInstall() |
|
|
@ -93,21 +98,33 @@ |
|
|
|
Console.WriteLine("Setting registry values..."); |
|
|
|
Console.WriteLine("Setting registry values..."); |
|
|
|
|
|
|
|
|
|
|
|
Console.WriteLine("Installing service..."); |
|
|
|
Console.WriteLine("Installing service..."); |
|
|
|
ServiceHelpers.InstallService(nameof(RadeonResetBugFixService), typeof(RadeonResetBugFixService)); |
|
|
|
ServiceHelpers.InstallService(Constants.ServiceName, typeof(RadeonResetBugFixService)); |
|
|
|
|
|
|
|
Console.WriteLine("Starting service..."); |
|
|
|
|
|
|
|
ServiceHelpers.StartService(Constants.ServiceName); |
|
|
|
|
|
|
|
Console.WriteLine("Should restart service now; stopping service..."); |
|
|
|
|
|
|
|
ServiceHelpers.StopService(Constants.ServiceName); |
|
|
|
Console.WriteLine("Starting service..."); |
|
|
|
Console.WriteLine("Starting service..."); |
|
|
|
ServiceHelpers.StartService(nameof(RadeonResetBugFixService)); |
|
|
|
ServiceHelpers.StartService(Constants.ServiceName); |
|
|
|
Console.WriteLine("Started service"); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private static void DoUninstall() |
|
|
|
private static void DoUninstall() |
|
|
|
{ |
|
|
|
{ |
|
|
|
Console.WriteLine("Stopping service..."); |
|
|
|
Console.WriteLine("Stopping service..."); |
|
|
|
ServiceHelpers.StopService(nameof(RadeonResetBugFixService)); |
|
|
|
ServiceHelpers.StopService(Constants.ServiceName); |
|
|
|
Console.WriteLine("Uninstalling service..."); |
|
|
|
Console.WriteLine("Uninstalling service..."); |
|
|
|
ServiceHelpers.UninstallService(nameof(RadeonResetBugFixService), typeof(RadeonResetBugFixService)); |
|
|
|
ServiceHelpers.UninstallService(Constants.ServiceName, typeof(RadeonResetBugFixService)); |
|
|
|
Console.WriteLine("Uninstalled"); |
|
|
|
Console.WriteLine("Uninstalled"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private static void DoReinstall() |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
Console.WriteLine("Attempting to uninstall..."); |
|
|
|
|
|
|
|
DoUninstall(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Console.WriteLine("Attempting to install..."); |
|
|
|
|
|
|
|
DoInstall(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private static void DoStartup() |
|
|
|
private static void DoStartup() |
|
|
|
{ |
|
|
|
{ |
|
|
|
new MainHandler().HandleStartup("Program.DoStartup"); |
|
|
|
new MainHandler().HandleStartup("Program.DoStartup"); |
|
|
|