Skip to content

PackContainer ​

A class that loads and manages a game pack instance.

Kind: Class

Namespace: CrowdControl.Games

Inheritance: IDisposable → IEffectCallbacks

Public Member Functions

void

Dispose()

Clean up any resources being used.

void

Unload()

Unload the domain containing the assembly

bool

TryGetPack(string packName, UserRecord identity, IEffectPack out pack)

Load the pack assembly and create an instance of the pack.

bool

TryGetPack(string packName, UserRecord identity, JObject packState, IEffectPack out pack)

Load the pack assembly and create an instance of the pack.

Task>

TryLoadConnector(Type connectorType, uint attemptCount, SITimeSpan retryInterval, object[] parameters)

Tries to load a connector of the specified type.

bool

IsType(Type type, bool unbound = true)

Checks if the loaded pack is of the specified type.

bool

TryGetPackState(string out json, Formatting formatting = None)

Tries to get the current state of the loaded pack as a JSON string.

bool

TryGetPackState(JObject out jObject)

Tries to get the current state of the loaded pack as a JSON string.

bool

TrySetPackState(string json)

Tries to set the state of the loaded pack from a JSON string.

bool

TrySetPackState(JObject jObject)

Tries to set the state of the loaded pack from a JSON string.

Public Static Functions

bool

IsPackAssembly(byte[] assemblyBytes)

Checks if the provided assembly bytes are a valid pack assembly.

PackContainer

LoadAssembly(byte[] assemblyBytes, bool checkSignature)

Loads an assembly from a byte array.

Properties

byte[]

AssemblyData

[get, ]

The assembly data of the loaded pack.

AssemblyLoadContext

Context

[get, ]

The assembly load context for the loaded pack.

Assembly

Assembly

[get, ]

The assembly of the loaded pack.

AssemblyName

AssemblyName

[get, ]

The name of the loaded pack assembly.

List

Packs

[get, ]

The list of pack names in the loaded assembly.

EffectPack

LoadedPack

[get, ]

The loaded pack instance.

Type

PackType

[get, ]

The type of the loaded pack.

Func

Receiver

[get, set]

The method to call when a message is received from the game.

IGUIProvider

DialogProvider

[get, set]

The GUI provider for the loaded pack.

bool

TestMode

[get, set]

Set to true to run the pack in test mode, which allows for testing without CrowdControl.Games.PackContainer.Receiver being set.

IGameConnector

Connector

[get, ]

List>

MenuActions

[get, ]

Get the list of menu actions available in the loaded pack.

ValueTuple

LastConnectionState

[get, ]

The most recent connection state emitted by the connector.

Events

Action<CrowdControlBlock>

MessageReceived

Called when a message is received from the game.

EventHandler

ConnectorReady

Called when the connector is ready.

Action<string>

ConnectionError

Called when a connection error occurs.

EventHandler<ValueTuple<ConnectionStatus, string>>

ConnectionStatusChanged

Called when the connection status of the connector changes.

EventHandler<PackStatus>

PackStateChanged

Called when the effect pack state changes.

EventHandler<GameState>

GameStateChanged

Called when the game state changes.

Action<IEnumerable<KeyValuePair<string, object>>>

MetadataChanged

Called when the game metadata changes.

Action<EffectRequest>

OnEffect

Called when an effect is requested.

Action<EffectRequest, SITimeSpan>

OnEffectStart

Called when an effect is started.

Action<EffectRequest>

OnEffectStop

Called when an effect is stopped.

Action<EffectRequest>

OnEffectPause

Called when an effect is paused.

Action<EffectRequest, SITimeSpan>

OnEffectResume

Called when an effect is resumed.

Action<EffectRequest>

OnEffectQueue

Called when an effect is queued.

Action<EffectRequest>

OnEffectDequeue

Called when an effect is dequeued.

Action

OnStopAllEffects

Called when all effects are stopped.

Action<string, string, IEnumerable<string>>

OnEffectDataDesynchronized

Called when the effect data is desynchronized.

Action<VersionNumber>

RemoteVersionReceived

Called when the remote mod version is received.