Beispiel #1
0
        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);
        }
Beispiel #2
0
 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);
     }
 }
Beispiel #3
0
        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);
        }