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
serviceProviderIServiceProviderService 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
commandNamestringCommand name
commandDataJsonElementCommand data
supportedCommandsType[]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
commandNamestringCommand name
readerUtf8JsonReaderJSON reader
supportedCommandsType[]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
typeTypeCommand 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
TCommand type