public static DiskIo OpenFile(string fileName, MemoryPool pool, bool isReadOnly) { CustomFileStream fileStream = CustomFileStream.OpenFile(fileName, pool.PageSize, out int fileStructureBlockSize, isReadOnly, true); DiskMedium disk = DiskMedium.OpenFile(fileStream, pool, fileStructureBlockSize); return(new DiskIo(disk, isReadOnly)); }
public static DiskIo CreateFile(string fileName, MemoryPool pool, int fileStructureBlockSize, params Guid[] flags) { //Exclusive opening to prevent duplicate opening. CustomFileStream fileStream = CustomFileStream.CreateFile(fileName, pool.PageSize, fileStructureBlockSize); DiskMedium disk = DiskMedium.CreateFile(fileStream, pool, fileStructureBlockSize, flags); return(new DiskIo(disk, false)); }
private DiskIo(DiskMedium stream, bool isReadOnly) { if (stream == null) throw new ArgumentNullException("stream"); m_isReadOnly = isReadOnly; m_blockSize = stream.BlockSize; m_stream = stream; }
private DiskIo(DiskMedium stream, bool isReadOnly) { if (stream is null) { throw new ArgumentNullException("stream"); } m_isReadOnly = isReadOnly; m_blockSize = stream.BlockSize; m_stream = stream; }
/// <summary> /// Releases the unmanaged resources used by the <see cref="DiskIo"/> object and optionally releases the managed resources. /// </summary> public void Dispose() { if (!m_disposed) { try { if (m_stream != null) { m_stream.Dispose(); } } finally { GC.SuppressFinalize(this); m_stream = null; m_disposed = true; } } }
public static DiskIo CreateMemoryFile(MemoryPool pool, int fileStructureBlockSize, params Guid[] flags) { DiskMedium disk = DiskMedium.CreateMemoryFile(pool, fileStructureBlockSize, flags); return(new DiskIo(disk, false)); }