Table of Contents

CompoundValidationLevel Enum

Definition

Namespace
Bodu.IO.Compound
Assembly
Bodu.IO.Compound.dll
Package
Bodu.IO.Compound 1.0.0
Source
CompoundValidationLevel.cs

Specifies how strictly the compound-file reader validates a container's structure.

public enum CompoundValidationLevel
Extension Methods

Fields

Strict = 0

Rejects every non-conformant condition, including directory entries with an invalid name length or entry type that more lenient levels silently skip.

Compatible = 1

The default: rejects structural corruption (allocation-table cycles, out-of-range or short sector chains, and cyclic directory links) while tolerating individually malformed directory entries by skipping them.

Minimal = 2

Recovers from structural corruption where it can: cyclic, out-of-range, or short sector chains and cyclic directory links stop and yield the data collected so far instead of throwing.

Remarks

All levels enforce the memory-safety invariants required to parse a file without faulting - the signature, byte-order marker, sector sizes, file truncation, allocation-table bounds, and the presence of a root storage are always validated. The level controls only how the reader responds to the remaining, recoverable inconsistencies.

// Salvage what a damaged legacy file still holds instead of rejecting it outright.
using var salvage = CompoundFile.OpenRead("damaged.doc", new CompoundFileOptions
{
    ValidationLevel = CompoundValidationLevel.Minimal,
});

// Conformance tooling wants the opposite: fail on anything non-conformant.
var strict = new CompoundFileOptions { ValidationLevel = CompoundValidationLevel.Strict };

Applies to

ProductVersions
.NET8, 10