Ejemplo n.º 1
0
        private void RunCommand(string command, string[] args)
        {
            CommandRegistration reg = null;

            if (!commands.TryGetValue(command, out reg))
            {
                AppendLogLine(string.Format("{0}Unknown command '{1}', type 'help' for list.{2}", ColorBad, command, EndFormatColorBold));
            }
            else
            {
                if (reg.handler == null)
                {
                    AppendLogLine(string.Format("{0}Unable to process command '{1}', handler was null.{2}", ColorBad, command, EndFormatColorBold));
                }
                else
                {
                    reg.handler(args);
                }
            }
        }
Ejemplo n.º 2
0
 private void RegisterCommand(CommandRegistration commandRegistration)
 {
     commands.Add(commandRegistration.command, commandRegistration);
 }