Example #1
0
        private CsvTable InternalParse(byte[] data, bool normalizeHeaderNames, string delimeter)
        {
            _delimeter = delimeter;
            _table     = new CsvTable();
            _reader    = new StreamReader(new MemoryStream(data));
            string[] row = null;

            ReadHeaders(normalizeHeaderNames);

            for (; ;)
            {
                row = GetLineValues();

                if (row == null)
                {
                    break;
                }

                _table.AddRow(row);
            }

            return(_table);
        }
Example #2
0
        private CsvTable InternalParse(StreamReader stream)
        {
            _table  = new CsvTable();
            _reader = stream;
            List <string> unAlteredRows = new List <string>();

            if (!_options.SkipHeader)
            {
                ReadHeaders(_reader.ReadLine());
            }

            while (!_reader.EndOfStream)
            {
                unAlteredRows.Add(_reader.ReadLine());
            }

            Parallel.ForEach(unAlteredRows, t =>
            {
                _table.AddRow(GetLineValues(t));
            });

            return(_table);
        }