public SaveReaderTextFile(StreamReader reader) { var file = new ConfigFile(); file.Read(reader); var sections = file.GetSections(); foreach (string name in sections) { var section = new SaveReaderTextSection(file, name); this.sections.Add(section); } var values = file.GetValues("main"); foreach (string vname in values) { if (!this.values.ContainsKey(vname)) { this.values.Add(vname, new SaveReaderTextValue(file.Value("main", vname, ""))); } } }
public SaveReaderTextSection(ConfigFile file, string name) { this.name = name; number = 0; var spacePosition = name.IndexOf(' '); if (spacePosition != -1) { string value = name.Substring(spacePosition + 1, name.Length - spacePosition - 1); this.name = this.name.Substring(0, spacePosition); number = int.Parse(value); } var vals = file.GetValues(name); foreach (string vname in vals) { if (!values.ContainsKey(vname)) { values.Add(vname, new SaveReaderTextValue(file.Value(name, vname, ""))); } } }