private static DBFHeader ReadDBFHeader(BinaryReader br)
 {
     // Read in header one item at a time
     DBFHeader header = new DBFHeader();
     header.version = br.ReadByte();
     header.updateYear = br.ReadByte();
     header.updateMonth = br.ReadByte();
     header.updateDay = br.ReadByte();
     header.numRecords = br.ReadInt32();
     header.headerLen = br.ReadInt16();
     header.recordLen = br.ReadInt16();
     header.reserved1 = br.ReadInt16();
     header.incompleteTrans = br.ReadByte();
     header.encryptionFlag = br.ReadByte();
     header.reserved2 = br.ReadInt32();
     header.reserved3 = br.ReadInt64();
     header.MDX = br.ReadByte();
     header.language = br.ReadByte();
     header.reserved4 = br.ReadInt16();
     return header;
 }
        private static DataTable FillColumnsInDataTable(DataTable dt, BinaryReader br, DBFHeader header, ArrayList fields)
        {
            // Read in the first row of records, we need this to help determine column types below
            (br.BaseStream).Seek(header.headerLen + 1, SeekOrigin.Begin);

               // Create the columns in our new DataTable
            DataColumn col = null;

            dt.Columns.Add(new DataColumn("DELETED_FLAG", typeof(bool)));

            foreach (FieldDescriptor field in fields)
            {
                byte[] numberByteArray = br.ReadBytes(field.fieldLen);
                switch (field.fieldType)
                {
                    case dBaseType.N:
                        if (dBaseConverter.N_IsDecimal(numberByteArray))
                        {
                            col = new DataColumn(field.fieldName, typeof(decimal));
                        }
                        else
                        {
                            col = new DataColumn(field.fieldName, typeof(int));
                        }
                        break;
                    case dBaseType.C:
                        col = new DataColumn(field.fieldName, typeof(string));
                        break;
                    case dBaseType.T:
                        col = new DataColumn(field.fieldName, typeof(DateTime));
                        break;
                    case dBaseType.D:
                        col = new DataColumn(field.fieldName, typeof(DateTime));
                        break;
                    case dBaseType.L:
                        col = new DataColumn(field.fieldName, typeof(bool));
                        break;
                    case dBaseType.F:
                        col = new DataColumn(field.fieldName, typeof(Double));
                        break;
                    case dBaseType.M:
                        //Field Type Memo...
                        col = new DataColumn(field.fieldName, typeof(byte[]));
                        break;
                }
                if (col != null) dt.Columns.Add(col);
            }
            return dt;
        }