Skip to main content

ArchiveInfo Class

Abstract object representing a compressed archive on disk; provides access to file-based operations on the archive.

Methods

MethodDescription
CopyTo(destFileName)Copies an existing archive to another location.
CopyTo(destFileName, overwrite)Copies an existing archive to another location, optionally overwriting the destination file.
CreateCompressionEngine()Creates a compression engine that does the low-level work for this object.
Delete()Deletes the archive.
GetFiles()Gets information about the files contained in the archive.
GetFiles(searchPattern)Gets information about the certain files contained in the archive file.
IsValid()Checks if the archive contains a valid archive header.
MoveTo(destFileName)Moves an existing archive to another location.
OpenRead(fileName)Opens a file inside the archive for reading without actually extracting the file to disk.
OpenText(fileName)Opens a file inside the archive for reading text with UTF-8 encoding without actually extracting the file to disk.
Pack(sourceDirectory)Compresses all files in a directory into the archive. Does not include subdirectories.
ToString()Gets the full path of the archive.
Unpack(destDirectory)Extracts all files from an archive to a destination directory.
UnpackFile(fileName, destFileName)Extracts a single file from the archive.

Properties

PropertyDescription
DirectoryGets the directory that contains the archive.
DirectoryNameGets the full path of the directory that contains the archive.
ExistsChecks if the archive exists.
LengthGets the size of the archive.
NameGets the file name of the archive.

WixToolset.Dtf.Compression.dll version 5.0.2+aa65968c419420d32e3e1b647aea0082f5ca5b78

CopyTo(destFileName) Method

Copies an existing archive to another location.

Declaration

public void CopyTo(
string destFileName
)

Parameters

ParameterTypeDescription
destFileNamestringThe destination file path.

CopyTo(destFileName, overwrite) Method

Copies an existing archive to another location, optionally overwriting the destination file.

Declaration

public void CopyTo(
string destFileName,
bool overwrite
)

Parameters

ParameterTypeDescription
destFileNamestringThe destination file path.
overwriteboolIf true, the destination file will be overwritten if it exists.

CreateCompressionEngine() Method

Creates a compression engine that does the low-level work for this object.

Declaration

protected CompressionEngine CreateCompressionEngine()

Return value

CompressionEngine A new compression engine instance that matches the specific subclass of archive.

Remarks

Each instance will be «see M:WixToolset.Dtf.Compression.CompressionEngine.Dispose» d immediately after use.

Delete() Method

Deletes the archive.

Declaration

public void Delete()

GetFiles() Method

Gets information about the files contained in the archive.

Declaration

public IList<WixToolset.Dtf.Compression.ArchiveFileInfo> GetFiles()

Return value

IList<WixToolset.Dtf.Compression.ArchiveFileInfo> A list of «see T:WixToolset.Dtf.Compression.ArchiveFileInfo» objects, each containing information about a file in the archive.

GetFiles(searchPattern) Method

Gets information about the certain files contained in the archive file.

Declaration

public IList<WixToolset.Dtf.Compression.ArchiveFileInfo> GetFiles(
string searchPattern
)

Parameters

ParameterTypeDescription
searchPatternstringThe search string, such as "*.txt".

Return value

IList<WixToolset.Dtf.Compression.ArchiveFileInfo> A list of «see T:WixToolset.Dtf.Compression.ArchiveFileInfo» objects, each containing information about a file in the archive.

IsValid() Method

Checks if the archive contains a valid archive header.

Declaration

public bool IsValid()

Return value

bool True if the file is a valid archive; false otherwise.

MoveTo(destFileName) Method

Moves an existing archive to another location.

Declaration

public void MoveTo(
string destFileName
)

Parameters

ParameterTypeDescription
destFileNamestringThe destination file path.

OpenRead(fileName) Method

Opens a file inside the archive for reading without actually extracting the file to disk.

Declaration

public System.IO.Stream OpenRead(
string fileName
)

Parameters

ParameterTypeDescription
fileNamestringThe name of the file in the archive. Also includes the internal path of the file, if any. File name matching is case-insensitive.

Return value

System.IO.Stream A stream for reading directly from the packed file. Like any stream this should be closed/disposed as soon as it is no longer needed.

OpenText(fileName) Method

Opens a file inside the archive for reading text with UTF-8 encoding without actually extracting the file to disk.

Declaration

public System.IO.StreamReader OpenText(
string fileName
)

Parameters

ParameterTypeDescription
fileNamestringThe name of the file in the archive. Also includes the internal path of the file, if any. File name matching is case-insensitive.

Return value

System.IO.StreamReader A reader for reading text directly from the packed file. Like any reader this should be closed/disposed as soon as it is no longer needed.

Remarks

To open an archived text file with different encoding, use the «see M:WixToolset.Dtf.Compression.ArchiveInfo.OpenRead(System.String)» method and pass the returned stream to one of the «see T:System.IO.StreamReader» constructor overloads.

Pack(sourceDirectory) Method

Compresses all files in a directory into the archive. Does not include subdirectories.

Declaration

public void Pack(
string sourceDirectory
)

Parameters

ParameterTypeDescription
sourceDirectorystringThe directory containing the files to be included.

Remarks

Uses maximum compression level.

ToString() Method

Gets the full path of the archive.

Declaration

public string ToString()

Return value

string The full path of the archive.

Unpack(destDirectory) Method

Extracts all files from an archive to a destination directory.

Declaration

public void Unpack(
string destDirectory
)

Parameters

ParameterTypeDescription
destDirectorystringDirectory where the files are to be extracted.

UnpackFile(fileName, destFileName) Method

Extracts a single file from the archive.

Declaration

public void UnpackFile(
string fileName,
string destFileName
)

Parameters

ParameterTypeDescription
fileNamestringThe name of the file in the archive. Also includes the internal path of the file, if any. File name matching is case-insensitive.
destFileNamestringThe path where the file is to be extracted on disk.

Remarks

If destFileName already exists, it will be overwritten.

Directory Property

Gets the directory that contains the archive.

Declaration

public System.IO.DirectoryInfo Directory { get; set; } 

DirectoryName Property

Gets the full path of the directory that contains the archive.

Declaration

public string DirectoryName { get; set; } 

Exists Property

Checks if the archive exists.

Declaration

public bool Exists { get; set; } 

Length Property

Gets the size of the archive.

Declaration

public System.Int64 Length { get; set; } 

Name Property

Gets the file name of the archive.

Declaration

public string Name { get; set; }