Esempio n. 1
0
        void OnValidate()
        {
            _Instance = this;

            if (PrevEnableConsole && !_EnableConsole)
            {
                OnConsoleDisabled();
            }
            else if (!PrevEnableConsole && _EnableConsole)
            {
                OnConsoleEnabled();
            }

            if (PrevNamingConvention != _DefaultNamingConvention)
            {
                CommandRegistry.Rebuild();
            }

            if (PrevFont != _ConsoleFont)
            {
                OnConsoleVisualsChanged();
            }

            PrevEnableConsole    = _EnableConsole;
            PrevNamingConvention = _DefaultNamingConvention;
            PrevFont             = _ConsoleFont;
        }
Esempio n. 2
0
        public static object ExecuteCommand(ref string commandStr)
        {
            string[] commandTerms = GetCommandTerms(commandStr);
            if (commandTerms.Length == 0)
            {
                throw(new CommandException("Empty Command passed '{0}'", commandStr));
            }

            CommandDef commandDef = CommandRegistry.GetCommand(commandTerms[0]);

            if (!commandDef.IsValid())
            {
                throw(new CommandException("Unrecognised Command '{0}'", commandTerms[0]));
            }

            commandStr = FixCommandFormat(commandTerms, commandDef);

            return(commandDef.Command.ExecuteCommand(commandTerms));
        }