ResourceLoadContextclass
Lets a `Sandbox.Resource` read from its compiled file while the file data is in memory, during `Sandbox.Resource.OnLoaded(Sandbox.ResourceLoadContext)`. Blocks are written at compile time, eg with `Sandbox.Resources.ResourceCompileContext.WriteBlockJson(System.String,System.Object)`. Only valid during the call - copy out anything you want to keep.
Methods4
Showing 4 methods
public bool Exists(string blockName)
Does the compiled file contain this block? Block names are four character codes, eg "LIPS".
| Parameter | Type | Description |
|---|---|---|
| blockName | string | — |
bool—public System.ReadOnlySpan`1<byte> ReadData(string blockName)
Read a named block's data. The span points directly into the loaded file, so it's only valid during `Sandbox.Resource.OnLoaded(Sandbox.ResourceLoadContext)` - copy anything you want to keep.
| Parameter | Type | Description |
|---|---|---|
| blockName | string | — |
ReadOnlySpan<byte>—public T ReadJson(string blockName, T defaultValue = null)
Read a named block as json, eg `context.ReadJson>( "LIPS" )`.
| Parameter | Type | Description |
|---|---|---|
| blockName | string | — |
| defaultValue = null | T | — |
T—public string ReadString(string blockName)
Read a named block as a utf-8 string, or null if the block doesn't exist.
| Parameter | Type | Description |
|---|---|---|
| blockName | string | — |
string—No results match this filter.