Exemple #1
0
        public ElementBase[] Read()
        {
            var lineCount     = -1;
            var childElements = new List <ElementBase>();
            var buffer        = new StringBuilder();

            string line;

            do
            {
                lineCount++;
                if (lineCount == 0 && !String.IsNullOrEmpty(FirstLine))
                {
                    line = FirstLine;
                }
                else
                {
                    line = Reader.ReadLine();
                }

                line = line.TrimStart();
                if (IsStartOfNewElement(line))
                {
                    var childReader = new ElementReader(Reader, line, this);
                    childElements.AddRange(childReader.Read());
                }
                else
                {
                    buffer.AppendLine(line);
                }
            } while (!IsEndOfElement(line));
        }
Exemple #2
0
 public ElementReader(TextReader reader, string firstLine, ElementReader parentReader = null)
 {
     Reader       = reader;
     FirstLine    = firstLine;
     ParentReader = parentReader;
 }
Exemple #3
0
 public ElementReader(TextReader reader, ElementReader parentReader = null)
     : this(reader, null, parentReader)
 {
 }