Class WorldLotArchitectureModel
Represents a WorldLotArchitecture resource: the architecture of a lot template in a world file, as a RecordBundle (🔓)
public sealed class WorldLotArchitectureModel : Model, IModel<WorldLotArchitectureModel>, IModel
- Inheritance
-
WorldLotArchitectureModel
- Implements
- Inherited Members
Remarks
A world file is a package (see DataBasePackedFile); this models one of the resources in it, not the file. The game names the resource after the lot template it belongs to; see GetKey(uint).
Constructors
WorldLotArchitectureModel()
Initializes a new instance of the WorldLotArchitectureModel class with an empty Bundle
public WorldLotArchitectureModel()
Properties
Bundle
Gets the record bundle holding the lot's architecture
public RecordBundle Bundle { get; }
Property Value
ResourceName
Gets the name of this resource if it has one
public override string? ResourceName { get; }
Property Value
SupportedTypes
Gets a list of resource types that this model supports
public static ISet<ResourceType> SupportedTypes { get; }
Property Value
Methods
Decode(ReadOnlyMemory<byte>)
Decodes the resource in raw format to produce an operable model (🔄️🏃)
public static WorldLotArchitectureModel Decode(ReadOnlyMemory<byte> data)
Parameters
dataReadOnlyMemory<byte>
Returns
Exceptions
- InvalidDataException
The data is not a length-prefixed record bundle, or the bundle is not well-formed
Encode()
Encodes the resource model into raw format (🔄️🏃)
public override ReadOnlyMemory<byte> Encode()
Returns
GetKey(uint)
Gets the key of the WorldLotArchitecture resource of the lot template with the specified lotTemplateId
public static ResourceKey GetKey(uint lotTemplateId)
Parameters
lotTemplateIduint
Returns
Remarks
The game derives the key from a file name: the instance is the FNV-1 64-bit hash of 1- followed by the lot template id in eight lowercase hexadecimal digits, and the type is the FNV-1 32-bit hash of the extension dat.
The WorldLotObjects resource of the same lot template has the same instance.
GetLotTemplateInstance(uint)
Gets the instance the game gives the WorldLotArchitecture and WorldLotObjects resources of the lot template with the specified lotTemplateId
public static ulong GetLotTemplateInstance(uint lotTemplateId)
Parameters
lotTemplateIduint
Returns
GetName(Stream)
Gets the name of a resource from its raw data, if it has one (🔄️💤)
public static string? GetName(Stream stream)
Parameters
streamStream
Returns
GetNameAsync(Stream, CancellationToken)
Gets the name of a resource from its raw data, if it has one, asynchronously (🔄️💤)
public static Task<string?> GetNameAsync(Stream stream, CancellationToken cancellationToken = default)
Parameters
streamStreamcancellationTokenCancellationToken