Show / Hide Table of Contents

    Class Feature

    The root interface for a mod Feature.

    Inheritance
    Object
    Feature
    Inherited Members
    Object.ToString()
    Object.Equals(Object)
    Object.Equals(Object, Object)
    Object.ReferenceEquals(Object, Object)
    Object.GetHashCode()
    Object.GetType()
    Object.MemberwiseClone()
    Namespace: IPA.Loader.Features
    Assembly: IPA.Loader.dll
    Syntax
    public abstract class Feature
    Remarks

    Avoid storing any data in any subclasses. If you do, it may result in a failure to load the feature.

    Properties

    | Improve this Doc View Source

    InvalidMessage

    The message to be logged when the feature is not valid for a plugin. This should also be set whenever either BeforeLoad(PluginMetadata) or BeforeInit(PluginMetadata) returns false.

    Declaration
    public virtual string InvalidMessage { get; protected set; }
    Property Value
    Type Description
    String

    the message to show when the feature is marked invalid

    | Improve this Doc View Source

    StoreOnPlugin

    Defines whether or not this feature will be accessible from the plugin metadata once loaded.

    Declaration
    protected virtual bool StoreOnPlugin { get; }
    Property Value
    Type Description
    Boolean

    true if this Feature will be stored on the plugin metadata, false otherwise

    Methods

    | Improve this Doc View Source

    AfterInit(PluginMetadata)

    Called after a plugin has been fully initialized, whether or not there is an Init method. This should never throw an exception.

    Declaration
    public virtual void AfterInit(PluginMetadata plugin)
    Parameters
    Type Name Description
    PluginMetadata plugin

    the plugin that was just initialized

    | Improve this Doc View Source

    AfterInit(PluginMetadata, Object)

    Called after a plugin has been fully initialized, whether or not there is an Init method. This should never throw an exception.

    Declaration
    public virtual void AfterInit(PluginMetadata plugin, object pluginInstance)
    Parameters
    Type Name Description
    PluginMetadata plugin

    the plugin that was just initialized

    Object pluginInstance

    the instance of the plugin being initialized

    | Improve this Doc View Source

    BeforeInit(PluginMetadata)

    Called before a plugin's Init method is called. This will not be called if there is no Init method. This should never throw an exception. An exception will abort the loading of the plugin with an error.

    Declaration
    public virtual bool BeforeInit(PluginMetadata plugin)
    Parameters
    Type Name Description
    PluginMetadata plugin

    the plugin to be initialized

    Returns
    Type Description
    Boolean

    whether or not to call the Init method

    | Improve this Doc View Source

    BeforeLoad(PluginMetadata)

    Called before a plugin is loaded. This should never throw an exception. An exception will abort the loading of the plugin with an error.

    Declaration
    public virtual bool BeforeLoad(PluginMetadata plugin)
    Parameters
    Type Name Description
    PluginMetadata plugin

    the plugin about to be loaded

    Returns
    Type Description
    Boolean

    whether or not the plugin should be loaded

    Remarks

    The assembly will still be loaded, but the plugin will not be constructed if this returns false. Any features it defines, for example, will still be loaded.

    | Improve this Doc View Source

    Evaluate()

    Evaluates the Feature for use in conditional meta-Features. This should be re-calculated on every call, unless it can be proven to not change.

    This will be called on every feature that returns true from Initialize(PluginMetadata, String[])

    Declaration
    public virtual bool Evaluate()
    Returns
    Type Description
    Boolean

    the truthiness of the Feature.

    | Improve this Doc View Source

    Initialize(PluginMetadata, String[])

    Initializes the feature with the parameters provided in the definition.

    Note: When no parenthesis are provided, parameters is an empty array.

    Declaration
    public abstract bool Initialize(PluginMetadata meta, string[] parameters)
    Parameters
    Type Name Description
    PluginMetadata meta

    the metadata of the plugin that is being prepared

    String[] parameters

    the parameters passed to the feature definition, or null

    Returns
    Type Description
    Boolean

    true if the feature is valid for the plugin, false otherwise

    Remarks

    This gets called BEFORE your Init method.

    Returning false does not prevent the plugin from being loaded. It simply prevents the feature from being used.

    | Improve this Doc View Source

    RequireLoaded(PluginMetadata)

    Ensures a plugin's assembly is loaded. Do not use unless you need to.

    Declaration
    protected void RequireLoaded(PluginMetadata plugin)
    Parameters
    Type Name Description
    PluginMetadata plugin

    the plugin to ensure is loaded.

    Extension Methods

    ReflectionUtil.SetField<T, U>(T, String, U)
    ReflectionUtil.GetField<U, T>(T, String)
    ReflectionUtil.SetProperty<T, U>(T, String, U)
    ReflectionUtil.GetProperty<U, T>(T, String)
    ReflectionUtil.InvokeMethod<U, T>(T, String, Object[])
    • Improve this Doc
    • View Source
    Back to top Generated by DocFX