/// <summary> /// Retrieve the matching assembly name reference in the Cecil object model /// </summary> /// <param name="aref">Reflector assembly reference</param> /// <returns>Cecil assembly name reference (null if not found)</returns> public static AssemblyNameReference ReflectorAssemblyReferenceToCecilAssemblyNameReference(IAssemblyReference aref) { IModule moddec = aref.Context; ReflectorAssemblyContext context = PluginFactory.GetInstance().GetAssemblyContext(moddec.Location) as ReflectorAssemblyContext; if (context != null) { return(context.GetAssemblyNameReference(aref)); } return(null); }
private static TCecil ReflectorToCecilMember <TCecil, TReflector>(TReflector item, Func <ReflectorAssemblyContext, object, TCecil> finder) where TReflector : IMemberDeclaration { ITypeDeclaration classdec = (ITypeDeclaration)item.DeclaringType; IModule moddec = GetModule(classdec); ReflectorAssemblyContext context = PluginFactory.GetInstance().GetAssemblyContext(moddec.Location) as ReflectorAssemblyContext; if (context != null) { return(finder(context, item)); } return(default(TCecil)); }