Class ChdHeaderV5
Represents the header structure for CHD version 5 files.
public class ChdHeaderV5
- Inheritance
-
ChdHeaderV5
- Inherited Members
Fields
Length
The serialized header length in bytes.
public const uint Length = 124
Field Value
Tag
The CHD header tag as a byte array.
public static readonly byte[] Tag
Field Value
- byte[]
TagString
The CHD header tag as a string.
public const string TagString = "MComprHD"
Field Value
Version
The CHD format version (5).
public const uint Version = 5
Field Value
Properties
Compressors
Gets or sets the four compressor codec tags.
public uint[] Compressors { get; set; }
Property Value
- uint[]
HunkBytes
Gets or sets the size of each hunk in bytes.
public uint HunkBytes { get; set; }
Property Value
IsCompressed
Gets a value indicating whether the image uses compression.
public bool IsCompressed { get; }
Property Value
LogicalBytes
Gets or sets the total logical (uncompressed) size in bytes.
public ulong LogicalBytes { get; set; }
Property Value
MapOffset
Gets or sets the byte offset of the hunk map within the file.
public ulong MapOffset { get; set; }
Property Value
MetaOffset
Gets or sets the byte offset of metadata within the file.
public ulong MetaOffset { get; set; }
Property Value
ParentSha1
Gets or sets the SHA-1 hash of the parent CHD, if applicable.
public byte[] ParentSha1 { get; set; }
Property Value
- byte[]
RawSha1
Gets or sets the SHA-1 hash of the raw (uncompressed) data.
public byte[] RawSha1 { get; set; }
Property Value
- byte[]
Sha1
Gets or sets the SHA-1 hash of the final CHD data.
public byte[] Sha1 { get; set; }
Property Value
- byte[]
UnitBytes
Gets or sets the unit size in bytes.
public uint UnitBytes { get; set; }
Property Value
Methods
CreateRaw(uint, ulong, uint, uint)
Creates a header for a raw (uncompressed) CHD image.
public static ChdHeaderV5 CreateRaw(uint compressors0, ulong logicalBytes, uint hunkBytes, uint unitBytes)
Parameters
compressors0uintThe primary compressor codec tag.
logicalBytesulongThe total logical size in bytes.
hunkBytesuintThe hunk size in bytes.
unitBytesuintThe unit size in bytes.
Returns
- ChdHeaderV5
A new ChdHeaderV5 configured for a raw image.
CreateRaw(uint[], ulong, uint, uint)
Creates a header for a compressed CHD image with up to 4 codecs.
public static ChdHeaderV5 CreateRaw(uint[] compressors, ulong logicalBytes, uint hunkBytes, uint unitBytes)
Parameters
compressorsuint[]The compressor codec tags (up to 4; empty slots use None).
logicalBytesulongThe total logical size in bytes.
hunkBytesuintThe hunk size in bytes.
unitBytesuintThe unit size in bytes.
Returns
- ChdHeaderV5
A new ChdHeaderV5 configured for the image.
Deserialize(byte[])
Deserializes a CHD v5 header from a byte array.
public static ChdHeaderV5 Deserialize(byte[] data)
Parameters
databyte[]The raw header bytes (at least 124 bytes).
Returns
- ChdHeaderV5
A ChdHeaderV5 populated from the data.
Serialize()
Serializes the header into a 124-byte array in big-endian format.
public byte[] Serialize()
Returns
- byte[]
A byte array containing the serialized header.
WriteToStream(Stream)
Writes the serialized header to a stream.
public void WriteToStream(Stream stream)
Parameters
streamStreamThe output stream to write to.