public TalkyCommand Get(string command) { lock (_lock) { TalkyCommand theCommand = null; _commands.TryGetValue(command.ToLower(), out theCommand); return(theCommand); } }
public void RegisterCommand(TalkyCommand command) { lock (_lock) { if (_commands.ContainsValue(command) || _commands.ContainsKey(command.CommandName.ToLower())) { throw new CommandExistsException("That command exists, you nutter!", command); } _commands.Add(command.CommandName.ToLower(), command); } }
public CommandExistsException(string message, TalkyCommand command) : base(message) { Command = command; }
public void UnregisterCommand(TalkyCommand command) { UnregisterCommand(command.CommandName); }