Beispiel #1
0
 public void Write(StreamWriter sw)
 {
     sw.WriteLine(IniSec.makeSec(SecName));
     for (int i = 0; i < n; i++)
     {
         sw.WriteLine(LHS[i] + "=" + RHS[i]);
     }
 }
Beispiel #2
0
 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
 }
Beispiel #3
0
        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);
        }
Beispiel #4
0
 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"
     }));
 }
Beispiel #5
0
        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);
        }
Beispiel #6
0
 public void addSec(IniSec toAdd)
 {
     sections.Add(toAdd);
 }