示例#1
0
        private RefTree GetRefTree(AssemblyDefinition assemblyDefinition)
        {
            var refTree = new RefTree();

            foreach (var typeReference in assemblyDefinition.MainModule.GetTypeReferences())
            {
                refTree.AddType(typeReference);
            }

            foreach (var memberReference in assemblyDefinition.MainModule.GetMemberReferences())
            {
                var scope = memberReference.DeclaringType.Scope;
                if (scope == null)
                {
                    continue;
                }

                if (scope.MetadataScopeType != MetadataScopeType.AssemblyNameReference)
                {
                    continue;
                }

                refTree.AddMember(memberReference);
            }

            return(refTree);
        }
示例#2
0
        private RefTree GetRefTree(AssemblyDefinition assemblyDefinition)
        {
            var refTree = new RefTree();

            foreach (var memberReference in assemblyDefinition.MainModule.GetMemberReferences())
            {
                if (memberReference.DeclaringType.IsArray)
                {
                    continue;
                }

                if (memberReference.DeclaringType.Scope.MetadataScopeType != MetadataScopeType.AssemblyNameReference)
                {
                    continue;
                }

                refTree.AddMember(memberReference);
            }

            return refTree;
        }