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