public static bool TryGetCommand(string command, out ConsoleCommand result)
 {
     try
     {
         result = GetCommand(command);
         return(true);
     }
     catch (NoSuchCommandException)
     {
         result = default(ConsoleCommand);
         return(false);
     }
 }
 public static ConsoleCommandResult ExecuteCommand(string command, params string[] args)
 {
     try
     {
         ConsoleCommand retrievedCommand = GetCommand(command);
         return(retrievedCommand.Callback(args));
     }
     catch (NoSuchCommandException e)
     {
         return(new ConsoleCommandResult {
             succeeded = false, Output = e.Message
         });
     }
     catch (Exception e)
     {
         return(new ConsoleCommandResult {
             succeeded = false, Output = e.Message
         });
     }
 }
 public static void RegisterCommand(string command, string description, string usage, ConsoleCommandCallback callback)
 {
     Database[command] = new ConsoleCommand(command, description, usage, callback);
 }