public HookMethod(MethodInfo methodInfo, Assembly targetLibAssembly) { var targetHookType = targetLibAssembly.GetType(typeof(FilteredHookAttribute).FullName); _methodInfo = methodInfo; dynamic filteredHookAttribute = _methodInfo.GetCustomAttribute(targetHookType); if (filteredHookAttribute == null) { return; } FilterTags = filteredHookAttribute.FilterTags; var targetTagBehaviourType = targetLibAssembly.GetType(typeof(TagAggregationBehaviourAttribute).FullName); dynamic tagAggregationBehaviourAttribute = _methodInfo.GetCustomAttribute(targetTagBehaviourType); var setTagAggregation = TagAggregation.And; if (!ReferenceEquals(tagAggregationBehaviourAttribute, null)) { Enum.TryParse((string)tagAggregationBehaviourAttribute.TagAggregation.ToString(), true, out setTagAggregation); } TagAggregation = setTagAggregation; }
/// <summary> /// <para>Tell Gauge to look for hooks that have either all or one of the tags specified.</para> /// <para>To be used when specifying multiple tags in a hook</para> /// </summary> /// <param name="tagAggregation">Tells Gauge to use all or any one of the tags.</param> public TagAggregationBehaviourAttribute(TagAggregation tagAggregation = TagAggregation.And) { _tagAggregation = tagAggregation; }