Class WimArchive

Class WimArchive

Namespace: Aspose.Zip.Wim
Assembly: Aspose.Zip.dll (25.2.0)

This class represents wim archive file.

public class WimArchive : IArchive, IDisposable

Inheritance

objectWimArchive

Implements

IArchive, IDisposable

Inherited Members

object.GetType(), object.MemberwiseClone(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()

Constructors

WimArchive(Stream)

Initializes a new instance of the Aspose.Zip.Wim.WimArchive class and composes entries list can be extracted from the archive.

public WimArchive(Stream sourceStream)

Parameters

sourceStream Stream

The source of the archive. It must be seekable.

Examples

The following example shows how to extract all of the entries to a directory.

using (var archive = new WimArchive(File.OpenRead("archive.wim")))
{ 
   archive.Images[0].ExtractToDirectory("C:\\extracted");
}

Remarks

This constructor does not unpack any entry. See Aspose.Zip.Wim.WimFileEntry.Open method for unpacking.

Exceptions

ArgumentNullException

sourceStream is null.

ArgumentException

sourceStream is not seekable.

InvalidDataException

sourceStream is not valid wim archive.

WimArchive(string)

Initializes a new instance of the Aspose.Zip.Wim.WimArchive class and composes entries list can be extracted from the archive.

public WimArchive(string path)

Parameters

path string

The path to the archive file.

Examples

The following example shows how to extract all of the entries to a directory.

using (var archive = new WimArchive("archive.wim")) 
{ 
   archive.Images[0].ExtractToDirectory("C:\\extracted");
}

Remarks

This constructor does not unpack any entry. See Aspose.Zip.Wim.WimFileEntry.Open method for unpacking.

Exceptions

ArgumentNullException

path is null.

SecurityException

The caller does not have the required permission to access.

ArgumentException

The path is empty, contains only white spaces, or contains invalid characters.

UnauthorizedAccessException

Access to file path is denied.

PathTooLongException

The specified path, file name, or both exceed the system-defined maximum length. For example, on Windows-based platforms, paths must be less than 248 characters, and file names must be less than 260 characters.

NotSupportedException

File at path contains a colon (:) in the middle of the string.

FileNotFoundException

The file is not found.

DirectoryNotFoundException

The specified path is invalid, such as being on an unmapped drive.

IOException

The file is already open.

Properties

BootImageIndex

Gets the (zero-based) index of the bootable image.

public int BootImageIndex { get; }

Property Value

int

FileFormatVersion

Gets the version of the file format.

public int FileFormatVersion { get; }

Property Value

int

Guid

Gets the identifying GUID for the archive.

public Guid Guid { get; }

Property Value

Guid

Images

Gets entries of Aspose.Zip.Wim.WimImage type constituting the archive.

public ReadOnlyCollection<wimimage> Images { get; }

Property Value

ReadOnlyCollection<WimImage&gt;

Manifest

Gets the embedded manifest describing the file and the contained images.

public string Manifest { get; }

Property Value

string

Methods

Dispose(bool)

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

protected virtual void Dispose(bool disposing)

Parameters

disposing bool

Whether managed resources should be disposed.

Dispose()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

public void Dispose()

ExtractToDirectory(string)

Extracts the archive to the file by path.

public void ExtractToDirectory(string destinationDirectory)

Parameters

destinationDirectory string

The path to the directory to place the extracted files in.

Exceptions

ArgumentNullException

path is null

PathTooLongException

The specified path, file name, or both exceed the system-defined maximum length. For example, on Windows-based platforms, paths must be less than 248 characters and file names must be less than 260 characters.

SecurityException

The caller does not have the required permission to access existing directory.

NotSupportedException

If directory does not exist, path contains a colon character (:) that is not part of a drive label (“C:").

ArgumentException

path is a zero-length string, contains only white space, or contains one or more invalid characters. You can query for invalid characters by using the System.IO.Path.GetInvalidPathChars method. -or- path is prefixed with, or contains, only a colon character (:).

IOException

The directory specified by path is a file. -or- The network name is not known.

InvalidDataException

Archive is corrupted.

 English