C# Класс GSF.IO.FileStructure.Media.DiskMedium

Provides read/write access to all of the different types of disk types to use to store the file structure.
Наследование: IDisposable
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
ChangeExtension ( string extension, bool isReadOnly, bool isSharingEnabled ) : void

Changes the extension of the current file.

ChangeShareMode ( bool isReadOnly, bool isSharingEnabled ) : void

Reopens the file with different permissions.

CommitChanges ( FileHeaderBlock header ) : void

Occurs when committing the following data to the disk. This will copy any pending data to the disk in a manner that will protect against corruption.

CreateFile ( CustomFileStream stream, MemoryPool pool, int fileStructureBlockSize ) : DiskMedium

Creates a DiskMedium from a stream. This will initialize the stream as an empty file structure.

This will not check if the file is truely a new file. If calling this with an existing archive file, it will overwrite the table of contents, corrupting the file.

CreateIoSession ( ) : BinaryStreamIoSessionBase

Creates a BinaryStreamIoSessionBase that can be used to read from this disk medium.

CreateMemoryFile ( MemoryPool pool, int fileStructureBlockSize ) : DiskMedium

Creates a DiskMedium that is entirely based in memory.

Dispose ( ) : void

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

OpenFile ( CustomFileStream stream, MemoryPool pool, int fileStructureBlockSize ) : DiskMedium

Creates a DiskMedium from a stream. This will read the existing header from the stream.

RollbackChanges ( ) : void

Occurs when rolling back a transaction. This will free up any temporary space allocated for the change.

Приватные методы

Метод Описание
DiskMedium ( IDiskMediumCoreFunctions disk, FileHeaderBlock header ) : System

Class is created through static methods of this class.

Описание методов

ChangeExtension() публичный метод

Changes the extension of the current file.
public ChangeExtension ( string extension, bool isReadOnly, bool isSharingEnabled ) : void
extension string the new extension
isReadOnly bool If the file should be reopened as readonly
isSharingEnabled bool If the file should share read privileges.
Результат void

ChangeShareMode() публичный метод

Reopens the file with different permissions.
public ChangeShareMode ( bool isReadOnly, bool isSharingEnabled ) : void
isReadOnly bool If the file should be reopened as readonly
isSharingEnabled bool If the file should share read privileges.
Результат void

CommitChanges() публичный метод

Occurs when committing the following data to the disk. This will copy any pending data to the disk in a manner that will protect against corruption.
public CommitChanges ( FileHeaderBlock header ) : void
header FileHeaderBlock
Результат void

CreateFile() публичный статический метод

Creates a DiskMedium from a stream. This will initialize the stream as an empty file structure.
This will not check if the file is truely a new file. If calling this with an existing archive file, it will overwrite the table of contents, corrupting the file.
public static CreateFile ( CustomFileStream stream, MemoryPool pool, int fileStructureBlockSize ) : DiskMedium
stream CustomFileStream An open to use. The /// will assume ownership of this .
pool GSF.IO.Unmanaged.MemoryPool the to allocate data from
fileStructureBlockSize int the block size of the file structure. Usually 4kb.
Результат DiskMedium

CreateIoSession() публичный метод

Creates a BinaryStreamIoSessionBase that can be used to read from this disk medium.
public CreateIoSession ( ) : BinaryStreamIoSessionBase
Результат GSF.IO.Unmanaged.BinaryStreamIoSessionBase

CreateMemoryFile() публичный статический метод

Creates a DiskMedium that is entirely based in memory.
public static CreateMemoryFile ( MemoryPool pool, int fileStructureBlockSize ) : DiskMedium
pool GSF.IO.Unmanaged.MemoryPool the to allocate data from
fileStructureBlockSize int the block size of the file structure. Usually 4kb.
Результат DiskMedium

Dispose() публичный метод

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
public Dispose ( ) : void
Результат void

OpenFile() публичный статический метод

Creates a DiskMedium from a stream. This will read the existing header from the stream.
public static OpenFile ( CustomFileStream stream, MemoryPool pool, int fileStructureBlockSize ) : DiskMedium
stream CustomFileStream An open to use. The /// will assume ownership of this .
pool GSF.IO.Unmanaged.MemoryPool The to allocate data from.
fileStructureBlockSize int the block size of the file structure. Usually 4kb.
Результат DiskMedium

RollbackChanges() публичный метод

Occurs when rolling back a transaction. This will free up any temporary space allocated for the change.
public RollbackChanges ( ) : void
Результат void