Class SimDataSchema
Represents the schema of a SimDataObject (🔒)
public sealed class SimDataSchema
- Inheritance
-
SimDataSchema
- Inherited Members
Remarks
The order of Columns is the order in which the columns' values are laid out in each row.
For schemas the game reads with a fixed layout (e.g. Client_ and Renderer. schemas), this order must match the game's, which is why Decode(ReadOnlyMemory<byte>) preserves it.
The game derives a schema's hash from its name and layout (see ComputedHash), so changing the columns or their order changes the hash the game expects.
Constructors
SimDataSchema(string, IEnumerable<SimDataColumn>)
Initializes a new SimDataSchema whose Hash is its ComputedHash
public SimDataSchema(string name, IEnumerable<SimDataColumn> columns)
Parameters
namestringThe name of the schema
columnsIEnumerable<SimDataColumn>The columns of the schema, in layout order
Exceptions
- ArgumentException
columnsis empty, contains null, or contains two columns with the same name
SimDataSchema(string, uint, IEnumerable<SimDataColumn>)
Initializes a new SimDataSchema
public SimDataSchema(string name, uint hash, IEnumerable<SimDataColumn> columns)
Parameters
namestringThe name of the schema
hashuintThe hash identifying the schema
columnsIEnumerable<SimDataColumn>The columns of the schema, in layout order
Exceptions
- ArgumentException
columnsis empty, contains null, or contains two columns with the same name
Properties
Columns
Gets the columns of the schema, in layout order
public IReadOnlyList<SimDataColumn> Columns { get; }
Property Value
ComputedHash
public uint ComputedHash { get; }
Property Value
Remarks
The game computes this as the sum of the Fnv32 hash of the lowercased name, the row size shifted left 16 bits, the number of columns, and, for each column, the Fnv32 hash of its lowercased name XOR its type shifted left 16 bits XOR its offset in the row shifted left 8 bits. Column flags do not contribute.
Hash
Gets the hash identifying the schema
public uint Hash { get; }
Property Value
Name
Gets the name of the schema
public string Name { get; }
Property Value
Methods
GetColumnIndex(string)
Gets the index of the column with the specified name, or null if there is no such column
public int? GetColumnIndex(string name)
Parameters
namestring
Returns
- int?