Provides read/write access to all of the different types of disk types to use to store the file structure.
상속: IDisposable
예제 #1
0
        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));
        }
예제 #2
0
        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;
 }
예제 #4
0
 private DiskIo(DiskMedium stream, bool isReadOnly)
 {
     if (stream is null)
     {
         throw new ArgumentNullException("stream");
     }
     m_isReadOnly = isReadOnly;
     m_blockSize  = stream.BlockSize;
     m_stream     = stream;
 }
예제 #5
0
 /// <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;
         }
     }
 }
예제 #6
0
        public static DiskIo CreateMemoryFile(MemoryPool pool, int fileStructureBlockSize, params Guid[] flags)
        {
            DiskMedium disk = DiskMedium.CreateMemoryFile(pool, fileStructureBlockSize, flags);

            return(new DiskIo(disk, false));
        }
 /// <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;
         }
     }
 }