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)); }
public ElementReader(TextReader reader, string firstLine, ElementReader parentReader = null) { Reader = reader; FirstLine = firstLine; ParentReader = parentReader; }
public ElementReader(TextReader reader, ElementReader parentReader = null) : this(reader, null, parentReader) { }