コード例 #1
0
 /// <summary>
 /// Adds a new entry to a specified section.
 /// </summary>
 /// <param name="section"></param>
 /// <param name="entryName"></param>
 /// <param name="entryValue"></param>
 /// <param name="type"></param>
 public void AddEntry(string section, string entryName, string entryValue, INIType type)
 {
     if (ContainsEntry(section, entryName) == false)
     {
         _sections[section].AddEntry(new Entry(entryName, entryValue, type));
     }
 }
コード例 #2
0
        public Entry(string label, string value, INIType type)
        {
            string newLabel = label;

            if (type == INIType.WHITESPACE)
            {
                newLabel = label + _whitespaceCount.ToString();
                _whitespaceCount++;
            }
            else if (type == INIType.COMMENT)
            {
                newLabel = label + _commentCount.ToString();
                _commentCount++;
            }

            Label = newLabel;
            Value = value;
            Type  = type;
        }
コード例 #3
0
ファイル: INIReader.cs プロジェクト: Hooch0/INIParser
        private Entry ReadEntry(Stream stream, string line)
        {
            if (string.IsNullOrWhiteSpace(line))
            {
                //Whitespace entry
                return(new Entry("", "", INIType.WHITESPACE));
            }

            if (line.Length > 0 && line[0] == ';')
            {
                //Comment entry
                return(new Entry("", line, INIType.COMMENT));
            }
            //Value entry
            string  label = line.Substring(0, line.IndexOf('='));
            string  value = value = line.Substring(line.IndexOf('=') + 1);;
            INIType type  = INIType.VALUE;


            return(new Entry(label, value, type));
        }