3 using System
.Collections
;
4 using System
.Collections
.Specialized
;
8 /// Well, it's not exactly UniConf, but...
12 = new Hashtable(10, new CaseInsensitiveHashCodeProvider(),
13 new CaseInsensitiveComparer());
15 public Ini(string filename
)
21 r
= File
.OpenText(filename
);
25 return; // I guess there's no file!
30 while ((s
= r
.ReadLine()) != null)
33 if (s
.Length
== 0) continue; // blank line
34 if (s
[0] == '#') continue; // comment
35 if (s
[0] == '[' && s
[s
.Length
-1]==']') // section
37 section
= s
.Substring(1, s
.Length
-2);
39 else if (s
.IndexOf('=') >= 0)
41 string[] a
= s
.Split(new char[] {'='}
, 2);
42 this[section
][a
[0].Trim()] = a
[1].Trim();
49 public StringDictionary
this[string sectname
]
53 if (!sections
.Contains(sectname
))
54 sections
.Add(sectname
, new StringDictionary());
55 return (StringDictionary
)sections
[sectname
];