Ejemplo n.º 1
0
        public IEnumerable <T> Values()
        {
            using (var file = new StreamReader(_path))
            {
                string line;
                while ((line = file.ReadLine()) != null)
                {
                    var value = _rowParser.Parse(line);
                    if (value == null)
                    {
                        continue;
                    }

                    yield return(value);
                }
            }
        }
Ejemplo n.º 2
0
        public IEnumerable <Row> GetNewLines()
        {
            var previousReadBytes = _bytes;
            var ret = new List <Row>();

            using (var x = new FileStream(_filename, FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
            {
                x.Seek(previousReadBytes, SeekOrigin.Begin);

                using (var y = new StreamReader(x))
                {
                    while (!y.EndOfStream)
                    {
                        var row = _rowParser.Parse(y.ReadLine());
                        row.RowNumber = ++_rowNum;
                        ret.Add(row);
                    }

                    _bytes = x.Length;
                }
            }

            return(ret);
        }
Ejemplo n.º 3
0
        public string[] ReadNextRow(StreamReader reader)
        {
            string line = reader.ReadLine();

            return(rowParser.Parse(line));
        }