Exemplo n.º 1
0
        private string ReadNextLine(bool isContinued = false)
        {
            string lineText;

            if (!_reader.EndOfStream)
            {
                if ((!isContinued) && (StoreLineOffSets) && (!_lineOffSets.Contains(_totalLength)))
                {
                    _lineOffSets.Add(_totalLength);
                }

                if (StartAtOffSet > 0)
                {
                    _reader.DiscardBufferedData();
                    _reader.BaseStream.Seek(StartAtOffSet, SeekOrigin.Begin);
                    StartAtOffSet = -1;
                }

                if (CommentLineStartsWith.Trim().Length > 0)
                {
                    lineText = _reader.ReadLine();
                    while (lineText != null && lineText.Trim().StartsWith(CommentLineStartsWith))
                    {
                        _totalLength += lineText.Length + Environment.NewLine.Length;
                        _comments.Add(lineText);
                        lineText = _reader.ReadLine();
                    }
                }
                else
                {
                    lineText = _reader.ReadLine();
                }

                if (lineText != null)
                {
                    _totalLength += lineText.Length + Environment.NewLine.Length;
                }
            }
            else
            {
                return(null);
            }

            return(lineText);
        }
Exemplo n.º 2
0
        private string ReadNextLine(bool IsContinued = false)
        {
            string _LineText = string.Empty;

            if (!_Reader.EndOfStream)
            {
                if ((!IsContinued) && (StoreLineOffSets) && (!_LineOffSets.Contains(_TotalLength)))
                {
                    _LineOffSets.Add(_TotalLength);
                }

                if (StartAtOffSet > 0)
                {
                    _Reader.DiscardBufferedData();
                    _Reader.BaseStream.Seek(StartAtOffSet, SeekOrigin.Begin);
                    StartAtOffSet = -1;
                }

                if (CommentLineStartsWith.Trim().Length > 0)
                {
                    _LineText = _Reader.ReadLine();
                    while (_LineText != null && _LineText.Trim().StartsWith(CommentLineStartsWith))
                    {
                        _TotalLength += _LineText.Length + Environment.NewLine.Length;
                        _Comments.Add(_LineText);
                        _LineText = _Reader.ReadLine();
                    }
                }
                else
                {
                    _LineText = _Reader.ReadLine();
                }

                if (_LineText != null)
                {
                    _TotalLength += _LineText.Length + Environment.NewLine.Length;
                }
            }
            else
            {
                return(null);
            }
            return(_LineText);
        }