Пример #1
0
 public INIFile(string file) : base(file)
 {
     sections = new List <INISection>();
     using (StreamReader reader = File.OpenText(file))
     {
         string     line;
         INISection actsection = null;
         while ((line = reader.ReadLine()) != null)
         {
             if (line.Length == 0 || line[0] == ';')
             {
                 continue;
             }
             line = line.Trim(' ', '\t');
             if (line[0] == '[')
             {
                 actsection = new INISection(line.Substring(1, line.Length - 2));
                 sections.Add(actsection);
             }
             else
             {
                 string[] sep  = line.Split('=');
                 var      prop = new INIProperty(sep[0], sep[1], actsection);
                 if (actsection == null)
                 {
                     base.Add(prop);
                 }
                 else
                 {
                     actsection.Add(prop);
                 }
             }
         }
     }
 }
Пример #2
0
 public void Add(INIProperty item)
 {
     props.Add(item);
 }
Пример #3
0
 public bool Contains(INIProperty item)
 {
     return(props.Contains(item));
 }
Пример #4
0
 public bool Remove(INIProperty item)
 {
     return(props.Remove(item));
 }