Exemplo n.º 1
0
 public void AddCommand(ConsoleCommand command)
 {
     if (commands.ContainsKey(command.Name))
     {
         throw new InvalidOperationException("Attempt to add existent command");
     }
     commands.Add(command.Name, command);
     InternalAddCommand(commandTrie, command.Name, command.Name.Length, 0);
 }
Exemplo n.º 2
0
 internal void PrintInvalidSyntax(ConsoleCommand cmd)
 {
     Msg("{0}Invalid syntax in call to '{1}'", logPrefixProvider.InvalidSyntax, cmd.Name);
     Msg("{0}Valid arguments: {1}", logPrefixProvider.InvalidSyntax, cmd.Args);
 }
Exemplo n.º 3
0
 private void PrintCommandInfo(ConsoleCommand cmd)
 {
     Msg("{0}  {1}<{2}> {3}",
         cmd.Name,
         (cmd.Status != null) ? String.Format("( {0} )  ", cmd.Status) : String.Empty,
         cmd.Args,
         cmd.Info);
 }
Exemplo n.º 4
0
 public void RemoveCommand(ConsoleCommand command)
 {
     if (!commands.ContainsKey(command.Name))
     {
         throw new InvalidOperationException("Attempt to remove nonexistent command");
     }
     RemoveCommand(command.Name);
 }