Exemple #1
0
        private bool TryExecuteSingleCommand(string commandLine, bool manualMode = false)
        {
            IList <string> tokensList = CommandTokenizer.Tokenize(commandLine);

            if (tokensList.Count > 0)
            {
                string commandName = tokensList[0];

                CCommand command = CRegistery.FindCommand(commandName);
                if (command != null)
                {
                    command.Delegate      = m_delegate;
                    command.IsManualMode  = manualMode;
                    command.CommandString = commandLine;
                    bool succeed = command.ExecuteTokens(tokensList, commandLine);
                    command.Clear();

                    return(succeed);
                }

                if (manualMode)
                {
                    m_delegate.LogTerminal(StringUtils.C(commandName + ": command not found", ColorCode.ErrorUnknownCommand));
                }
            }

            return(false);
        }