Skip to main content

ArchiveFileInfo Class

Abstract object representing a compressed file within an archive; provides operations for getting the file properties and unpacking the file.

Methods

MethodDescription
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

PropertyDescription
ArchiveGets or sets the archive that contains this file.
ArchiveNameGets the full path of the archive that contains this file.
ArchiveNumberGets the number of the archive where this file starts.
AttributesGets the attributes of the file.
ExistsChecks if the file exists within the archive.
FullNameGets the full path to the file.
LastWriteTimeGets the last modification time of the file.
LengthGets the uncompressed size of the file.
NameGets the name of the file.
PathGets 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

ParameterTypeDescription
destFileNamestringThe 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

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

Exceptions

ExceptionDescription
T:System.IO.IOExceptionis false
and exists.

Delete() Method

Deletes the file. NOT SUPPORTED.

Declaration

public void Delete()

Exceptions

ExceptionDescription
T:System.NotSupportedExceptionFiles 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

ParameterTypeDescription
infoSystem.Runtime.Serialization.SerializationInfoThe SerializationInfo that holds the serialized object data.
contextSystem.Runtime.Serialization.StreamingContextThe 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

ParameterTypeDescription
newFileInfoArchiveFileInfoFresh 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; }