/// <summary>
        /// Parses a single configuration line.
        /// </summary>
        /// <param name="lineIndex">The index of the line.</param>
        /// <param name="line">The contents of the line.</param>
        /// <param name="currentSectionName">The name of the current section.</param>
        private void Parse(int lineIndex, string line, ref string currentSectionName)
        {
            char c;
            var reader = new StringReader(line);
            reader.SkipWhitespace();

            // First character
            if (!reader.TryRead(out c))
                return;

            if (c == '[') {
                // Read section name
                var sectionNameBuilder = new StringBuilder();
                while (reader.TryRead(out c) && c != ']') {
                    sectionNameBuilder.Append(c);
                }
                if (c != ']')
                    throw new Exception("Invalid section name");

                // Set and add section
                currentSectionName = sectionNameBuilder.ToString().Trim();
                Section section;
                if (!_sections.TryGetValue(currentSectionName, out section))
                    _sections.Add(currentSectionName, section = new Section(currentSectionName));
                section.Lines.Add(lineIndex);
            } else if (c != ';' && c != '#') {
                // Read property name and value
                var propertyNameBuilder = new StringBuilder();
                propertyNameBuilder.Append(c);
                while (reader.TryRead(out c) && c != '=' && c != ':') {
                    propertyNameBuilder.Append(c);
                }
                if (c != '=' && c != ':')
                    throw new Exception("Expected = or : after property name");

                string propertyName = propertyNameBuilder.ToString().Trim();
                string value = ReadPropertyValue(reader);

                // Set or add property
                Property property = GetOrAddProperty(currentSectionName, propertyName);
                property.Value = value;
                property.Lines.Add(lineIndex);
            }
        }