示例#1
0
        protected static int CompareITypes(IType thisType, IType otherType)
        {
            if (thisType == otherType)
            {
                return(0);
            }
            if (thisType == null)
            {
                return(-1);
            }
            if (otherType == null)
            {
                return(1);
            }
            int num = string.CompareOrdinal(thisType.FullName, otherType.FullName);

            if (num != 0)
            {
                return(num);
            }
            IUnreferencedType unreferencedType1 = thisType as IUnreferencedType;
            IUnreferencedType unreferencedType2 = otherType as IUnreferencedType;

            if (unreferencedType1 != null && unreferencedType2 != null)
            {
                return(string.Compare(unreferencedType1.AssemblyLocation, unreferencedType2.AssemblyLocation, StringComparison.OrdinalIgnoreCase));
            }
            return(0);
        }
示例#2
0
        internal bool HasKnownPublicKey(IType type)
        {
            IUnreferencedType unreferencedType = type as IUnreferencedType;

            byte[] publicKeyToken;
            if (unreferencedType != null)
            {
                publicKeyToken = unreferencedType.AssemblyPublicKey;
            }
            else
            {
                if (!type.RuntimeAssembly.IsLoaded)
                {
                    return(false);
                }
                publicKeyToken = type.RuntimeAssembly.GetPublicKeyToken();
            }
            return(Enumerable.Any <byte[]>((IEnumerable <byte[]>)AssetTypeHelper.KnownPublicKeyTokens, (Func <byte[], bool>)(knownToken =>
            {
                if (publicKeyToken == null || publicKeyToken.Length != 8)
                {
                    return false;
                }
                return ProjectAssemblyHelper.ComparePublicKeyTokens(knownToken, publicKeyToken);
            })));
        }
示例#3
0
        public bool IsTypeSupported(IType type, bool filterWithProject = true)
        {
            if (type == null || type.RuntimeAssembly == null)
            {
                return(false);
            }
            IUnreferencedType unreferencedType = type as IUnreferencedType;

            if (!this.IsAssemblySupported(type.RuntimeAssembly.Name, unreferencedType != null) || filterWithProject && !this.ProjectContext.IsTypeSupported((ITypeId)type))
            {
                return(false);
            }
            if (AssetTypeHelper.IsBehaviorType((ITypeId)type) || AssetTypeHelper.IsTriggerActionType((ITypeId)type))
            {
                if (filterWithProject)
                {
                    if (!this.IsPrototypingProject && this.IsPrototypingType(type) || !this.ProjectContext.IsCapabilitySet(PlatformCapability.SupportsAssetLibraryBehaviorsItems))
                    {
                        return(false);
                    }
                }
                else if (unreferencedType != null && this.IsPrototypingType(type))
                {
                    return(false);
                }
            }
            return(true);
        }
示例#4
0
        public static string GetDescription(IType type)
        {
            IUnreferencedType unreferencedType = type as IUnreferencedType;

            if (unreferencedType == null)
            {
                return(AssetInfoModel.GetDescription(type.RuntimeType));
            }
            return(unreferencedType.Description);
        }
示例#5
0
        internal IEnumerable <CustomAssetCategoryPath> GetCustomAssetCategoryPaths(IType type)
        {
            IUnreferencedType unreferencedType = type as IUnreferencedType;

            if (unreferencedType == null)
            {
                return(AssetTypeHelper.GetCustomAssetCategoryPaths(type.RuntimeType));
            }
            return(unreferencedType.Categories);
        }
示例#6
0
        private DrawingBrush CacheLargeIcon()
        {
            IUnreferencedType unreferencedType = this.type as IUnreferencedType;

            if (unreferencedType != null && unreferencedType.LargeIcon != null)
            {
                return(unreferencedType.LargeIcon);
            }
            if (this.exampleInfo != null && this.exampleInfo.LargeIcon != null)
            {
                DrawingBrush drawingBrushFromStream = IconMapper.CreateDrawingBrushFromStream((Stream) new MemoryStream(this.exampleInfo.LargeIcon), this.TypeName + this.exampleInfo.DisplayName + "24x24");
                if (drawingBrushFromStream != null)
                {
                    return(drawingBrushFromStream);
                }
            }
            return(IconMapper.GetDrawingBrushForType((ITypeId)this.type, true, 24, 24));
        }