예제 #1
0
        private void Process()
        {
            // Move to first char.
            _reader.ReadChar();

            // Consume End Of Line.
            _reader.ConsumeNewLines();
            bool readNextChar = true;

            // While not end of content.
            while (!_reader.IsEnd())
            {
                // Get the current char.
                string currentChar = _reader.CurrentChar;

                if (currentChar == "[")
                {
                    StoreGroup();
                    readNextChar = false;
                }
                else if (currentChar == ";")
                {
                    string comment = _reader.ReadToEol();
                }
                else if (_reader.IsEol())
                {
                    _reader.ConsumeNewLines();
                    readNextChar = false;
                }
                else
                {
                    StoreKeyValue();
                    _reader.ConsumeNewLines();
                    readNextChar = false;
                }

                // Read the next char.
                if (readNextChar)
                {
                    _reader.ReadChar();
                }
            }

            // Add the last section.
            // Handle null/emtpy sections.
            if (_currentSection.Count > 0 && !string.IsNullOrEmpty(_currentSection.Name))
            {
                _sections.Add(_currentSection);
            }
        }