Esempio n. 1
0
 public void AddSection(Section sec)
 {
     fileCache[sec.Name] = sec;
 }
Esempio n. 2
0
        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);
            }
        }
Esempio n. 3
0
        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);
        }
Esempio n. 4
0
        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);
        }