C# Класс ZeroInstall.Store.Implementations.Archives.ArchiveExtractor

Extracts an archive.
Наследование: NanoByte.Common.Tasks.TaskBase, IDisposable
Показать файл Открыть проект Примеры использования класса

Private Properties

Свойство Тип Описание
Create ArchiveExtractor
Create ArchiveExtractor
CreateHardlink void
GetRelativePath string
RemoveExecutableBit void
SetDirectoryWriteTimes void
SetExecutableBit void

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

Метод Описание
Dispose ( ) : void

Disposes the underlying Stream.

VerifySupport ( [ mimeType ) : void

Verifies that a archives of a specific MIME type are supported.

Защищенные методы

Метод Описание
ArchiveExtractor ( [ target ) : System

Prepares to extract an archive contained in a stream.

CombinePath ( [ relativePath ) : string

Combines the extraction TargetDir path with the relative path inside the archive (ensuring only valid paths are returned).

CreateDirectory ( [ relativePath, System.DateTime lastWriteTime ) : void

Creates a directory in the filesystem and sets its last write time.

CreateSymlink ( [ source, [ target ) : void

Creates a symbolic link in the filesystem if possible; stores it in a FlagUtils.SymlinkFile otherwise.

Dispose ( bool disposing ) : void
Finish ( ) : void

Performs any tasks that were deferred to the end of the extraction process.

OpenFileWriteStream ( [ relativePath, bool executable = false ) : FileStream

Creates a stream for writing an extracted file to the filesystem.

QueueHardlink ( [ source, [ target, bool executable = false ) : void

Queues a hardlink for creation at the end of the extracton process. This enables handling links to files that have not been extracted yet.

StreamToFile ( [ stream, [ fileStream ) : void

Helper method for WriteFile.

Can be overwritten for archive formats that don't simply write a Stream to a file.

WriteFile ( [ relativePath, long fileSize, System.DateTime lastWriteTime, [ stream, bool executable = false ) : void

Writes a file to the filesystem and sets its last write time.

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

Метод Описание
Create ( [ stream, [ target, [ mimeType ) : ArchiveExtractor
Create ( [ path, [ target, [ mimeType = null, long startOffset ) : ArchiveExtractor
CreateHardlink ( [ source, [ target ) : void

Creates a hardlink in the filesystem if possible; creates a copy otherwise.

GetRelativePath ( [ entryName ) : string
RemoveExecutableBit ( string relativePath ) : void

Marks a file as no longer executable using the filesystem if possible, an FlagUtils.XbitFile file otherwise.

SetDirectoryWriteTimes ( ) : void

Sets the last write times of the directories that were recorded during extraction.

This must be done in a separate step, since changing anything within a directory will affect its last write time.

SetExecutableBit ( string relativePath ) : void

Marks a file as executable using the filesystem if possible; stores it in a FlagUtils.XbitFile otherwise.

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

ArchiveExtractor() защищенный Метод

Prepares to extract an archive contained in a stream.
protected ArchiveExtractor ( [ target ) : System
target [ The path to the directory to extract into.
Результат System

CombinePath() защищенный Метод

Combines the extraction TargetDir path with the relative path inside the archive (ensuring only valid paths are returned).
is invalid (e.g. is absolute, points outside the archive's root, contains invalid characters).
protected CombinePath ( [ relativePath ) : string
relativePath [ A path relative to .
Результат string

CreateDirectory() защищенный Метод

Creates a directory in the filesystem and sets its last write time.
protected CreateDirectory ( [ relativePath, System.DateTime lastWriteTime ) : void
relativePath [ A path relative to .
lastWriteTime System.DateTime The last write time to set.
Результат void

CreateSymlink() защищенный Метод

Creates a symbolic link in the filesystem if possible; stores it in a FlagUtils.SymlinkFile otherwise.
protected CreateSymlink ( [ source, [ target ) : void
source [ A path relative to .
target [ The target the symbolic link shall point to relative to . May use non-native path separators!
Результат void

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

Disposes the underlying Stream.
public Dispose ( ) : void
Результат void

Dispose() защищенный абстрактный Метод

protected abstract Dispose ( bool disposing ) : void
disposing bool
Результат void

Finish() защищенный Метод

Performs any tasks that were deferred to the end of the extraction process.
protected Finish ( ) : void
Результат void

OpenFileWriteStream() защищенный Метод

Creates a stream for writing an extracted file to the filesystem.
protected OpenFileWriteStream ( [ relativePath, bool executable = false ) : FileStream
relativePath [ A path relative to .
executable bool true if the file's executable bit is set; false otherwise.
Результат System.IO.FileStream

QueueHardlink() защищенный Метод

Queues a hardlink for creation at the end of the extracton process. This enables handling links to files that have not been extracted yet.
protected QueueHardlink ( [ source, [ target, bool executable = false ) : void
source [ A path relative to .
target [ A path relative to .
executable bool true if the hardlink's executable bit is set; false otherwise.
Результат void

StreamToFile() защищенный Метод

Helper method for WriteFile.
Can be overwritten for archive formats that don't simply write a Stream to a file.
protected StreamToFile ( [ stream, [ fileStream ) : void
stream [ The stream to write to a file.
fileStream [ Stream access to the file to write.
Результат void

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

Verifies that a archives of a specific MIME type are supported.
The doesn't belong to a known and supported archive type or is null.
public static VerifySupport ( [ mimeType ) : void
mimeType [ The MIME type of archive format of the stream.
Результат void

WriteFile() защищенный Метод

Writes a file to the filesystem and sets its last write time.
protected WriteFile ( [ relativePath, long fileSize, System.DateTime lastWriteTime, [ stream, bool executable = false ) : void
relativePath [ A path relative to .
fileSize long The length of the zip entries uncompressed data, needed because stream's Length property is always 0.
lastWriteTime System.DateTime The last write time to set.
stream [ The stream containing the file data to be written.
executable bool true if the file's executable bit is set; false otherwise.
Результат void