Class WimLoadOptions
Class WimLoadOptions
Namespace: Aspose.Zip.Wim
Assembly: Aspose.Zip.dll (25.7.0)
Options with which archive is loaded from a compressed file.
public class WimLoadOptions
Inheritance
Inherited Members
object.GetType() , object.MemberwiseClone() , object.ToString() , object.Equals(object?) , object.Equals(object?, object?) , object.ReferenceEquals(object?, object?) , object.GetHashCode()
Constructors
WimLoadOptions()
public WimLoadOptions()
Properties
CancellationToken
Gets or sets a cancellation token used to cancel the extraction operation.
public CancellationToken CancellationToken { get; set; }
Property Value
Examples
Cancel WIM archive extraction after a certain time.
using (CancellationTokenSource cts = new CancellationTokenSource())
{
cts.CancelAfter(TimeSpan.FromSeconds(60));
using (var a = new WimArchive("big.wim", new WimLoadOptions() { CancellationToken = cts.Token }))
{
try
{
a.Images[0].AllEntries.OfType<WimFileEntry>().First().Extract("data.bin");
}
catch(OperationCanceledException)
{
Console.WriteLine("Extraction was cancelled after 60 seconds");
}
}
}
```<p>
Using with <code>Task</code>
```csharp
CancellationTokenSource cts = new CancellationTokenSource();
cts.CancelAfter(TimeSpan.FromSeconds(60));
Task t = Task.Run(delegate()
{
var loadOptions = new WimLoadOptions() { CancellationToken = cts.Token };
using (var a = WimArchive("big.wim", loadOptions))
{
a.ExtractToDirectory("destination");
}
}, cts.Token);
t.ContinueWith(delegate(Task antecedent)
{
if (antecedent.IsCanceled)
{
Console.WriteLine("Extraction was cancelled after 60 seconds");
}
cts.Dispose();
});
```</p>
Cancellation mostly results in some data not being extracted.
#### Remarks
This property exists for .NET Framework 4.0 and above.