Empeld
Empeld plugin documentation.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events
pluginbase.Helpers.Attributes.Hooks Class Reference

Static Public Member Functions

static IEnumerable< MethodInfo > ResolveHookMethods (this Type type, Enum hook, Enum scope=null)
 Finds all methods with properly defined hook and scope on it Ordered from base class up More...
 
static IEnumerable< MethodInfo > ResolveHookMethods (object obj, Enum hook, Enum scope=null)
 Resolve all methods from an object with defined hook and scope Ordered from base class up More...
 

Member Function Documentation

static IEnumerable<MethodInfo> pluginbase.Helpers.Attributes.Hooks.ResolveHookMethods ( this Type  type,
Enum  hook,
Enum  scope = null 
)
static

Finds all methods with properly defined hook and scope on it Ordered from base class up

Returns
The hook methods.
Parameters
typeType.
hookHook.
scopeScope.
21  {
22  foreach(var method in type.GetAllMethods(x => Attribute.IsDefined(x, typeof(HookAttribute))).Reverse() )
23  {
24  foreach(var attr in method.GetCustomAttributes(typeof(HookAttribute), true).OfType<HookAttribute>())
25  {
26  if (attr.HasScope(scope) && attr.IsHookedTo(hook))
27  {
28  yield return method;
29  break;
30  }
31  }
32  }
33  }
static IEnumerable<MethodInfo> pluginbase.Helpers.Attributes.Hooks.ResolveHookMethods ( object  obj,
Enum  hook,
Enum  scope = null 
)
static

Resolve all methods from an object with defined hook and scope Ordered from base class up

Returns
The hook methods.
Parameters
objObject.
hookHook.
scopeScope.
44  {
45  return Hooks.ResolveHookMethods(obj.GetType(), hook, scope);
46  }

The documentation for this class was generated from the following file: