//#define USE_TESTING_CODE // when defined, no actuall power command will be processed, it will just ouput a message to the console using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Reflection; namespace NexusPowerCommand { public class PowerCommands { public const string shutdown = "/shutdown"; public const string restart = "/restart"; public const string logoff = "/logoff"; public const string lockscreen = "/lock"; public const string sleep = "/sleep"; } class Program { static void Main(string[] args) { if (args.Length == 0 || args.Length > 1) { ShowUsage(); return; } switch (args[0].ToLower()) { case PowerCommands.shutdown: Shutdown(); return; case PowerCommands.restart: Restart(); return; case PowerCommands.logoff: Logoff(); return; case PowerCommands.lockscreen: Lock(); return; case PowerCommands.sleep: Sleep(); return; default: ShowUsage(); return; } } private static void ShowUsage() { Console.WriteLine(); Console.WriteLine(string.Format("USAGE: {0}.exe