Ejemplo n.º 1
0
        private DbfTable ParseTable(bool includeDisplacement)
        {
            var table      = new DbfTable();
            int numRecords = ByteHelper.GetInt(_data.GetBytes(DbfByteOffset.NumRecords));
            int rowLength  = ByteHelper.GetInt(_data.GetBytes(DbfByteOffset.LengthOfDataRecord));

            // Create headers
            int       headerIndex = 0;
            DbfHeader header      = null;
            int       dataPointer = DbfByteOffset.FieldSubrecords.Start;

            _columnOffset = 0;

            while (true)
            {
                byte[] row = _data.GetBytes(dataPointer, dataPointer + SubrecordLength, false);
                header = ParseHeader(row, headerIndex++, includeDisplacement);

                if (header == null)
                {
                    break;
                }
                table.AddHeader(header);
                dataPointer += SubrecordLength;
            }

            rowLength = table.GetRowLength();

            // Add subrecords (rows)
            for (int i = dataPointer + 2; i < _data.Length; i += rowLength)
            {
                byte[] row = _data.GetBytes(i, i + rowLength);
                table.AddRow(row);
            }

            return(table);
        }
Ejemplo n.º 2
0
 public DbfRow(byte[] data, DbfTable table)
 {
     _data  = data;
     _table = table;
 }