Пример #1
0
        /// <summary>
        /// Creates a pagemap on disk.
        /// </summary>
        public void Create()
        {
            FileOptions options = _pageManager.ForcedWrites ? FileOptions.WriteThrough : FileOptions.None;

            using (_fileStream = new FileStream(_pageManager.Storage.Path + Path.DirectorySeparatorChar + _fileName, FileMode.Open, FileAccess.ReadWrite, FileShare.Read, _blockLength, options))
            {
                _fileStream.SetLength(_blockLength);
                _header = new PagemapHeader();
                WriteHeader();
            }
        }
Пример #2
0
        /// <summary>
        /// Opens an existing pagemap.
        /// </summary>
        public void Open()
        {
            CheckIfFilesExist();

            FileOptions options = _pageManager.ForcedWrites ? FileOptions.WriteThrough : FileOptions.None;

            _fileStream = new FileStream(_pageManager.Storage.Path + Path.DirectorySeparatorChar + _fileName, FileMode.Open, FileAccess.ReadWrite, FileShare.Read, 4096, options);
            _header     = new PagemapHeader();

            ReadHeader();

            _opened = true;
        }