Exemple #1
0
        private void ReadHeader()
        {
            this._dbfHeader = new TDbfHeader();

            try
            {
                this._dbfHeader.Version = this._binaryReader.ReadSByte();         //第1字节
                this._dbfHeader.LastModifyYear = this._binaryReader.ReadByte();   //第2字节
                this._dbfHeader.LastModifyMonth = this._binaryReader.ReadByte();  //第3字节
                this._dbfHeader.LastModifyDay = this._binaryReader.ReadByte();    //第4字节
                this._dbfHeader.RecordCount = this._binaryReader.ReadInt32();     //第5-8字节
                this._dbfHeader.HeaderLength = this._binaryReader.ReadUInt16();   //第9-10字节
                this._dbfHeader.RecordLength = this._binaryReader.ReadUInt16();   //第11-12字节
                this._dbfHeader.Reserved = this._binaryReader.ReadBytes(16);      //第13-14字节
                this._dbfHeader.TableFlag = this._binaryReader.ReadSByte();       //第15字节
                this._dbfHeader.CodePageFlag = this._binaryReader.ReadSByte();    //第16字节
                this._dbfHeader.Reserved2 = this._binaryReader.ReadBytes(2);      //第17-18字节

                this._fieldCount = GetFieldCount();
            }
            catch
            {
                throw new Exception("fail to read file header.");
            }
        }
Exemple #2
0
        public void Close()
        {
            this.CloseFileStream();

            _recordBuffer = null;
            _dbfHeader = null;
            _dbfFields = null;

            _isFileOpened = false;
            _fieldCount = 0;
        }