Exemplo n.º 1
0
		protected void RegisterAssemblies(IEnumerable<IAssembly> assemblies)
		{
			foreach (IAssembly assembly in assemblies)
			{
				try
				{
					Assembly reflectionAssembly = AssemblyHelper.GetReflectionAssembly(assembly);
					Assembly assembly1 = reflectionAssembly;
					if (reflectionAssembly != null)
					{
						IPlatformTypes platformMetadata = (IPlatformTypes)this.typeResolver.PlatformMetadata;
						if (platformMetadata.RuntimeContext != null && platformMetadata.ReferenceContext != null && platformMetadata.RuntimeContext.ResolveRuntimeAssembly(AssemblyHelper.GetAssemblyName(reflectionAssembly)) != null)
						{
							Assembly assembly2 = platformMetadata.ReferenceContext.ResolveReferenceAssembly(reflectionAssembly);
							if (assembly2 != null)
							{
								assembly1 = assembly2;
							}
						}
						this.RegisterAssemblyNamespaces(assembly, assembly1.GetCustomAttributesData());
					}
				}
				catch
				{
				}
			}
		}
Exemplo n.º 2
0
        internal static Type GetType(IAssembly assembly, string typeName)
        {
            Assembly reflectionAssembly = AssemblyHelper.GetReflectionAssembly(assembly);

            if (reflectionAssembly != (Assembly)null)
            {
                return(PlatformTypeHelper.GetType(reflectionAssembly, typeName));
            }
            return((Type)null);
        }
Exemplo n.º 3
0
        public static bool IsSystemAssembly(IAssembly assembly)
        {
            Assembly reflectionAssembly = AssemblyHelper.GetReflectionAssembly(assembly);

            if (reflectionAssembly == null)
            {
                return(false);
            }
            return(AssemblyHelper.IsSystemAssembly(reflectionAssembly));
        }
Exemplo n.º 4
0
        public static Type[] GetTypes(IAssembly assembly)
        {
            Assembly reflectionAssembly = AssemblyHelper.GetReflectionAssembly(assembly);

            if (reflectionAssembly == null)
            {
                return(Type.EmptyTypes);
            }
            return(reflectionAssembly.GetTypes());
        }
Exemplo n.º 5
0
        public static AssemblyName GetAssemblyName(IAssembly assembly)
        {
            Assembly reflectionAssembly = AssemblyHelper.GetReflectionAssembly(assembly);

            if (reflectionAssembly == null)
            {
                return(null);
            }
            return(AssemblyHelper.GetAssemblyName(reflectionAssembly));
        }
Exemplo n.º 6
0
        public static IEnumerable <IAssembly> LoadReferencedAssemblies(IAssembly assembly, Func <AssemblyName, Assembly> assemblyResolverCallback, IPlatformTypes platformTypes)
        {
            List <IAssembly> assemblies         = new List <IAssembly>();
            Assembly         reflectionAssembly = AssemblyHelper.GetReflectionAssembly(assembly);

            if (reflectionAssembly != null)
            {
                AssemblyName[] referencedAssemblies = reflectionAssembly.GetReferencedAssemblies();
                if (referencedAssemblies != null)
                {
                    AssemblyName[] assemblyNameArray = referencedAssemblies;
                    for (int i = 0; i < (int)assemblyNameArray.Length; i++)
                    {
                        Assembly assembly1 = assemblyResolverCallback(assemblyNameArray[i]);
                        if (assembly1 != null)
                        {
                            assemblies.Add(platformTypes.CreateAssembly(assembly1, AssemblySource.Unknown));
                        }
                    }
                }
            }
            return(assemblies);
        }
Exemplo n.º 7
0
 internal static Assembly GetRuntimeAssembly(IType type)
 {
     return(AssemblyHelper.GetReflectionAssembly(type.RuntimeAssembly));
 }