ArchiveFileInfo Class
Abstract object representing a compressed file within an archive; provides operations for getting the file properties and unpacking the file.
Methods
Section titled “Methods”| Method | Description |
|---|---|
| CopyTo(destFileName) | Extracts the file. |
| CopyTo(destFileName, overwrite) | Extracts the file, optionally overwriting any existing file. |
| Delete() | Deletes the file. NOT SUPPORTED. |
| GetObjectData(info, context) | Sets the SerializationInfo with information about the archive. |
| OpenRead() | Opens the archive file for reading without actually extracting the file to disk. |
| OpenText() | Opens the archive file reading text with UTF-8 encoding without actually extracting the file to disk. |
| Refresh() | Refreshes the attributes and other cached information about the file, by re-reading the information from the archive. |
| Refresh(newFileInfo) | Refreshes the information in this object with new data retrieved from an archive. |
| ToString() | Gets the full path to the file. |
Properties
Section titled “Properties”| Property | Description |
|---|---|
| Archive | Gets or sets the archive that contains this file. |
| ArchiveName | Gets the full path of the archive that contains this file. |
| ArchiveNumber | Gets the number of the archive where this file starts. |
| Attributes | Gets the attributes of the file. |
| Exists | Checks if the file exists within the archive. |
| FullName | Gets the full path to the file. |
| LastWriteTime | Gets the last modification time of the file. |
| Length | Gets the uncompressed size of the file. |
| Name | Gets the name of the file. |
| Path | Gets the internal path of the file in the archive. |
WixToolset.Dtf.Compression.dll version 5.0.0+41e11442b2ca93e444b60213b5ae99dcbab787d8 |
CopyTo(destFileName) Method
Section titled “CopyTo(destFileName) Method”Extracts the file.
Declaration
Section titled “Declaration”public void CopyTo( string destFileName)Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
| destFileName | string | The destination path where the file will be extracted. |
CopyTo(destFileName, overwrite) Method
Section titled “CopyTo(destFileName, overwrite) Method”Extracts the file, optionally overwriting any existing file.
Declaration
Section titled “Declaration”public void CopyTo( string destFileName, bool overwrite)Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
| destFileName | string | The destination path where the file will be extracted. |
| overwrite | bool | If true, will be overwritten if it exists. |
Exceptions
Section titled “Exceptions”| Exception | Description |
|---|---|
| T:System.IO.IOException | is false |
and exists. |Delete() Method
Section titled “Delete() Method”Deletes the file. NOT SUPPORTED.
Declaration
Section titled “Declaration”public void Delete()Exceptions
Section titled “Exceptions”| Exception | Description |
|---|---|
| T:System.NotSupportedException | Files cannot be deleted |
from an existing archive. |GetObjectData(info, context) Method
Section titled “GetObjectData(info, context) Method”Sets the SerializationInfo with information about the archive.
Declaration
Section titled “Declaration”public void GetObjectData( System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context)Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
| info | System.Runtime.Serialization.SerializationInfo | The SerializationInfo that holds the serialized object data. |
| context | System.Runtime.Serialization.StreamingContext | The StreamingContext that contains contextual information about the source or destination. |
OpenRead() Method
Section titled “OpenRead() Method”Opens the archive file for reading without actually extracting the file to disk.
Declaration
Section titled “Declaration”public System.IO.Stream OpenRead()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() Method
Section titled “OpenText() Method”Opens the archive file reading text with UTF-8 encoding without actually extracting the file to disk.
Declaration
Section titled “Declaration”public System.IO.StreamReader OpenText()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.ArchiveFileInfo.OpenRead» method and pass the returned stream to one of the «see T:System.IO.StreamReader» constructor overloads.
Refresh() Method
Section titled “Refresh() Method”Refreshes the attributes and other cached information about the file, by re-reading the information from the archive.
Declaration
Section titled “Declaration”public void Refresh()Refresh(newFileInfo) Method
Section titled “Refresh(newFileInfo) Method”Refreshes the information in this object with new data retrieved from an archive.
Declaration
Section titled “Declaration”protected void Refresh( ArchiveFileInfo newFileInfo)Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
| newFileInfo | ArchiveFileInfo | Fresh instance for the same file just read from the archive. |
Remarks
Section titled “Remarks”Subclasses may override this method to refresh sublcass fields. However they should always call the base implementation first.
ToString() Method
Section titled “ToString() Method”Gets the full path to the file.
Declaration
Section titled “Declaration”public string ToString()Return value
Section titled “Return value”string The same as «see P:WixToolset.Dtf.Compression.ArchiveFileInfo.FullName»
Archive Property
Section titled “Archive Property”Gets or sets the archive that contains this file.
Declaration
Section titled “Declaration”public ArchiveInfo Archive { get; set; }ArchiveName Property
Section titled “ArchiveName Property”Gets the full path of the archive that contains this file.
Declaration
Section titled “Declaration”public string ArchiveName { get; set; }ArchiveNumber Property
Section titled “ArchiveNumber Property”Gets the number of the archive where this file starts.
Declaration
Section titled “Declaration”public int ArchiveNumber { get; set; }Remarks
Section titled “Remarks”A single archive or the first archive in a chain is numbered 0.
Attributes Property
Section titled “Attributes Property”Gets the attributes of the file.
Declaration
Section titled “Declaration”public System.IO.FileAttributes Attributes { get; set; }Exists Property
Section titled “Exists Property”Checks if the file exists within the archive.
Declaration
Section titled “Declaration”public bool Exists { get; set; }FullName Property
Section titled “FullName Property”Gets the full path to the file.
Declaration
Section titled “Declaration”public string FullName { get; set; }Remarks
Section titled “Remarks”For example, the path "C:\archive.cab\file.txt" refers to a file “file.txt” inside the archive “archive.cab”.
LastWriteTime Property
Section titled “LastWriteTime Property”Gets the last modification time of the file.
Declaration
Section titled “Declaration”public System.DateTime LastWriteTime { get; set; }Length Property
Section titled “Length Property”Gets the uncompressed size of the file.
Declaration
Section titled “Declaration”public System.Int64 Length { get; set; }Name Property
Section titled “Name Property”Gets the name of the file.
Declaration
Section titled “Declaration”public string Name { get; set; }Path Property
Section titled “Path Property”Gets the internal path of the file in the archive.
Declaration
Section titled “Declaration”public string Path { get; set; }