OapFormat
- Namespace: Turian.Engine.Core
- Source File: OapFormat.cs
On-disk constants and structures for the Open Asset Package (.oap) container format, version 1.0. This type is the single source of truth for the byte-level layout described in the OAP specification; it performs no I/O.
Remarks
All multi-byte integers are little-endian. Offsets and sizes are absolute byte counts from the start of the file. See OapWriter and OapReader for the code that produces and consumes these structures.
Fields
FileExtension (string) = ".oap": File extension of an Open Asset Package.
FormatMajor (ushort) = 1: Major format version emitted and accepted by this implementation.
FormatMinor (ushort) = 0: Minor format version emitted by this implementation.
HeaderSize (int) = 64: Fixed size of the file header, in bytes.
IndexEntrySize (int) = 64: Fixed size of a single index entry, in bytes.
AssetIdSize (int) = 16: Size of a 128-bit asset identifier, in bytes.
HeaderCrcCoverage (int) = 60: Number of leading header bytes covered by the header CRC-32.
Properties
Magic
(ReadOnlySpanOAP followed by 0x01.
Public Methods
WriteAssetId
public static void WriteAssetId(Guid id, Span<byte> destination)
Maps a Guid to the 16 raw bytes stored in an index entry, using RFC 4122 (big-endian) field order so the lexicographic index sort matches the canonical UUID string order and is independent of the host's endianness.
Parameters:
id(Guid): The asset identifier.destination(Span): A span of at least AssetIdSizebytes.
ReadAssetId
public static Guid ReadAssetId(ReadOnlySpan<byte> source)
Reads a Guid from the 16 raw bytes of an index entry.
Parameters:
source(ReadOnlySpan): A span of at least AssetIdSizebytes.
Returns: Guid
- The decoded asset identifier.
Crc32
public static uint Crc32(ReadOnlySpan<byte> data)
Computes the CRC-32/ISO-HDLC checksum used throughout the format.
Parameters:
data(ReadOnlySpan): The bytes to checksum.
Returns: uint
- The CRC-32 value.