internal static IType GetType(ITypeResolver typeResolver, IAssembly assembly, string typeName) { Type type = PlatformTypeHelper.GetType(assembly, typeName); if (type != (Type)null) { return(typeResolver.GetType(type)); } return((IType)null); }
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); }
public IType GetType(string assemblyName, string typeName) { if (string.IsNullOrEmpty(assemblyName)) { return(null); } if (string.IsNullOrEmpty(typeName)) { throw new ArgumentException(ExceptionStringTable.GetTypeCannotBeCalledWithNullOrEmptyTypeName, "typeName"); } IAssembly platformAssembly = this.platformTypes.GetPlatformAssembly(assemblyName); Type type = PlatformTypeHelper.GetType(platformAssembly, typeName); if (type == null) { return(null); } return(this.platformTypes.GetType(type)); }
public Type GetType(string typeName) { Type type; Type type1 = null; if (this.typeNameCache.TryGetValue(typeName, out type1)) { return type1; } using (IEnumerator<XmlnsDefinitionMap.AssemblyNamespace> enumerator = this.AssemblyNamespaces.GetEnumerator()) { while (enumerator.MoveNext()) { XmlnsDefinitionMap.AssemblyNamespace current = enumerator.Current; IAssembly assembly = current.Assembly; string str = TypeHelper.CombineNamespaceAndTypeName(current.ClrNamespace, typeName); try { type1 = PlatformTypeHelper.GetType(assembly, str); if (type1 != null) { IType type2 = this.typeResolver.GetType(type1); if (!this.typeResolver.PlatformMetadata.IsNullType(type2)) { if (TypeHelper.IsSet((assembly.CompareTo(this.targetAssembly) ? MemberAccessTypes.PublicOrInternal : MemberAccessTypes.Public), PlatformTypeHelper.GetMemberAccess(type1))) { this.typeNameCache.Add(typeName, type1); type = type1; return type; } } } } catch (ArgumentException argumentException) { type = null; return type; } } this.typeNameCache.Add(typeName, null); return null; } return type; }
public IType GetType(string assemblyName, string typeName) { IAssembly assembly; ProjectContextType projectContextType; UnbuiltTypeDescription unbuiltTypeDescription; IType type = null; if (string.IsNullOrEmpty(typeName)) { throw new ArgumentException(ExceptionStringTable.GetTypeCannotBeCalledWithNullOrEmptyTypeName, "typeName"); } assembly = (!string.IsNullOrEmpty(assemblyName) ? this.GetAssembly(assemblyName) : this.ProjectAssembly); if (assembly != null) { string key = this.GetKey(assembly, typeName); if (this.typeIds.TryGetValue(key, out projectContextType)) { return(projectContextType); } Type type1 = null; try { type1 = PlatformTypeHelper.GetType(assembly, typeName); } catch (Exception exception) { } if (type1 != null) { type = this.GetType(key, assembly, type1); } if (type == null && this.unbuiltTypeInfo.TryGetValue(key, out unbuiltTypeDescription)) { projectContextType = new ProjectContextType(this, key); this.typeIds.Add(key, projectContextType); projectContextType.Initialize(unbuiltTypeDescription, key); type = projectContextType; } } return(type); }
public IType GetType(IAssembly assembly, string typeName) { return(PlatformTypeHelper.GetType(this, assembly, typeName)); }
private Type GetRuntimeType(ITypeResolver typeResolver, ProjectContextType typeId) { Type type; if (RuntimeGeneratedTypesHelper.IsControlEditingAssembly(typeId.assembly)) { Type sourceType = ControlEditingDesignTypeGenerator.GetSourceType(typeId.RuntimeType); if (sourceType != null) { ProjectContextType projectContextType = typeResolver.GetType(sourceType) as ProjectContextType; if (projectContextType != null) { Type runtimeType = projectContextType.GetRuntimeType(); if (runtimeType != sourceType && runtimeType != null) { Type type1 = (new ControlEditingDesignTypeGenerator(typeResolver)).DefineType(runtimeType); if (type1 != typeId.RuntimeType) { this.assemblyName = AssemblyHelper.GetAssemblyName(type1.Assembly).Name; this.assembly = this.GetAssembly(this.typeResolver, this.assemblyName); return(type1); } } } } } if (typeId.arrayItemType == null) { IAssembly runtimeAssembly = typeId.RuntimeAssembly; if (runtimeAssembly != null) { runtimeAssembly = this.GetAssembly(typeResolver, runtimeAssembly.Name); } if (runtimeAssembly != null) { Type type2 = PlatformTypeHelper.GetType(runtimeAssembly, typeId.FullName); if (type2 != null) { if (!typeId.IsGenericType) { return(type2); } IList <IType> genericTypeArguments = typeId.GetGenericTypeArguments(); int count = genericTypeArguments.Count; if (count > 0) { Type[] typeArray = new Type[count]; for (int i = 0; i < count; i++) { Type runtimeType1 = this.GetRuntimeType(genericTypeArguments[i]); if (runtimeType1 == null) { return(null); } typeArray[i] = runtimeType1; } try { type = type2.MakeGenericType(typeArray); } catch (ArgumentException argumentException) { return(null); } return(type); } } } } else { Type runtimeType2 = this.GetRuntimeType(typeId.arrayItemType); if (runtimeType2 != null) { if (typeId.arrayRank <= 1) { return(runtimeType2.MakeArrayType()); } return(runtimeType2.MakeArrayType(typeId.arrayRank)); } } return(null); }