public IEnumerator<object> ProcessInput(string text)
{
string[] words = text.Split(' ');
if (words.Length < 1)
return null;
string firstWord = words[0].ToLower();
_LastPrompt = false;
var cmdGenerator = _Commands.FindByKeyStart(firstWord);
KeyValueReference<string, CommandHandler> cmd;
try {
cmd = cmdGenerator.First();
}
catch (InvalidOperationException) {
SendMessage("Hmm... that doesn't make any sense. Do you need some <help>?");
SendPrompt();
return null;
}
// Populate the first word with the real name of the command.
words[0] = cmd.Key;
return cmd.Value.Execute(this, words);
}