コード例 #1
0
        public void RemoveServer(string protocol, string servername)
        {
            Trace.Call(protocol, servername);

            if (protocol == null)
            {
                throw new ArgumentNullException("protocol");
            }
            if (servername == null)
            {
                throw new ArgumentNullException("servername");
            }

            string server = "Servers/" + protocol + "/" + servername + "/";

            _UserConfig.Remove(server);

            string[] servers = (string[])_UserConfig["Servers/Servers"];
            if (servers == null)
            {
                servers = new string[] {};
            }
            List <string> serverList = new List <string>(servers);
            int           idx        = serverList.IndexOf(protocol + "/" + servername);

            serverList.RemoveAt(idx);
            _UserConfig["Servers/Servers"] = serverList.ToArray();
        }
コード例 #2
0
ファイル: FilterListController.cs プロジェクト: shubhtr/smuxi
        public void RemoveFilter(int key)
        {
            Trace.Call(key);

            string filterSection = "Filters/" + key + "/";

            string[] filterKeys = (string[])f_UserConfig["Filters/Filters"];
            if (filterKeys == null)
            {
                filterKeys = new string[] {};
            }
            List <string> filterKeyList = new List <string>(filterKeys);
            int           idx           = filterKeyList.IndexOf(key.ToString());

            if (idx == -1)
            {
                // key not found
                return;
            }
            filterKeyList.RemoveAt(idx);
            f_UserConfig.Remove(filterSection);
            f_UserConfig["Filters/Filters"] = filterKeyList.ToArray();
        }
コード例 #3
0
        public void Remove(int key)
        {
            Trace.Call(key);

            string section = "MessagePatterns/" + key + "/";

            string[] keys = PatternIDs;
            if (keys == null)
            {
                keys = new string[] {};
            }
            var keyList = new List <string>(keys);
            int idx     = keyList.IndexOf(key.ToString());

            if (idx == -1)
            {
                // key not found
                return;
            }
            keyList.RemoveAt(idx);
            UserConfig.Remove(section);
            PatternIDs = keyList.ToArray();
        }