private void Open(string filePath)
{
conf = new StringDictionary();
if (filePath == null)
filePath = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), Filename);
try
{
// Read the file by line.
using (System.IO.StreamReader file = new System.IO.StreamReader(filePath))
{
int counter = 0;
string line;
while ((line = file.ReadLine()) != null)
{
// Strip comments
if (line.Contains('#'))
line = line.Substring(0, line.IndexOf('#'));
string[] kvParts = line.Split(new char[] { '=' }, 2);
if (kvParts.Length > 1)
{
string keyPart = kvParts[0].Trim();
string valuePart = kvParts[1].Trim();
conf.Add(keyPart.ToLower(), valuePart);
counter++;
}
}
}
}
catch (Exception)
{
}
}