Exemple #1
0
 // in the below, 'string' is changed to 'CommandWords' as needed
 static void Main(string[] args)
 {
     while (true)
     {
         string       s = GetInputFromConsole();
         CommandWords w = ExtractCommandFromString(s);
         ActionCommand(w);
     }
 }
Exemple #2
0
 public bool ShouldExecute(string commandText) => _isEnabled && CommandWords.Any(x => x.EqualsIns(commandText));
Exemple #3
0
 private static void ActionCommand(CommandWords w) => commands[w]();
Exemple #4
0
 public Parser(CommandWords newCommands)
 {
     commands = newCommands;
 }
 public HelpCommand(CommandWords commands) : base()
 {
     words     = commands;
     this.name = "help";
 }