public void Read() { // Open stream for reading. using (FileStream stream = File.Open(_path, FileMode.Open, FileAccess.Read)) using (BinaryReader reader = new BinaryReader(stream)) { ReadHeader(reader); Memo = ReadMemo(); ReadFields(reader); // After reading the Fields, we move the read pointer to the beginning // of the Records, as indicated by the "HeaderLength" value in the header. stream.Seek(Header.HeaderLength, SeekOrigin.Begin); ReadRecords(reader); } }
public DbfField AddNewField(string name, DbfFieldType type, int length) { if (type == DbfFieldType.Memo) { if (Header.Version == DbfVersion.dBase4SQLSystemNoMemo || Header.Version == DbfVersion.dBase4SQLTableNoMemo || Header.Version == DbfVersion.FoxBaseDBase3NoMemo) { throw new InvalidOperationException("Memo fields are not supported for this database version."); } if (Memo == null) { Memo = CreateMemo(); } } var field = new DbfField(name, type, length, _encoding); Fields.Add(field); return(field); }