Class ChdHeaderInfo

Namespace
CHDSharp.Models
Assembly
CHDSharpLib.dll

Snapshot of a CHD file header, parsed without opening the file for hunk reads (libchdr chd_read_header parity). Returned by ReadHeader(string, out ChdHeaderInfo?) and its overloads.

public sealed record ChdHeaderInfo : IEquatable<ChdHeaderInfo>
Inheritance
ChdHeaderInfo
Implements
Inherited Members

Properties

Compression

The compression codec slots used by this CHD (up to 4 for V5; V1-V4 use slot 0 only). An uncompressed V5 CHD has all slots None.

public ChdCodec[] Compression { get; init; }

Property Value

ChdCodec[]

Flags

Raw CHD global flags field (V1-V4): bit 0 (0x01) = has parent, bit 1 (0x02) = writable. V5 has no flags field on disk, so this is always 0 for V5.

public uint Flags { get; init; }

Property Value

uint

HasParent

true if this CHD is a differential child that requires a parent CHD to read (derived from the parent MD5/SHA1 hashes).

public bool HasParent { get; }

Property Value

bool

HunkBytes

Size of each hunk (block) in bytes.

public uint HunkBytes { get; init; }

Property Value

uint

Length

Length of the on-disk header in bytes (76 / 80 / 120 / 108 / 124 for V1-V5).

public uint Length { get; init; }

Property Value

uint

MapOffset

File offset of the block map. Only populated for V5; 0 for V1-V4.

public ulong MapOffset { get; init; }

Property Value

ulong

Md5

MD5 hash of the raw data (V1-V3); null for V4/V5, which dropped MD5.

public byte[]? Md5 { get; init; }

Property Value

byte[]

MetaOffset

File offset of the first metadata entry, or 0 if the CHD has no metadata. Always 0 for V1/V2.

public ulong MetaOffset { get; init; }

Property Value

ulong

ObsoleteCylinders

Obsolete hard-disk geometry: cylinders. Only populated for V1/V2 headers.

public uint ObsoleteCylinders { get; init; }

Property Value

uint

ObsoleteHeads

Obsolete hard-disk geometry: heads. Only populated for V1/V2 headers.

public uint ObsoleteHeads { get; init; }

Property Value

uint

ObsoleteHunksize

Obsolete hunk size in sectors. Only populated for V1/V2 headers.

public uint ObsoleteHunksize { get; init; }

Property Value

uint

ObsoleteSectors

Obsolete hard-disk geometry: sectors per track. Only populated for V1/V2 headers.

public uint ObsoleteSectors { get; init; }

Property Value

uint

ParentMd5

MD5 hash of the parent file (V1-V3); null for V4/V5.

public byte[]? ParentMd5 { get; init; }

Property Value

byte[]

ParentSha1

SHA1 hash of the parent file (V3-V5); null for V1/V2.

public byte[]? ParentSha1 { get; init; }

Property Value

byte[]

RawSha1

SHA1 hash of only the raw (decompressed) image data (V3-V5); null for V1/V2.

public byte[]? RawSha1 { get; init; }

Property Value

byte[]

Sha1

SHA1 hash of the full image including metadata (V4/V5), or the raw SHA1 for V3; null for V1/V2.

public byte[]? Sha1 { get; init; }

Property Value

byte[]

TotalBytes

Total decompressed size of the image in bytes.

public ulong TotalBytes { get; init; }

Property Value

ulong

TotalHunks

Total number of hunks (blocks) in the image.

public uint TotalHunks { get; init; }

Property Value

uint

UnitBytes

Size of a unit in bytes, used for parent block address translation. For V5 this is read from the header; for V1-V4 it is derived from metadata (GDDD BPS, CD frame size 2448, or HunkBytes), matching UnitBytes and libchdr's header_guess_unitbytes.

public uint UnitBytes { get; init; }

Property Value

uint

UnitCount

Total number of units in the image (ceil(TotalBytes / UnitBytes)); 0 if UnitBytes is 0.

public ulong UnitCount { get; init; }

Property Value

ulong

Version

CHD format version (1-5).

public uint Version { get; init; }

Property Value

uint

Methods

ToString()

Returns a string representation of the header including version, size, and hunk count.

public override string ToString()

Returns

string