예제 #1
0
        public static MemberIdentifier GetIdentifier(string assemblyFilePath, IMemberDefinition member)
        {
            TypeDefinition td = member as TypeDefinition;

            if (td == null)
            {
                td = member.DeclaringType;
            }

            MemberIdentifier result = new MemberIdentifier(new AssemblyIdentifier(assemblyFilePath), new UniqueMemberIdentifier(td.Module.FilePath, member.MetadataToken.ToInt32()));

            return(result);
        }
예제 #2
0
        public static Dictionary <TypeDefinition, string> ConvertMapping(Dictionary <MemberIdentifier, string> originalMapping)
        {
            Dictionary <TypeDefinition, string> result = new Dictionary <TypeDefinition, string>();

            if (originalMapping == null)
            {
                return(result);
            }
            foreach (KeyValuePair <MemberIdentifier, string> memberPair in originalMapping)
            {
                MemberIdentifier   memberId       = memberPair.Key;
                AssemblyDefinition assembly       = ResolveAssembly(memberId.Assembly);
                TypeDefinition     typeDefinition = ResolveTypeInAssembly(assembly, memberId.UniqueMemberIdentifier);
                string             path           = memberPair.Value;

                result.Add(typeDefinition, path);
            }
            return(result);
        }