Wolfringo Wolfringo
Wolfringo Wolfringo
Wolfringo (c) 2020 TehGM
DocFX, DiscordFX theme.
Search Results for

    Class ArgumentConverterProvider

    Provides a command argument converter.

    Inheritance
    System.Object
    ArgumentConverterProvider
    Implements
    IArgumentConverterProvider
    System.IDisposable
    Namespace: TehGM.Wolfringo.Commands.Parsing
    Assembly: Wolfringo.Commands.dll
    Syntax
    public class ArgumentConverterProvider : IArgumentConverterProvider, IDisposable
    Remarks

    This default command argument converter provider is designed to match a type to a converter, and automatically handle enums.

    Besides enums, all converters simply match the type. If your custom converter uses complex logic in its CanConvert(ParameterInfo) method, please create own provider class, or inherit from this class.

    Constructors

    | Improve this Doc View Source

    ArgumentConverterProvider()

    Creates default converter provider with default options.

    Declaration
    public ArgumentConverterProvider()
    | Improve this Doc View Source

    ArgumentConverterProvider(ArgumentConverterProviderOptions)

    Creates default converter provider.

    Declaration
    public ArgumentConverterProvider(ArgumentConverterProviderOptions options)
    Parameters
    Type Name Description
    ArgumentConverterProviderOptions options

    Properties

    | Improve this Doc View Source

    DisposeConverters

    Whether this provider will dispose converters.

    Declaration
    protected bool DisposeConverters { get; }
    Property Value
    Type Description
    System.Boolean
    Remarks

    This will be set to true if Options weren't provided to the constructor.

    Disposing will happen when Dispose() is called.

    | Improve this Doc View Source

    Options

    Options used by this provider.

    Declaration
    protected ArgumentConverterProviderOptions Options { get; }
    Property Value
    Type Description
    ArgumentConverterProviderOptions

    Methods

    | Improve this Doc View Source

    Dispose()

    Disposes the provider.

    Declaration
    public virtual void Dispose()
    Remarks

    If any of the mapped converters implements System.IDisposable, it'll also be disposed, unless options were provided via constructor from external source.

    | Improve this Doc View Source

    GetConverter(ParameterInfo)

    Gets a converter for the parameter.

    Declaration
    public virtual IArgumentConverter GetConverter(ParameterInfo parameter)
    Parameters
    Type Name Description
    System.Reflection.ParameterInfo parameter

    Parameter to convert.

    Returns
    Type Description
    IArgumentConverter

    A converter for provided parameter.

    Implements

    IArgumentConverterProvider
    System.IDisposable