Class CommandInstanceBase
Base class with shared functionality for RegexCommandInstance and StandardCommandInstance.
Namespace: TehGM.Wolfringo.Commands.Initialization
Assembly: Wolfringo.Commands.dll
Syntax
public abstract class CommandInstanceBase
Remarks
This class was created for internal use.
Command instances might inherit from this class, but this is not required. If you want to use a shared abstraction for command instances, use ICommandInstance instead.
Constructors
| Improve this Doc View SourceCommandInstanceBase(MethodInfo, IEnumerable<ICommandRequirement>, String, Nullable<PrefixRequirement>, Nullable<Boolean>, Int32)
Creates a new command instance.
Declaration
public CommandInstanceBase(MethodInfo method, IEnumerable<ICommandRequirement> requirements, string prefixOverride, PrefixRequirement? prefixRequirementOverride, bool? caseSensitivityOverride, int timeout)
Parameters
Type | Name | Description |
---|---|---|
MethodInfo | method | Method that will be executed. |
IEnumerable<ICommandRequirement> | requirements | Execution requirements. |
String | prefixOverride | Prefix override; null for no overriding. |
Nullable<PrefixRequirement> | prefixRequirementOverride | Prefix requireent override; null for no overriding. |
Nullable<Boolean> | caseSensitivityOverride | Case sensitivity override; null for no overriding. |
Int32 | timeout | Timeout value for command execution. -1 for no timeout. |
Properties
| Improve this Doc View SourceCaseSensitivityOverride
Case sensitivity override; null for no overriding.
Declaration
public bool? CaseSensitivityOverride { get; }
Property Value
Type | Description |
---|---|
Nullable<Boolean> |
HandlerType
Type of the handler containing the command.
Declaration
public Type HandlerType { get; }
Property Value
Type | Description |
---|---|
Type |
Method
Method that will be executed.
Declaration
public MethodInfo Method { get; }
Property Value
Type | Description |
---|---|
MethodInfo |
Parameters
All command method's parameters.
Declaration
protected ParameterInfo[] Parameters { get; }
Property Value
Type | Description |
---|---|
ParameterInfo[] |
PrefixOverride
Prefix override; null for no overriding.
Declaration
public string PrefixOverride { get; }
Property Value
Type | Description |
---|---|
String |
PrefixRequirementOverride
Prefix requireent override; null for no overriding.
Declaration
public PrefixRequirement? PrefixRequirementOverride { get; }
Property Value
Type | Description |
---|---|
Nullable<PrefixRequirement> |
Requirements
Execution requirements.
Declaration
public IEnumerable<ICommandRequirement> Requirements { get; }
Property Value
Type | Description |
---|---|
IEnumerable<ICommandRequirement> |
Timeout
Timeout value for command execution.
Declaration
public TimeSpan Timeout { get; }
Property Value
Type | Description |
---|---|
TimeSpan |
Methods
| Improve this Doc View SourceCheckMatch(ICommandContext, out Int32, out CommandContextOptions)
Performs shared match checks.
Declaration
protected bool CheckMatch(ICommandContext context, out int startIndex, out CommandContextOptions options)
Parameters
Type | Name | Description |
---|---|---|
ICommandContext | context | Command context to check. |
Int32 | startIndex | The index of command start (after prefix). |
CommandContextOptions | options | Options for command context, with command's overrides applied. |
Returns
Type | Description |
---|---|
Boolean | True if all checks passed; otherwise false. |
GetOptionsForContext(ICommandContext)
Returns options for command context, with command's overrides applied.
Declaration
protected CommandContextOptions GetOptionsForContext(ICommandContext context)
Parameters
Type | Name | Description |
---|---|---|
ICommandContext | context | Command context in execution. |
Returns
Type | Description |
---|---|
CommandContextOptions | Options for command context, with command's overrides applied. |
InvokeCommandAsync(ParameterBuilderValues, IServiceProvider, Object, CancellationToken)
Builds command parameters and invokes the method.
Declaration
protected async Task<ICommandResult> InvokeCommandAsync(ParameterBuilderValues parameterBuilderValues, IServiceProvider services, object handler, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
ParameterBuilderValues | parameterBuilderValues | Values for parameter builder. |
IServiceProvider | services | Services provider for injecting parameters into command method. |
Object | handler | Handler object to execute the command method in. |
CancellationToken | cancellationToken | Cancellation token to cancel the execution. |
Returns
Type | Description |
---|---|
Task<ICommandResult> | Result of the execution. |