GetAssemblyName() 공개 메소드

public GetAssemblyName ( ) : IKVM.Reflection.AssemblyName
리턴 IKVM.Reflection.AssemblyName
예제 #1
0
        public Assembly LoadAssembly(RawModule module)
        {
            string   refname = module.GetAssemblyName().FullName;
            Assembly asm     = GetLoadedAssembly(refname);

            if (asm == null)
            {
                asm = module.ToAssembly();
                assemblies.Add(asm);
            }
            return(asm);
        }
예제 #2
0
		public Assembly LoadAssembly(RawModule module)
		{
			string refname = module.GetAssemblyName().FullName;
			Assembly asm = GetLoadedAssembly(refname);
			if (asm == null)
			{
				asm = module.ToAssembly();
				assemblies.Add(asm);
			}
			return asm;
		}
예제 #3
0
        private Assembly DefaultResolver(string refname, bool throwOnError)
        {
            Assembly asm = GetDynamicAssembly(refname);

            if (asm != null)
            {
                return(asm);
            }
#if NETSTANDARD
            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);
#else
            string fileName;
            if (throwOnError)
            {
                try
                {
                    fileName = System.Reflection.Assembly.ReflectionOnlyLoad(refname).Location;
                }
                catch (System.BadImageFormatException x)
                {
                    throw new BadImageFormatException(x.Message, x);
                }
            }
            else
            {
                try
                {
                    fileName = System.Reflection.Assembly.ReflectionOnlyLoad(refname).Location;
                }
                catch (System.BadImageFormatException x)
                {
                    throw new BadImageFormatException(x.Message, x);
                }
                catch (FileNotFoundException)
                {
                    // we intentionally only swallow the FileNotFoundException, if the file exists but isn't a valid assembly,
                    // we should throw an exception
                    return(null);
                }
            }
            return(LoadFile(fileName));
#endif
        }