ArchiveInfo Class
Abstract object representing a compressed archive on disk; provides access to file-based operations on the archive.
Methods
Section titled “Methods”| Method | Description |
|---|---|
| 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
Section titled “Properties”| Property | Description |
|---|---|
| Directory | Gets the directory that contains the archive. |
| DirectoryName | Gets the full path of the directory that contains the archive. |
| Exists | Checks if the archive exists. |
| Length | Gets the size of the archive. |
| Name | Gets the file name of the archive. |
WixToolset.Dtf.Compression.dll version 5.0.0+41e11442b2ca93e444b60213b5ae99dcbab787d8 |
CopyTo(destFileName) Method
Section titled “CopyTo(destFileName) Method”Copies an existing archive to another location.
Declaration
Section titled “Declaration”public void CopyTo( string destFileName)Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
| destFileName | string | The destination file path. |
CopyTo(destFileName, overwrite) Method
Section titled “CopyTo(destFileName, overwrite) Method”Copies an existing archive to another location, optionally overwriting the destination file.
Declaration
Section titled “Declaration”public void CopyTo( string destFileName, bool overwrite)Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
| destFileName | string | The destination file path. |
| overwrite | bool | If true, the destination file will be overwritten if it exists. |
CreateCompressionEngine() Method
Section titled “CreateCompressionEngine() Method”Creates a compression engine that does the low-level work for this object.
Declaration
Section titled “Declaration”protected CompressionEngine CreateCompressionEngine()Return value
Section titled “Return value”CompressionEngine A new compression engine instance that matches the specific subclass of archive.
Remarks
Section titled “Remarks”Each instance will be «see M:WixToolset.Dtf.Compression.CompressionEngine.Dispose» d immediately after use.
Delete() Method
Section titled “Delete() Method”Deletes the archive.
Declaration
Section titled “Declaration”public void Delete()GetFiles() Method
Section titled “GetFiles() Method”Gets information about the files contained in the archive.
Declaration
Section titled “Declaration”public IList<WixToolset.Dtf.Compression.ArchiveFileInfo> GetFiles()Return value
Section titled “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
Section titled “GetFiles(searchPattern) Method”Gets information about the certain files contained in the archive file.
Declaration
Section titled “Declaration”public IList<WixToolset.Dtf.Compression.ArchiveFileInfo> GetFiles( string searchPattern)Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
| searchPattern | string | The search string, such as “*.txt”. |
Return value
Section titled “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
Section titled “IsValid() Method”Checks if the archive contains a valid archive header.
Declaration
Section titled “Declaration”public bool IsValid()Return value
Section titled “Return value”bool True if the file is a valid archive; false otherwise.
MoveTo(destFileName) Method
Section titled “MoveTo(destFileName) Method”Moves an existing archive to another location.
Declaration
Section titled “Declaration”public void MoveTo( string destFileName)Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
| destFileName | string | The destination file path. |
OpenRead(fileName) Method
Section titled “OpenRead(fileName) Method”Opens a file inside the archive for reading without actually extracting the file to disk.
Declaration
Section titled “Declaration”public System.IO.Stream OpenRead( string fileName)Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
| fileName | string | The 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
Section titled “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
Section titled “OpenText(fileName) Method”Opens a file inside the archive for reading text with UTF-8 encoding without actually extracting the file to disk.
Declaration
Section titled “Declaration”public System.IO.StreamReader OpenText( string fileName)Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
| fileName | string | The 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
Section titled “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
Section titled “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
Section titled “Pack(sourceDirectory) Method”Compresses all files in a directory into the archive. Does not include subdirectories.
Declaration
Section titled “Declaration”public void Pack( string sourceDirectory)Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
| sourceDirectory | string | The directory containing the files to be included. |
Remarks
Section titled “Remarks”Uses maximum compression level.
ToString() Method
Section titled “ToString() Method”Gets the full path of the archive.
Declaration
Section titled “Declaration”public string ToString()Return value
Section titled “Return value”string The full path of the archive.
Unpack(destDirectory) Method
Section titled “Unpack(destDirectory) Method”Extracts all files from an archive to a destination directory.
Declaration
Section titled “Declaration”public void Unpack( string destDirectory)Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
| destDirectory | string | Directory where the files are to be extracted. |
UnpackFile(fileName, destFileName) Method
Section titled “UnpackFile(fileName, destFileName) Method”Extracts a single file from the archive.
Declaration
Section titled “Declaration”public void UnpackFile( string fileName, string destFileName)Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
| fileName | string | The name of the file in the archive. Also includes the internal path of the file, if any. File name matching is case-insensitive. |
| destFileName | string | The path where the file is to be extracted on disk. |
Remarks
Section titled “Remarks”If destFileName already exists, it will be overwritten.
Directory Property
Section titled “Directory Property”Gets the directory that contains the archive.
Declaration
Section titled “Declaration”public System.IO.DirectoryInfo Directory { get; set; }DirectoryName Property
Section titled “DirectoryName Property”Gets the full path of the directory that contains the archive.
Declaration
Section titled “Declaration”public string DirectoryName { get; set; }Exists Property
Section titled “Exists Property”Checks if the archive exists.
Declaration
Section titled “Declaration”public bool Exists { get; set; }Length Property
Section titled “Length Property”Gets the size of the archive.
Declaration
Section titled “Declaration”public System.Int64 Length { get; set; }Name Property
Section titled “Name Property”Gets the file name of the archive.
Declaration
Section titled “Declaration”public string Name { get; set; }