Table of Contents

Class SimpleCommandFactory

Namespace
Core.Commands
Assembly
Core.dll

Auto-generates ICommandFactory wrappers for SimpleCommand classes. Handles argument parsing based on [Arg] attributes.

public class SimpleCommandFactory : ICommandFactory
Inheritance
object
SimpleCommandFactory
Implements

Properties

Metadata

public CommandAttribute Metadata { get; }

Property Value

CommandAttribute

Methods

Create(Type)

Create a factory for a SimpleCommand type.

public static SimpleCommandFactory Create(Type commandType)

Parameters

commandType Type

Returns

SimpleCommandFactory

DiscoverAndRegister(CommandRegistry, params Assembly[])

Discover all SimpleCommand types in assemblies and register with CommandRegistry.

public static void DiscoverAndRegister(CommandRegistry registry, params Assembly[] assemblies)

Parameters

registry CommandRegistry
assemblies Assembly[]

TryCreateCommand(string[], GameState, out ICommand, out string)

Try to create a command from parsed arguments.

public bool TryCreateCommand(string[] inputArgs, GameState gameState, out ICommand command, out string errorMessage)

Parameters

inputArgs string[]
gameState GameState

GameState for validation/lookups

command ICommand

Created command if successful

errorMessage string

Error message if failed

Returns

bool

True if command created successfully