|
@ -1,8 +1,4 @@ |
|
|
using System; |
|
|
using System; |
|
|
using System.Collections.Generic; |
|
|
|
|
|
using System.Linq; |
|
|
|
|
|
using System.Text; |
|
|
|
|
|
using System.Threading.Tasks; |
|
|
|
|
|
|
|
|
|
|
|
namespace IPA |
|
|
namespace IPA |
|
|
{ |
|
|
{ |
|
@ -18,24 +14,84 @@ namespace IPA |
|
|
|
|
|
|
|
|
// TODO: is there a better way to manage this mess?
|
|
|
// TODO: is there a better way to manage this mess?
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Indicates that the target method should be called when the plugin is enabled.
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <remarks>
|
|
|
|
|
|
/// <para>
|
|
|
|
|
|
/// This attribute is interchangable with <see cref="OnStartAttribute"/>, and is treated identically.
|
|
|
|
|
|
/// They are seperate to allow plugin code to more clearly describe the intent of the methods.
|
|
|
|
|
|
/// </para>
|
|
|
|
|
|
/// <para>
|
|
|
|
|
|
/// Typically, this will be used when the <see cref="RuntimeOptions"/> parameter of the plugins's
|
|
|
|
|
|
/// <see cref="PluginAttribute"/> is <see cref="RuntimeOptions.DynamicInit"/>.
|
|
|
|
|
|
/// </para>
|
|
|
|
|
|
/// </remarks>
|
|
|
|
|
|
/// <seealso cref="PluginAttribute"/>
|
|
|
|
|
|
/// <seealso cref="OnStartAttribute"/>
|
|
|
[AttributeUsage(AttributeTargets.Method, AllowMultiple = false, Inherited = false)] |
|
|
[AttributeUsage(AttributeTargets.Method, AllowMultiple = false, Inherited = false)] |
|
|
public sealed class OnEnableAttribute : Attribute, IEdgeLifecycleAttribute |
|
|
public sealed class OnEnableAttribute : Attribute, IEdgeLifecycleAttribute |
|
|
{ |
|
|
{ |
|
|
EdgeLifecycleType IEdgeLifecycleAttribute.Type => EdgeLifecycleType.Enable; |
|
|
EdgeLifecycleType IEdgeLifecycleAttribute.Type => EdgeLifecycleType.Enable; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Indicates that the target method should be called when the game starts.
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <remarks>
|
|
|
|
|
|
/// <para>
|
|
|
|
|
|
/// This attribute is interchangable with <see cref="OnEnableAttribute"/>, and is treated identically.
|
|
|
|
|
|
/// They are seperate to allow plugin code to more clearly describe the intent of the methods.
|
|
|
|
|
|
/// </para>
|
|
|
|
|
|
/// <para>
|
|
|
|
|
|
/// Typically, this will be used when the <see cref="RuntimeOptions"/> parameter of the plugins's
|
|
|
|
|
|
/// <see cref="PluginAttribute"/> is <see cref="RuntimeOptions.SingleStartInit"/>.
|
|
|
|
|
|
/// </para>
|
|
|
|
|
|
/// </remarks>
|
|
|
|
|
|
/// <seealso cref="PluginAttribute"/>
|
|
|
|
|
|
/// <seealso cref="OnEnableAttribute"/>
|
|
|
[AttributeUsage(AttributeTargets.Method, AllowMultiple = false, Inherited = false)] |
|
|
[AttributeUsage(AttributeTargets.Method, AllowMultiple = false, Inherited = false)] |
|
|
public sealed class OnStartAttribute : Attribute, IEdgeLifecycleAttribute |
|
|
public sealed class OnStartAttribute : Attribute, IEdgeLifecycleAttribute |
|
|
{ |
|
|
{ |
|
|
EdgeLifecycleType IEdgeLifecycleAttribute.Type => EdgeLifecycleType.Enable; |
|
|
EdgeLifecycleType IEdgeLifecycleAttribute.Type => EdgeLifecycleType.Enable; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Indicates that the target method should be called when the plugin is disabled.
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <remarks>
|
|
|
|
|
|
/// <para>
|
|
|
|
|
|
/// This attribute is interchangable with <see cref="OnExitAttribute"/>, and is treated identically.
|
|
|
|
|
|
/// They are seperate to allow plugin code to more clearly describe the intent of the methods.
|
|
|
|
|
|
/// </para>
|
|
|
|
|
|
/// <para>
|
|
|
|
|
|
/// Typically, this will be used when the <see cref="RuntimeOptions"/> parameter of the plugins's
|
|
|
|
|
|
/// <see cref="PluginAttribute"/> is <see cref="RuntimeOptions.DynamicInit"/>.
|
|
|
|
|
|
/// </para>
|
|
|
|
|
|
/// </remarks>
|
|
|
|
|
|
/// <seealso cref="PluginAttribute"/>
|
|
|
|
|
|
/// <seealso cref="OnExitAttribute"/>
|
|
|
[AttributeUsage(AttributeTargets.Method, AllowMultiple = false, Inherited = false)] |
|
|
[AttributeUsage(AttributeTargets.Method, AllowMultiple = false, Inherited = false)] |
|
|
public sealed class OnDisableAttribute : Attribute, IEdgeLifecycleAttribute |
|
|
public sealed class OnDisableAttribute : Attribute, IEdgeLifecycleAttribute |
|
|
{ |
|
|
{ |
|
|
EdgeLifecycleType IEdgeLifecycleAttribute.Type => EdgeLifecycleType.Disable; |
|
|
EdgeLifecycleType IEdgeLifecycleAttribute.Type => EdgeLifecycleType.Disable; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Indicates that the target method should be called when the game exits.
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <remarks>
|
|
|
|
|
|
/// <para>
|
|
|
|
|
|
/// This attribute is interchangable with <see cref="OnDisableAttribute"/>, and is treated identically.
|
|
|
|
|
|
/// They are seperate to allow plugin code to more clearly describe the intent of the methods.
|
|
|
|
|
|
/// </para>
|
|
|
|
|
|
/// <para>
|
|
|
|
|
|
/// Typically, this will be used when the <see cref="RuntimeOptions"/> parameter of the plugins's
|
|
|
|
|
|
/// <see cref="PluginAttribute"/> is <see cref="RuntimeOptions.SingleStartInit"/>.
|
|
|
|
|
|
/// </para>
|
|
|
|
|
|
/// </remarks>
|
|
|
|
|
|
/// <seealso cref="PluginAttribute"/>
|
|
|
|
|
|
/// <seealso cref="OnDisableAttribute"/>
|
|
|
[AttributeUsage(AttributeTargets.Method, AllowMultiple = false, Inherited = false)] |
|
|
[AttributeUsage(AttributeTargets.Method, AllowMultiple = false, Inherited = false)] |
|
|
public sealed class OnExitAttribute : Attribute, IEdgeLifecycleAttribute |
|
|
public sealed class OnExitAttribute : Attribute, IEdgeLifecycleAttribute |
|
|
{ |
|
|
{ |
|
|