Skip to content

ArchiveInfo Class

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

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.
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.0+41e11442b2ca93e444b60213b5ae99dcbab787d8

Copies an existing archive to another location.

public void CopyTo(
string destFileName
)
ParameterTypeDescription
destFileNamestringThe destination file path.

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

public void CopyTo(
string destFileName,
bool overwrite
)
ParameterTypeDescription
destFileNamestringThe destination file path.
overwriteboolIf true, the destination file will be overwritten if it exists.

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

protected CompressionEngine CreateCompressionEngine()

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

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

Deletes the archive.

public void Delete()

Gets information about the files contained in the archive.

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

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

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

public IList<WixToolset.Dtf.Compression.ArchiveFileInfo> GetFiles(
string searchPattern
)
ParameterTypeDescription
searchPatternstringThe search string, such as “*.txt”.

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

Checks if the archive contains a valid archive header.

public bool IsValid()

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

Moves an existing archive to another location.

public void MoveTo(
string destFileName
)
ParameterTypeDescription
destFileNamestringThe destination file path.

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

public System.IO.Stream OpenRead(
string fileName
)
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.

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.

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

public System.IO.StreamReader OpenText(
string fileName
)
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.

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.

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.

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

public void Pack(
string sourceDirectory
)
ParameterTypeDescription
sourceDirectorystringThe directory containing the files to be included.

Uses maximum compression level.

Gets the full path of the archive.

public string ToString()

string The full path of the archive.

Extracts all files from an archive to a destination directory.

public void Unpack(
string destDirectory
)
ParameterTypeDescription
destDirectorystringDirectory where the files are to be extracted.

Extracts a single file from the archive.

public void UnpackFile(
string fileName,
string destFileName
)
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.

If destFileName already exists, it will be overwritten.

Gets the directory that contains the archive.

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

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

public string DirectoryName { get; set; }

Checks if the archive exists.

public bool Exists { get; set; }

Gets the size of the archive.

public System.Int64 Length { get; set; }

Gets the file name of the archive.

public string Name { get; set; }