コード例 #1
0
        private void IndexAbstractMethods(ModuleDefinition module)
        {
            var abstractMethods = DecompilerService.GetAbstractMethods(module);

            foreach (var method in abstractMethods)
            {
                AbstractMethodsIndexedByName.Add(SignatureKeyService.GetFullMethodSignature(method), method);
                AbstractMethodsIndexedByTypeName.Add(method.DeclaringType.FullName, method);
                AbstractMethodsList.Add(method);
            }
        }
コード例 #2
0
        private bool FindAbstractMethod(MethodDefinition method, MethodObject methodNode)
        {
            // TODO currently only looks at direct base type
            if (AbstractMethodsIndexedByTypeName.HasIndex(method.DeclaringType.BaseType.FullName))
            {
                var methodsOfAbstractParent = AbstractMethodsIndexedByTypeName.Get(method.DeclaringType.BaseType.FullName);
                var matchingMethod          = methodsOfAbstractParent.FirstOrDefault(x => SignatureKeyService.GetMethodSignature(x).Equals(SignatureKeyService.GetMethodSignature(method)));
                if (matchingMethod != null)
                {
                    methodNode.AbstractMethod = matchingMethod;
                    methodNode.ImplementsType = ImplementsType.Abstract;

                    return(true);
                }
            }

            return(false);
        }