示例#1
0
        public IMember Clone(ITypeResolver typeResolver)
        {
            string name;
            string str;

            if (typeResolver == this.typeResolver)
            {
                return(this);
            }
            if (this.IsGenericType)
            {
                if (this.RuntimeType == null)
                {
                    return(null);
                }
                return(typeResolver.GetType(this.RuntimeType));
            }
            if (this.xmlNamespace != null)
            {
                return(typeResolver.GetType(this.xmlNamespace, this.Name));
            }
            if (this.typeResolver.ProjectAssembly != null)
            {
                name = this.typeResolver.ProjectAssembly.Name;
            }
            else
            {
                name = null;
            }
            string str1 = name;

            if (typeResolver.ProjectAssembly != null)
            {
                str = typeResolver.ProjectAssembly.Name;
            }
            else
            {
                str = null;
            }
            string str2 = str;
            string str3 = (this.assemblyName == null ? str1 : this.assemblyName);

            if (str2 == str3)
            {
                str3 = null;
            }
            return(typeResolver.GetType(str3, TypeHelper.CombineNamespaceAndTypeName(this.Namespace, this.Name)));
        }
示例#2
0
			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;
			}