Skip to main content

Search OfficeIMO

Enter a topic, API type, or PowerShell command.

Documentation Search all OfficeIMO/
Class

ArchiveInspection

OfficeIMO.Archives

Namespace
OfficeIMO.Archives
Assembly
OfficeIMO.Archives
Source revision
f9d02fda5e27 with working tree changes
Implements
IDisposable
Modifiers
sealed

An immutable passive inventory with serialized, bounded member reads. Dispose releases its input and decoder indexes.

Inheritance

  • object
  • ArchiveInspection

Usage

Explore 2 API references to this type

This type appears in these public API surfaces even when no hand-authored example is attached directly to the page.

Returned or exposed by 1

Accepted by parameters 1

Methods

public void CopyTo(int ordinal, Stream destination, CancellationToken cancellationToken = default) #

Copies one complete verified member to a writable caller-owned stream at its current position. Members spool to a private temporary file under MaxTemporaryBytes and are fully verified before the destination receives bytes. CAB/MSI verify the complete containing folder. Integrity failures leave the destination untouched. Cancellation or I/O failure during the final copy can leave a verified prefix; the caller owns output rollback. The destination is left open. This operation does not make input snapshots lazy or bound process peak memory.

Parameters

ordinal int required
destination System.IO.Stream required
cancellationToken System.Threading.CancellationToken = default optional
public void Dispose() #

Releases the input snapshot and indexes. Already returned member streams and immutable inventory metadata remain usable.

public Stream OpenRead(int ordinal, CancellationToken cancellationToken = default) #

Returns a read-only stream containing one complete length-validated member. Every nonzero CAB frame checksum in its containing folder is checked; absent checksums do not establish authenticity. The source ordinal selects duplicate names independently. The entire containing CAB folder is decoded and charged before returning; no prefix or partial bytes escape. The returned stream is caller-owned and remains valid after this inspection is disposed.

Parameters

ordinal int required
cancellationToken System.Threading.CancellationToken = default optional

Returns

Stream

Exceptions

  • NotSupportedException – The entry's declared source or compression cannot be read.
  • OfficeInspectionResourceLimitException – A configured or fixed managed admission ceiling is exhausted.
  • InvalidDataException – Decoded content is corrupt.
public Stream OpenStorageStream(int ordinal, CancellationToken cancellationToken = default) #

Returns all bytes of one inert raw MSI stream, without interpreting or executing its content. Per-member and cumulative read limits apply, and the returned caller-owned stream survives inspection disposal.

Parameters

ordinal int required
cancellationToken System.Threading.CancellationToken = default optional

Returns

Stream
public ArchiveReadPlan PlanRead(IReadOnlyList<int> ordinals, CancellationToken cancellationToken = default) #

Plans a grouped read from immutable inventory without decoding, checking payload checksums, consuming quotas or reserving future capacity. Full shared CAB folders count once; separate OpenRead calls repeat their containing-folder cost. Ordinals must be distinct and readable, as for ReadMembers. The detached plan survives inspection disposal; actual reads still enforce their current limits.

Parameters

ordinals System.Collections.Generic.IReadOnlyList<int> required
Distinct source ordinals in the desired result order.
cancellationToken System.Threading.CancellationToken = default optional
Cancellation while validating and summing the selection.

Exceptions

  • ArgumentException – The selection repeats an ordinal or exceeds the inventory count.
  • ArgumentOutOfRangeException – An ordinal is outside the inventory.
  • NotSupportedException – A selected source or compression is unsupported.
public ArchiveReadBatch ReadMembers(IReadOnlyList<int> ordinals, long maxSelectedBytes, CancellationToken cancellationToken = default) #

Reads selected complete members in request order, decoding each selected cabinet folder once. Raw duplicate names and MSI aliases remain separate. Selected payload size, ordinals and source support are checked before decoding. A corruption, limit or cancellation failure returns no batch or partial member. The inspection's cumulative expansion and frame-processing work limits also apply. A batch owns its read-only streams independently of this inspection. Memory includes retained selected bytes, input and decoder buffers; limits are not a peak-RSS guarantee.

Parameters

ordinals System.Collections.Generic.IReadOnlyList<int> required
Distinct source ordinals from Entries. Their order determines the returned member order.
maxSelectedBytes long required
Finite maximum aggregate selected payload bytes retained in this batch; zero permits only empty members.
cancellationToken System.Threading.CancellationToken = default optional
Cancellation for preflight, folder decoding and selected payload copies.

Exceptions

  • OfficeInspectionResourceLimitException – The selected payload or remaining expansion/work allowance is exhausted.
  • ArgumentException – An ordinal is repeated or the request exceeds the inventory count.
  • ArgumentOutOfRangeException – A size limit is negative or an ordinal is outside the inventory.
  • NotSupportedException – A selected source or compression cannot be read.
  • InvalidDataException – Selected payloads exceed their limit, decoded content is corrupt or a cumulative inspection limit is exceeded.
public ArchiveVerificationResult Verify(IReadOnlyList<int>? ordinals = null, CancellationToken cancellationToken = default) #

Verifies selected members, or all members when ordinals is null, without extracting files. CAB folders are decoded once per selection. Unsupported sources and corrupt groups receive structured outcomes. Cancellation and resource exhaustion are terminal. This operation does not establish authenticity.

Parameters

ordinals System.Collections.Generic.IReadOnlyList<int>? = null optional
cancellationToken System.Threading.CancellationToken = default optional

Properties

public ArchiveResourceUsage ResourceUsage { get; } #

Snapshot of cumulative resource charges for this inspection and related containers.

public ArchiveOperationBudget OperationBudget { get; } #

The shared operation budget. Pass CreateNested() when opening a member as another container.

public ArchiveFormat Format { get; } #

The detected container format.

public long InputLength { get; } #

Complete input snapshot size.

public IReadOnlyList<ArchiveInspectionEntry> Entries { get; } #

Authored ZIP/CAB records or MSI File rows in source order, including aliases and unsupported source profiles.

public IReadOnlyList<ArchiveStorageStream> StorageStreams { get; private set; } #

Inert raw MSI storage streams in compound directory traversal order; empty for ZIP/CAB.

public long ReadBytes { get; } #

Cumulative charged ZIP member, CAB folder and raw stream bytes, including attempted reads that fail.

public long DecompressionWorkBytes { get; } #

Cumulative CAB frame or ZIP processing work charged across member reads, including failed attempts after charging. Units bound frame setup and processing rather than exact CPU time or expanded payload size.