C# Class ZeroInstall.Store.Implementations.Archives.ArchiveExtractor

Extracts an archive.
Inheritance: NanoByte.Common.Tasks.TaskBase, IDisposable
Afficher le fichier Open project: 0install/0install-win Class Usage Examples

Private Properties

Свойство Type Description
Create ArchiveExtractor
Create ArchiveExtractor
CreateHardlink void
GetRelativePath string
RemoveExecutableBit void
SetDirectoryWriteTimes void
SetExecutableBit void

Méthodes publiques

Méthode Description
Dispose ( ) : void

Disposes the underlying Stream.

VerifySupport ( [ mimeType ) : void

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

Méthodes protégées

Méthode Description
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.

Private Methods

Méthode Description
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.

Method Details

ArchiveExtractor() protected méthode

Prepares to extract an archive contained in a stream.
protected ArchiveExtractor ( [ target ) : System
target [ The path to the directory to extract into.
Résultat System

CombinePath() protected méthode

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 .
Résultat string

CreateDirectory() protected méthode

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.
Résultat void

CreateSymlink() protected méthode

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!
Résultat void

Dispose() public méthode

Disposes the underlying Stream.
public Dispose ( ) : void
Résultat void

Dispose() protected abstract méthode

protected abstract Dispose ( bool disposing ) : void
disposing bool
Résultat void

Finish() protected méthode

Performs any tasks that were deferred to the end of the extraction process.
protected Finish ( ) : void
Résultat void

OpenFileWriteStream() protected méthode

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.
Résultat System.IO.FileStream

QueueHardlink() protected méthode

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.
Résultat void

StreamToFile() protected méthode

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.
Résultat void

VerifySupport() public static méthode

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.
Résultat void

WriteFile() protected méthode

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.
Résultat void