public void Write(StreamWriter sw) { sw.WriteLine(IniSec.makeSec(SecName)); for (int i = 0; i < n; i++) { sw.WriteLine(LHS[i] + "=" + RHS[i]); } }
public string get(string sec, string key, out bool success) { success = false; for (int i = 0; i < sections.Count; i++) { if (IniSec.makeSec(sections[i].SecName) == IniSec.makeSec(sec)) { return(sections[i].get(key, out success)); } } return("");//else it didn't find it }
public void SetKey(string mainsec, string curremotepre, string v) { int index = 0; for (int i = 0; i < sections.Count; i++) { if (IniSec.makeSec(sections[i].SecName) == IniSec.makeSec(mainsec)) { index = i; } } sections[index].Setkey(curremotepre, v); }
public IniSec getSec(string sec) { for (int i = 0; i < sections.Count; i++) { if (IniSec.makeSec(sections[i].SecName) == IniSec.makeSec(sec)) { return(sections[i]); } } return(new IniSec("no sec", new string[1] { "nadah" })); }
public bool Read() { bool worked = File.Exists(Filename); LoadAllLines(); string curSec = ""; List <string> SecLines = new List <string>(); for (int i = 0; i < Lines.Length; i++) { if (!IniSec.IsBlankLine(Lines[i])) { if (IniSec.IsSec(Lines[i]) & Lines[i] != curSec) { curSec = Lines[i]; if (SecLines.Count > 0) { //new section so append the last bits IniSec sec = new IniSec(curSec, SecLines.ToArray()); theDat.addSec(sec); } SecLines.Clear(); } else { SecLines.Add(Lines[i]); } } } if (SecLines.Count > 0) { //new section so append the last bits IniSec sec = new IniSec(curSec, SecLines.ToArray()); theDat.addSec(sec); } return(worked); }
public void addSec(IniSec toAdd) { sections.Add(toAdd); }