public void ReadReportHeader(IRowReportHeaderParser reportHeaderParser)
 {
     while (recordReader.ReadNextHeader(reportHeaderParser))
     {
         ;
     }
 }
Example #2
0
        public bool ReadNextHeader(IRowReportHeaderParser parser)
        {
            if (!reader.MoveNext())
            {
                return(false);
            }

            string[] fields = this.reader.Current;
            fields = fields.Select(s => s.Trim()).Where(s => s.Length > 0).ToArray();
            long validValueCount = fields.Length;

            if (!this.ValidateHeader(fields))
            {
                return(this.ReadNextHeader(parser));
            }


            if (validValueCount == 0)
            {
                return(false);
            }

            bool header = parser.ParseHeader(fields);

            if (validValueCount > 1)
            {
                if (header)
                {
                    this.columnMapping = this.GenerateColumnMapping(fields);
                    this.Peek();
                }
                else
                {
                    // when ExcludeColumnHeader is set, this line is a record indeed
                    this.nextRecord = new RowReportRecord(new RowValues(fields, this.columnMapping));
                }

                return(false);
            }

            return(true);
        }