示例#1
0
        /*
         * ============
         * Cmd_ExecuteString
         *
         * A complete command line has been parsed, so try to execute it
         * FIXME: lookupnoadd the token to speed search?
         * ============
         */
        public static void      Cmd_ExecuteString(char[] text, cmd_source_t src)
        {
            cmd_function_t cmd;
            cmdalias_t     a;

            cmd_source = src;
            Cmd_TokenizeString(text);

            // execute the command line
            if (Cmd_Argc() == 0)
            {
                return;         // no tokens
            }
            // check functions
            for (cmd = cmd_functions; cmd != null; cmd = cmd.next)
            {
                if (cmd_argv[0].CompareTo(cmd.name) == 0)
                {
                    cmd.function();
                    return;
                }
            }

            // check alias
            for (a = cmd_alias; a != null; a = a.next)
            {
                if (cmd_argv[0].CompareTo(a.name) == 0)
                {
                    Cbuf_InsertText(a.value);
                    return;
                }
            }

            // check cvars
            if (!cvar_t.Cvar_Command())
            {
                console.Con_Printf("Unknown command \"" + Cmd_Argv(0) + "\"\n");
            }
        }
示例#2
0
        // void	Cmd_ExecuteString (char *text, cmd_source_t src);
        // Parses a single line of text into arguments and tries to execute it.
        // The text can come from the command buffer, a remote client, or stdin.
        //
        // A complete command line has been parsed, so try to execute it
        // FIXME: lookupnoadd the token to speed search?
        public static void ExecuteString(string text, cmd_source_t src)
        {
            _Source = src;

            TokenizeString(text);

            // execute the command line
            if (_Argc <= 0)
            {
                return;     // no tokens
            }

            // check functions
            xcommand_t handler = Find(_Argv[0]); // must search with comparison like Q_strcasecmp()

            if (handler != null)
            {
                handler();
            }
            else
            {
                // check alias
                string alias = FindAlias(_Argv[0]); // must search with compare func like Q_strcasecmp
                if (!String.IsNullOrEmpty(alias))
                {
                    Cbuf.InsertText(alias);
                }
                else
                {
                    // check cvars
                    if (!Cvar.Command())
                    {
                        Con.Print("Unknown command \"{0}\"\n", _Argv[0]);
                    }
                }
            }
        }
示例#3
0
        // void	Cmd_ExecuteString (char *text, cmd_source_t src);
        // Parses a single line of text into arguments and tries to execute it.
        // The text can come from the command buffer, a remote client, or stdin.
        //
        // A complete command line has been parsed, so try to execute it
        // FIXME: lookupnoadd the token to speed search?
        public static void ExecuteString(string text, cmd_source_t src)
        {
            _Source = src;

            TokenizeString(text);

            // execute the command line
            if (_Argc <= 0)
                return;		// no tokens

            // check functions
            xcommand_t handler = Find(_Argv[0]); // must search with comparison like Q_strcasecmp()
            if (handler != null)
            {
                handler();
            }
            else
            {
                // check alias
                string alias = FindAlias(_Argv[0]); // must search with compare func like Q_strcasecmp
                if (!String.IsNullOrEmpty(alias))
                {
                    Cbuf.InsertText(alias);
                }
                else
                {
                    // check cvars
                    if (!Cvar.Command())
                        Con.Print("Unknown command \"{0}\"\n", _Argv[0]);
                }
            }
        }
示例#4
0
        /*
        ============
        Cmd_ExecuteString

        A complete command line has been parsed, so try to execute it
        FIXME: lookupnoadd the token to speed search?
        ============
        */
        public static void Cmd_ExecuteString(char[] text, cmd_source_t src)
        {
            cmd_function_t  cmd;
            cmdalias_t      a;

            cmd_source = src;
            Cmd_TokenizeString(text);

            // execute the command line
            if (Cmd_Argc() == 0)
                return;		// no tokens

            // check functions
            for (cmd = cmd_functions; cmd != null; cmd = cmd.next)
            {
                if (cmd_argv[0].CompareTo(cmd.name) == 0)
                {
                    cmd.function();
                    return;
                }
            }

            // check alias
            for (a = cmd_alias; a != null; a = a.next)
            {
                if (cmd_argv[0].CompareTo(a.name) == 0)
                {
                    Cbuf_InsertText(a.value);
                    return;
                }
            }

            // check cvars
            if (!cvar_t.Cvar_Command())
                console.Con_Printf("Unknown command \"" + Cmd_Argv(0) + "\"\n");
        }