Пример #1
0
        public void Execute(string[] args)
        {
            //pop off the first arg
            string command_name = args[0];

            //search for command with matching name in the list of commands
            ModCommand found_command = null;

            foreach (ModCommand command in m_Commands)
            {
                if (command_name == command.Name)
                {
                    found_command = command;
                    break;
                }
            }

            //assuming we found a matching command
            if (found_command != null)
            {
                //assemble remaining commands into a new list
                List <string> commands = new List <string>();
                for (int i = 1; i < args.Length; ++i)
                {
                    commands.Add(args[i]);
                }

                //pass them to the command via execution
                found_command.Execute(commands);
            }
            else
            {
                //no command was found, notify the user
                Helpers.Result("Unknown Command: " + command_name);
            }
        }
Пример #2
0
 public void Add(ModCommand cmd)
 {
     m_Commands.Add(cmd);
 }
Пример #3
0
 public void Add(ModCommand cmd)
 {
     m_Commands.Add(cmd);
 }