Class BrainSerializer<TState, TBot, TAction, TBrain>
A helper class for loading and saving bot brains.
Inheritance
Inherited Members
Namespace: Microsoft.XboxStudios.BotBrain.Composition
Assembly: BotBrain.Core.dll
Syntax
public class BrainSerializer<TState, TBot, TAction, TBrain> : BrainSerializerBase<TState, TBot, TAction>, IBrainSerializer, ITitleResourceHelper, IResourceHelper, IMetadataAccess where TBot : IAutomatedBot<TAction> where TBrain : IBotBrain
Type Parameters
Name | Description |
---|---|
TState | A title-specific state object. |
TBot | A title-specific bot object that implements IAutomatedBot<TAction>. |
TAction | The title-specific bot action. |
TBrain | The title-specific brain that implements IBotBrain. |
Remarks
Initializes a new instance of the BrainSerializer<TState, TBot, TAction, TBrain> class.
Constructors
View SourceBrainSerializer(IServiceProvider, ILogger<BrainSerializer<TState, TBot, TAction, TBrain>>?, string?, Assembly?)
A helper class for loading and saving bot brains.
Declaration
public BrainSerializer(IServiceProvider services, ILogger<BrainSerializer<TState, TBot, TAction, TBrain>>? logger = null, string? outputFolder = null, Assembly? brainAssembly = null)
Parameters
Type | Name | Description |
---|---|---|
IServiceProvider | services | The service provider used for construction. |
ILogger<BrainSerializer<TState, TBot, TAction, TBrain>> | logger | The logger to use. |
string | outputFolder | The folder path containing brain resources. |
Assembly | brainAssembly | The assembly containing brain types to register and resources to extract. |
Remarks
Initializes a new instance of the BrainSerializer<TState, TBot, TAction, TBrain> class.
Properties
View SourceJsonConverters
Gets the JSON converters for serializing and deserializing bot brains.
Declaration
protected override IEnumerable<JsonConverter> JsonConverters { get; }
Property Value
Type | Description |
---|---|
IEnumerable<JsonConverter> |
Overrides
Methods
View SourceDeserializeBrain(string)
Deserializes a brain from a string.
Declaration
public override IBotBrain DeserializeBrain(string contents)
Parameters
Type | Name | Description |
---|---|---|
string | contents | A string representation of a brain. |
Returns
Type | Description |
---|---|
IBotBrain | The brain. |