Exemple #1
0
 public FieldDefinition GetFieldDefinition(IFieldDefinition item)
 {
     return(TryGetOrAdd(_fieldcache, item, fdef =>
     {
         var tdef = GetTypeDefinition(item.DeclaringType);
         return tdef == null ? null : JustDecompileHelper.FindMatchingField(tdef, fdef);
     }));
 }
Exemple #2
0
 public EventDefinition GetEventDefinition(IEventDefinition item)
 {
     return(TryGetOrAdd(_eventcache, item, edef =>
     {
         var tdef = GetTypeDefinition(item.DeclaringType);
         return tdef == null ? null : JustDecompileHelper.FindMatchingEvent(tdef, edef);
     }));
 }
Exemple #3
0
 public PropertyDefinition GetPropertyDefinition(IPropertyDefinition item)
 {
     return(TryGetOrAdd(_propertycache, item, pdef =>
     {
         var tdef = GetTypeDefinition(item.DeclaringType);
         return tdef == null ? null : JustDecompileHelper.FindMatchingProperty(tdef, pdef);
     }));
 }
Exemple #4
0
 public MethodDefinition GetMethodDefinition(IMethodDefinition item)
 {
     return(TryGetOrAdd(_methodcache, item, mdef =>
     {
         var tdef = GetTypeDefinition(item.DeclaringType);
         return tdef == null ? null : JustDecompileHelper.FindMatchingMethod(tdef, mdef);
     }));
 }
Exemple #5
0
        public AssemblyNameReference GetAssemblyNameReference(IAssemblyNameReference item)
        {
            var canr = JustDecompileHelper.ExtractCecilAssemblyNameReference(item);

            if (canr == null)
            {
                return(null);
            }

            return(TryGetOrAdd(_assemblynamereferencecache, canr,
                               anref => JustDecompileHelper.FindMatchingAssemblyReference(AssemblyDefinition, anref)));
        }
        private IAssemblyContext SearchAssemblyReferenceContext(IAssemblyNameReference anr)
        {
            var canr = JustDecompileHelper.ExtractCecilAssemblyNameReference(anr);

            if (canr == null)
            {
                return(null);
            }

            foreach (var wrapper in Package.HostAssemblies)
            {
                var jdwrapper = (JustDecompileAssemblyWrapper)wrapper;
                foreach (var oanr in jdwrapper.AssemblyDefinition.MainModule.AssemblyReferences)
                {
                    var coanr = JustDecompileHelper.ExtractCecilAssemblyNameReference(oanr);
                    if (canr == coanr)
                    {
                        return(GetAssemblyContext(jdwrapper.Location));
                    }
                }
            }

            return(null);
        }
Exemple #7
0
 public Resource GetResource(IResource item)
 {
     return(TryGetOrAdd(_resourcecache, item, res => JustDecompileHelper.FindMatchingResource(AssemblyDefinition, res)));
 }
Exemple #8
0
 public TypeDefinition GetTypeDefinition(ITypeDefinition item)
 {
     return(TryGetOrAdd(_typecache, item, tdef => JustDecompileHelper.FindMatchingType(AssemblyDefinition, tdef)));
 }