public void AddSection(Section sec) { fileCache[sec.Name] = sec; }
private void GetNewSection(ref Section dicSection, string line) { int index = line.IndexOf(']'); if (index < 2) return; string sectionName = line.Substring(1, index - 1).Trim(); if (String.IsNullOrEmpty(sectionName)) return; if (fileCache.ContainsKey(sectionName)) { dicSection = fileCache[sectionName]; } else { dicSection = new Section(sectionName); fileCache.Add(sectionName, dicSection); } }
private void GetNewValue(Section dicSection, string line) { int index = line.IndexOf('='); if (index <= 0) return; string key = line.Substring(0, index).Trim(); if (String.IsNullOrEmpty(key)) return; string value = line.Substring(index + 1).Trim(); if (String.IsNullOrEmpty(value)) return; dicSection.Add(key, value); }
public void SetValue(String secName, String key, String val) { Section sec=this.GetSection(secName); if (sec==null) { sec = new Section(secName); this.fileCache.Add(secName,sec); } sec.SetValue(key, val); }