コード例 #1
0
        public void ExecuteCommand(ExecuteMode mode, string name, string argString)
        {
            ArgList args = new ArgList();

            args.Parse(argString);

            ExecuteCommand(mode, name, args);
        }
コード例 #2
0
        public void Execute(string statement)
        {
            ArgList args = new ArgList();

            args.Parse(statement);

            if (args.Count == 0)
            {
                Engine.Log.WriteLine("warning/system", "Attempted to execute empty statement");

                return;
            }

            Arg arg = args.Next;

            // Resolve alias if registered.
            if (aliases.ContainsKey(arg))
            {
                arg = aliases[arg];
            }

            if (IsCommandRegistered(arg))
            {
                ExecuteCommand(ExecuteMode.Append, arg, args);
            }
            else if (IsCvarRegistered(arg))
            {
                if (args.Count == 0)
                {
                    // Print cvar value.
                    Engine.Log.WriteLine("info/system", "{0} = {1}", arg, GetCvarValue(arg));
                }
                else
                {
                    // Assign cvar value.
                    GetCvar(arg).Parse(args);
                }
            }
            else
            {
                Engine.Log.WriteLine("error/system", "Unknown command/cvar {0}", arg);
            }
        }