Esempio n. 1
0
        /**
         * @param clear
         */
        public static void AddEarlyCommands(bool clear)
        {
            for (var i = 0; i < Com.Argc(); i++)
            {
                var s = Com.Argv(i);

                if (!s.Equals("+set"))
                {
                    continue;
                }

                Cbuf.AddText("set " + Com.Argv(i + 1) + " " + Com.Argv(i + 2) + "\n");

                if (clear)
                {
                    Com.ClearArgv(i);
                    Com.ClearArgv(i + 1);
                    Com.ClearArgv(i + 2);
                }

                i += 2;
            }
        }
Esempio n. 2
0
        /**
         * @return
         */
        public static bool AddLateCommands()
        {
            int i;
            int j;
            var ret = false;

            // build the combined string to parse from
            var s    = 0;
            var argc = Com.Argc();

            for (i = 1; i < argc; i++)
            {
                s += Com.Argv(i).Length;
            }

            if (s == 0)
            {
                return(false);
            }

            var text = "";

            for (i = 1; i < argc; i++)
            {
                text += Com.Argv(i);

                if (i != argc - 1)
                {
                    text += " ";
                }
            }

            // pull out the commands
            var build = "";

            for (i = 0; i < text.Length; i++)
            {
                if (text[i] == '+')
                {
                    i++;

                    for (j = i; j < text.Length && text[j] != '+' && text[j] != '-'; j++)
                    {
                        ;
                    }

                    build += text.Substring(i, j - i);
                    build += "\n";

                    i = j - 1;
                }
            }

            ret = build.Length != 0;

            if (ret)
            {
                Cbuf.AddText(build);
            }

            text  = null;
            build = null;

            return(ret);
        }