Table of Contents

Class CommandFactory

Namespace
DuetControlServer.Commands
Assembly
DuetControlServer.dll

Factory to create command instances

public class CommandFactory
Inheritance
CommandFactory
Inherited Members

Constructors

CommandFactory(IServiceProvider)

Factory to create command instances

public CommandFactory(IServiceProvider serviceProvider)

Parameters

serviceProvider IServiceProvider

Service provider

Methods

Create(string, JsonElement, Type[])

Create a new command instance from the given JSON data

public BaseCommand Create(string commandName, JsonElement commandData, Type[] supportedCommands)

Parameters

commandName string

Command name

commandData JsonElement

Command data

supportedCommands Type[]

List of supported command types

Returns

BaseCommand

Command instance

Exceptions

ArgumentException

Unsupported command

Create(string, ref Utf8JsonReader, Type[])

Create a new command instance from the given JSON reader

public BaseCommand Create(string commandName, ref Utf8JsonReader reader, Type[] supportedCommands)

Parameters

commandName string

Command name

reader Utf8JsonReader

JSON reader

supportedCommands Type[]

List of supported command types

Returns

BaseCommand

Command instance

Exceptions

ArgumentException

Unsupported command

Create(Type)

Create a new command instance

public BaseCommand Create(Type type)

Parameters

type Type

Command type

Returns

BaseCommand

Command instance

Exceptions

ArgumentException

Unsupported command

Create<T>()

Create a new command instance

public T Create<T>() where T : BaseCommand

Returns

T

Command instance

Type Parameters

T

Command type