Пример #1
0
        private bool HasReferencedAssembly(AssemblyGroup assemblyGroup)
        {
            bool           flag;
            IPlatformTypes platformMetadata = (IPlatformTypes)this.PlatformMetadata;

            using (IEnumerator <IAssemblyId> enumerator = platformMetadata.GetAssemblyGroup(assemblyGroup).GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    IAssemblyId current = enumerator.Current;
                    using (IEnumerator <IAssembly> enumerator1 = this.AssemblyReferences.GetEnumerator())
                    {
                        while (enumerator1.MoveNext())
                        {
                            IAssemblyId assemblyId = enumerator1.Current;
                            if (current.Name != assemblyId.Name)
                            {
                                continue;
                            }
                            flag = true;
                            return(flag);
                        }
                    }
                }
                return(false);
            }
            return(flag);
        }
Пример #2
0
 protected string GetKey(IAssemblyId assembly, string typeName)
 {
     if (assembly == null || assembly == this.ProjectAssembly || this.ProjectAssembly != null && assembly.Name.Equals(this.ProjectAssembly.Name, StringComparison.OrdinalIgnoreCase))
     {
         return(typeName);
     }
     return(string.Concat(assembly.Name, ":", typeName));
 }
Пример #3
0
        public virtual IType ResolveType(ITypeId typeId)
        {
            IType                type;
            IPlatformTypes       platformMetadata     = (IPlatformTypes)this.PlatformMetadata;
            ProjectNeutralTypeId projectNeutralTypeId = typeId as ProjectNeutralTypeId;

            if (projectNeutralTypeId != null && projectNeutralTypeId.AssemblyGroup != AssemblyGroup.Interactivity && !this.HasReferencedAssembly(projectNeutralTypeId.AssemblyGroup))
            {
                return(PlatformTypes.NullTypeInstance);
            }
            IType type1 = this.PlatformMetadata.ResolveType(typeId);

            if (!this.PlatformMetadata.IsNullType(type1))
            {
                return(type1);
            }
            if (projectNeutralTypeId != null)
            {
                using (IEnumerator <IAssemblyId> enumerator = platformMetadata.GetAssemblyGroup(projectNeutralTypeId.AssemblyGroup).GetEnumerator())
                {
                    while (enumerator.MoveNext())
                    {
                        IAssemblyId current = enumerator.Current;
                        type1 = this.GetType(current.Name, projectNeutralTypeId.FullName);
                        if (type1 == null)
                        {
                            using (IEnumerator <string> enumerator1 = projectNeutralTypeId.PotentialFullNames.GetEnumerator())
                            {
                                while (enumerator1.MoveNext())
                                {
                                    string str = enumerator1.Current;
                                    type1 = this.GetType(current.Name, str);
                                    if (type1 == null)
                                    {
                                        continue;
                                    }
                                    type = type1;
                                    return(type);
                                }
                            }
                        }
                        else
                        {
                            type = type1;
                            return(type);
                        }
                    }
                    return(PlatformTypes.NullTypeInstance);
                }
                return(type);
            }
            return(PlatformTypes.NullTypeInstance);
        }
Пример #4
0
        private string GetKey(IAssemblyId assembly, Type type)
        {
            string nameIncludingAnyDeclaringTypes = ProjectContextType.GetNameIncludingAnyDeclaringTypes(type);
            string key = this.GetKey(assembly, Microsoft.Expression.DesignModel.Metadata.TypeHelper.CombineNamespaceAndTypeName(type.Namespace, nameIncludingAnyDeclaringTypes));

            if (!type.IsGenericType)
            {
                return(key);
            }
            StringBuilder stringBuilder = new StringBuilder(key);

            stringBuilder.Append('<');
            Type[] genericTypeArguments = PlatformTypeHelper.GetGenericTypeArguments(type);
            if (genericTypeArguments == null)
            {
                return(null);
            }
            for (int i = 0; i < (int)genericTypeArguments.Length; i++)
            {
                Type type1 = genericTypeArguments[i];
                if (i > 0)
                {
                    stringBuilder.Append(',');
                }
                IAssembly assembly1 = this.GetAssembly(type1.Assembly);
                if (assembly1 == null)
                {
                    return(null);
                }
                string str = this.GetKey(assembly1, type1);
                if (str == null)
                {
                    return(null);
                }
                stringBuilder.Append(str);
            }
            stringBuilder.Append('>');
            return(stringBuilder.ToString());
        }
Пример #5
0
        public override bool Equals(object obj)
        {
            bool flag;

            if (this == obj)
            {
                return(true);
            }
            ITypeId typeId = obj as ITypeId;

            if (typeId != null && (base.FullName == typeId.FullName || this.MatchesPotentialFullName(typeId.FullName)))
            {
                ProjectContextType projectContextType = typeId as ProjectContextType;
                if (projectContextType == null)
                {
                    return(true);
                }
                IPlatformTypes platformMetadata = (IPlatformTypes)projectContextType.PlatformMetadata;
                using (IEnumerator <IAssemblyId> enumerator = platformMetadata.GetAssemblyGroup(this.AssemblyGroup).GetEnumerator())
                {
                    while (enumerator.MoveNext())
                    {
                        IAssemblyId current = enumerator.Current;
                        if (projectContextType.RuntimeAssembly.Name != current.Name)
                        {
                            continue;
                        }
                        flag = true;
                        return(flag);
                    }
                    return(false);
                }
                return(flag);
            }
            return(false);
        }