Class RecordBundle
Represents a record bundle: a set of records, each a ResourceKey and its content, in the LDNB container format (🔓)
public sealed class RecordBundle
- Inheritance
-
RecordBundle
- Inherited Members
Remarks
The game stores lot architecture in this container, as the content of a WorldLotArchitecture resource in world files, of the architecture data of a lot in a save game, and of the architecture of a tray blueprint. Each lot architecture section is one record, keyed by the section's type, group zero and a fixed instance. Encode() lays the bundle out the way Maxis does: records grouped by type and group in ascending order, keeping their order within a group, so decoding and encoding a bundle Maxis wrote reproduces it byte for byte.
Properties
Count
Gets the number of records in the bundle
public int Count { get; }
Property Value
Records
Gets the records in the bundle, in the order Encode() would write them
public IReadOnlyList<RecordBundleRecord> Records { get; }
Property Value
Reserved1
Gets/sets the first reserved header value, which the game does not read (zero in every bundle observed)
public uint Reserved1 { get; set; }
Property Value
Reserved2
Gets/sets the second reserved header value, which the game does not read (zero in every bundle observed)
public uint Reserved2 { get; set; }
Property Value
Methods
Decode(ReadOnlyMemory<byte>)
Decodes a record bundle
public static RecordBundle Decode(ReadOnlyMemory<byte> data)
Parameters
dataReadOnlyMemory<byte>
Returns
Exceptions
- InvalidDataException
The data is not a well-formed little-endian version 3 record bundle, or two of its records have the same key
Encode()
Encodes the record bundle
public ReadOnlyMemory<byte> Encode()
Returns
Exceptions
- InvalidOperationException
The content of the records totals more than 16,777,215 bytes, the most the format can address
Get(ResourceKey)
Gets the content of the record with the specified key
public ReadOnlyMemory<byte> Get(ResourceKey key)
Parameters
keyResourceKey
Returns
Exceptions
- KeyNotFoundException
The bundle has no record with the specified
key
Remove(ResourceKey)
Removes the record with the specified key, returning whether there was one
public bool Remove(ResourceKey key)
Parameters
keyResourceKey
Returns
Set(ResourceKey, ReadOnlyMemory<byte>)
Sets the content of the record with the specified key, adding the record if the bundle has none with that key
public void Set(ResourceKey key, ReadOnlyMemory<byte> data)
Parameters
keyResourceKeydataReadOnlyMemory<byte>
TryGet(ResourceKey, out ReadOnlyMemory<byte>)
Gets the content of the record with the specified key, returning whether there was one
public bool TryGet(ResourceKey key, out ReadOnlyMemory<byte> data)
Parameters
keyResourceKeydataReadOnlyMemory<byte>