예제 #1
0
        bool Execute(string filename)
        {
            IList <string> lines = ReusableLists.NextAutoRecycleList <string>();

            // cvars
            AddEntries(lines, ListCvars(), "cvars");

            // bindings
            AddEntries(lines, ListBindings(), "bindings");

            // aliases
            AddEntries(lines, ListAliases(), "aliases");

            try
            {
                ConfigHelper.WriteConfig(filename, lines);
                return(true);
            }
            catch (Exception e)
            {
                if (this.IsManualMode)
                {
                    PrintError("Can't write config: " + e.Message);
                }
            }

            return(false);
        }
        public static IList <string> Split(string str, int options = 0)
        {
            IList <string> list = ReusableLists.NextAutoRecycleList <string>();

            Split(str, list, options);
            return(list);
        }
예제 #3
0
        public static IList <string> ListVarNames(string prefix = null, CommandListOptions options = CommandListOptions.None)
        {
            IList <CVar> cvars = ListVars(ReusableLists.NextAutoRecycleList <CVar>(), prefix, options);

            string[] names = new string[cvars.Count];

            int index = 0;

            foreach (CVar cvar in cvars)
            {
                names[index++] = cvar.Name;
            }

            return(names);
        }
예제 #4
0
        public static IList <CBinding> List(CCommandBindingsFilter filter)
        {
            if (filter == null)
            {
                throw new NullReferenceException("Filter is null");
            }

            IList <CBinding> list = ReusableLists.NextAutoRecycleList <CBinding>();

            for (int i = 0; i < m_bindings.Count; ++i)
            {
                if (filter(m_bindings[i]))
                {
                    list.Add(m_bindings[i]);
                }
            }

            return(list);
        }
예제 #5
0
 internal static IList <CAliasCommand> ListAliases(string prefix = null, CommandListOptions options = CommandListOptions.None)
 {
     return(ListAliases(ReusableLists.NextAutoRecycleList <CAliasCommand>(), prefix, options));
 }
예제 #6
0
 internal static IList <CVar> ListVars(ListCommandsFilter <CVarCommand> filter)
 {
     return(ListVars(ReusableLists.NextAutoRecycleList <CVar>(), filter));
 }
예제 #7
0
 public static IList <CVar> ListVars(string prefix = null, CommandListOptions options = CommandListOptions.None)
 {
     return(ListVars(ReusableLists.NextAutoRecycleList <CVar>(), prefix, options));
 }