Beispiel #1
0
        internal virtual ICollection <string> GetNames(string section, string subsection)
        {
            IList <ConfigLine> s = Sorted();
            int idx = Find(s, section, subsection, string.Empty);

            if (idx < 0)
            {
                idx = -(idx + 1);
            }
            IDictionary <string, string> m = new LinkedHashMap <string, string>();

            while (idx < s.Count)
            {
                ConfigLine e = s[idx++];
                if (!e.Match(section, subsection))
                {
                    break;
                }
                if (e.name == null)
                {
                    continue;
                }
                string l = StringUtils.ToLowerCase(e.name);
                if (!m.ContainsKey(l))
                {
                    m.Put(l, e.name);
                }
            }
            return(new ConfigSnapshot.CaseFoldingSet(m));
        }
Beispiel #2
0
        private int Find(IList <ConfigLine> s, string s1, string s2, string name)
        {
            int low  = 0;
            int high = s.Count;

            while (low < high)
            {
                int        mid = (int)(((uint)(low + high)) >> 1);
                ConfigLine e   = s[mid];
                int        cmp = Compare2(s1, s2, name, e.section, e.subsection, e.name);
                if (cmp < 0)
                {
                    high = mid;
                }
                else
                {
                    if (cmp == 0)
                    {
                        return(First(s, mid, s1, s2, name));
                    }
                    else
                    {
                        low = mid + 1;
                    }
                }
            }
            return(-(low + 1));
        }
Beispiel #3
0
		internal virtual ConfigLine ForValue(string newValue)
		{
			ConfigLine e = new ConfigLine();
			e.prefix = prefix;
			e.section = section;
			e.subsection = subsection;
			e.name = name;
			e.value = newValue;
			e.suffix = suffix;
			return e;
		}
        internal virtual ConfigLine ForValue(string newValue)
        {
            ConfigLine e = new ConfigLine();

            e.prefix     = prefix;
            e.section    = section;
            e.subsection = subsection;
            e.name       = name;
            e.value      = newValue;
            e.suffix     = suffix;
            return(e);
        }