Provides read/write access to all of the different types of disk types to use to store the file structure.
Inheritance: IDisposable
コード例 #1
0
ファイル: DiskIo.cs プロジェクト: ibgeorge/openHistorian
        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
ファイル: DiskIo.cs プロジェクト: ibgeorge/openHistorian
        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));
        }
コード例 #3
0
 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
ファイル: DiskIo.cs プロジェクト: ibgeorge/openHistorian
 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
ファイル: DiskIo.cs プロジェクト: ibgeorge/openHistorian
 /// <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
ファイル: DiskIo.cs プロジェクト: ibgeorge/openHistorian
        public static DiskIo CreateMemoryFile(MemoryPool pool, int fileStructureBlockSize, params Guid[] flags)
        {
            DiskMedium disk = DiskMedium.CreateMemoryFile(pool, fileStructureBlockSize, flags);

            return(new DiskIo(disk, false));
        }
コード例 #7
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;
         }
     }
 }