public Assembly LoadAssembly(RawModule module) { string refname = module.GetAssemblyName().FullName; Assembly asm = GetLoadedAssembly(refname); if (asm == null) { AssemblyReader asm1 = module.ToAssembly(); assemblies.Add(asm1); asm = asm1; } return(asm); }
public Assembly LoadFile(string path) { try { using (RawModule module = OpenRawModule(path)) { return(LoadAssembly(module)); } } catch (IOException x) { throw new FileNotFoundException(x.Message, x); } catch (UnauthorizedAccessException x) { throw new FileNotFoundException(x.Message, x); } }
private Assembly DefaultResolver(string refname, bool throwOnError) { Assembly asm = GetDynamicAssembly(refname); if (asm != null) { return(asm); } string dir = Path.GetDirectoryName(TypeUtil.GetAssembly(typeof(object)).ManifestModule.FullyQualifiedName); string filepath = Path.Combine(dir, GetSimpleAssemblyName(refname) + ".dll"); if (File.Exists(filepath)) { using (RawModule module = OpenRawModule(filepath)) { AssemblyComparisonResult result; if (module.IsManifestModule && CompareAssemblyIdentity(refname, false, module.GetAssemblyName().FullName, false, out result)) { return(LoadAssembly(module)); } } } return(null); }