Exemple #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);
        }
Exemple #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);
        }
Exemple #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);
        }
Exemple #5
0
 internal static IList <CAliasCommand> ListAliases(string prefix = null, CommandListOptions options = CommandListOptions.None)
 {
     return(ListAliases(ReusableLists.NextAutoRecycleList <CAliasCommand>(), prefix, options));
 }
Exemple #6
0
 internal static IList <CVar> ListVars(ListCommandsFilter <CVarCommand> filter)
 {
     return(ListVars(ReusableLists.NextAutoRecycleList <CVar>(), filter));
 }
Exemple #7
0
 public static IList <CVar> ListVars(string prefix = null, CommandListOptions options = CommandListOptions.None)
 {
     return(ListVars(ReusableLists.NextAutoRecycleList <CVar>(), prefix, options));
 }