Пример #1
0
        public int addHost(singleSyslogHost sm)
        {
            Trace.WriteLine("begin add");
            int i = 0;

            // find the next key
            Trace.WriteLine("find key");
            while (hosts.ContainsKey(i))
            {
                i++;
            }

            Trace.WriteLine("add host");
            hosts.Add(i, sm);

            return(i);
        }
Пример #2
0
        public bool removeHost(int map)
        {
            if (!hosts.ContainsKey(map))
            {
                return(false);
            }

            hosts.Remove(map);

            int sval = map + 1;

            while (hosts.ContainsKey(sval))
            {
                singleSyslogHost sm = hosts[sval];
                hosts.Remove(sval);
                hosts[sval - 1] = sm;
                sval++;
            }
            return(true);
        }
Пример #3
0
        public bool fromString(String load)
        {
            String[] sep = { "\r" };
            String[] av  = load.Split(sep, StringSplitOptions.None);

            for (int i = 0; i < av.Length; i++)
            {
                singleSyslogHost ism = new singleSyslogHost();
                Trace.WriteLine("line is " + av[i]);
                if (ism.fromString(av[i]))
                {
                    Trace.WriteLine("added");
                    addHost(ism);
                }
                else
                {
                    Trace.WriteLine("not added");
                }
            }

            return(true);
        }