Example #1
0
        public InputCommand AppendArguments(string[] arguments)
        {
            var ic = new InputCommand();

            ic.Arguments = Arguments.Concat(arguments).ToArray();
            ic.Target    = Target;
            return(ic);
        }
Example #2
0
 public void ProcessCommand(InputCommand cmd)
 {
     if (Commands.ContainsKey(cmd.Target))
     {
         var cc = Commands[cmd.Target];
         if (cc.Progress == CommandProgressType.Spinner)
         {
             Write(" " + cc.ProgressMessage);
             StartSpinner();
         }
         Commands[cmd.Target].Action.Invoke(this, cc, cmd.Arguments);
         if (cc.Progress == CommandProgressType.Spinner)
         {
             StopSpinner("Done!");
         }
     }
     else
     {
         Write(" Error", ConsoleColor.Red);
         Write(": Unknown command \"");
         Write(cmd.Target, ConsoleColor.Yellow);
         Write("\".\n");
     }
 }