static public IniCollection StaticLoad(string file) { var Dic = new IniCollection(); if (!File.Exists(file)) { return(null); } var data = File.ReadAllLines(file, Text.Encoding.UTF8); string k1 = "", k2 = ""; foreach (var line in data) { int i = -1; var start = line.Trim(' '); if (string.IsNullOrEmpty(start)) { continue; } if (start[0] == ';') { continue; } if (start[0] == '#') { continue; } if (start[0] == '[') { k1 = start.Trim('[', ']'); if (!Dic.ContainsKey(k1)) { Dic.InitializeGroups(k1); } continue; } else if ((i = start.IndexOf('=')) >= 0) { k2 = start.Substring(0, i); i++; var v = start.Substring(i, start.Length - i); Dic[k1].Add(k2.Trim(), v.Trim()); } } data = null; return(Dic); }
public IniCollection(IniCollection collection) : base(collection) { }