/// <summary> /// Opens the ini file. /// </summary> public void Open() { var lines = File.ReadAllLines(FileName); GlobalSection = new IniFile.IniFileSection(string.Empty); IniFileSection CurrentSection = GlobalSection; foreach (var line in lines) { if (!string.IsNullOrWhiteSpace(line)) { if (line.Contains("=")) { var split = line.IndexOf('='); var key = line.Substring(0, split); var value = line.Substring(split + 1); CurrentSection.SetValue <string>(key, value); } else if (line.StartsWith("[") && line.EndsWith("]")) { var name = line.Substring(1, line.Length - 2); if (string.IsNullOrWhiteSpace(name)) { continue; } CurrentSection = new IniFile.IniFileSection(name); sections.Add(CurrentSection.Name, CurrentSection); } } } foreach (var section in Sections) { section.UpdateFormats(GlobalSection); } GlobalSection.UpdateFormats(null); }