private MatchContext DoesMatch(MethodReference method)
        {
            MatchContext context = null;

            if (!this.myEventNames.Contains(method.Name))
            {
                return(context);
            }

            foreach (var searchEvent in this.myEvents)
            {
                if (method.IsEqual(searchEvent.AddMethod, false))
                {
                    context = new MatchContext(AddEventReason, this.GetPrettyEventName(searchEvent));
                    context[DefiningAssemblyKey] = searchEvent.DeclaringType.Module.FullyQualifiedName;
                    break;
                }

                if (method.IsEqual(searchEvent.RemoveMethod, false))
                {
                    context = new MatchContext(RemoveEventReason, this.GetPrettyEventName(searchEvent));
                    context[DefiningAssemblyKey] = searchEvent.DeclaringType.Module.FullyQualifiedName;
                    break;
                }
            }

            return(context);
        }
Exemplo n.º 2
0
        MatchContext DoesMatch(MethodReference method)
        {
            MatchContext context = null;

            if (!myEventNames.Contains(method.Name))
            {
                return(context);
            }

            foreach (EventDefinition searchEvent in myEvents)
            {
                if (method.IsEqual(searchEvent.AddMethod, false))
                {
                    context = new MatchContext(AddEventReason, GetPrettyEventName(searchEvent));
                    context[DefiningAssemblyKey] = searchEvent.DeclaringType.Module.Image.FileInformation.Name;
                    break;
                }

                if (method.IsEqual(searchEvent.RemoveMethod, false))
                {
                    context = new MatchContext(RemoveEventReason, GetPrettyEventName(searchEvent));
                    context[DefiningAssemblyKey] = searchEvent.DeclaringType.Module.Image.FileInformation.Name;
                    break;
                }
            }

            return(context);
        }
Exemplo n.º 3
0
        bool IsMatchingMethod(MethodReference methodReference, out MethodDefinition matchingMethod)
        {
            bool lret = false;

            matchingMethod = null;

            string declaringType = "";

            if (methodReference != null && methodReference.DeclaringType != null &&
                methodReference.DeclaringType.GetOriginalType() != null)
            {
                declaringType = methodReference.DeclaringType.GetOriginalType().Name;
            }

            List <MethodDefinition> typeMethods = null;

            if (myMethodNames.TryGetValue(declaringType, out typeMethods))
            {
                foreach (MethodDefinition searchMethod in typeMethods)
                {
                    if (methodReference.IsEqual(searchMethod, false))
                    {
                        lret           = true;
                        matchingMethod = searchMethod;
                        break;
                    }
                }
            }

            return(lret);
        }
Exemplo n.º 4
0
        private bool IsMatchingMethod(MethodReference methodReference, out MethodDefinition matchingMethod)
        {
            var lret = false;

            matchingMethod = null;

            var declaringType = "";

            if (methodReference != null && methodReference.DeclaringType != null && methodReference.DeclaringType.GetElementType() != null)
            {
                declaringType = methodReference.DeclaringType.GetElementType().Name;
            }

            List <MethodDefinition> typeMethods = null;

            if (this.myMethodNames.TryGetValue(declaringType, out typeMethods))
            {
                foreach (var searchMethod in typeMethods)
                {
                    if (methodReference.IsEqual(searchMethod, false))
                    {
                        lret           = true;
                        matchingMethod = searchMethod;
                        break;
                    }
                }
            }

            return(lret);
        }
Exemplo n.º 5
0
 public static bool IsEqual(this MethodReference x, MethodReference y)
 {
     return(x.IsEqual(y, true));
 }