Пример #1
0
        /// <summary>
        /// Save header to file. Normally, you do not have to call this method, header is saved
        /// automatically and updated when you close the file (if it changed).
        /// </summary>
        public bool WriteHeader()
        {
            //update header if possible
            //--------------------------------
            if (_dbfFileWriter != null)
            {
                if (_dbfFileWriter.BaseStream.CanSeek)
                {
                    _dbfFileWriter.Seek(0, SeekOrigin.Begin);
                    _header.Write(_dbfFileWriter);
                    _headerWritten = true;
                    return(true);
                }
                else
                {
                    //if stream can not seek, then just write it out and that's it.
                    if (!_headerWritten)
                    {
                        _header.Write(_dbfFileWriter);
                    }

                    _headerWritten = true;
                }
            }

            return(false);
        }