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);
        }
Exemple #2
0
        protected override void ComputeCategories(IList <AssetCategoryPath> categoryPaths, AssetTypeHelper typeHelper)
        {
            if (!string.IsNullOrEmpty(this.AssetInfo.Location))
            {
                string relativePath = this.AssetInfo.Location + (this.Type.Namespace != null ? "/" + this.Type.Namespace.Replace('.', '/') : string.Empty);
                categoryPaths.Add(PresetAssetCategoryPath.LocationsRoot.Append(relativePath, true));
            }
            if (typeHelper.IsTypeInProject(this.Type))
            {
                categoryPaths.Add((AssetCategoryPath)PresetAssetCategoryPath.ProjectRoot);
            }
            bool flag1       = typeHelper.IsMockupType(this.type);
            bool flag2       = typeHelper.IsControlType((ITypeId)this.Type) && !flag1;
            bool flag3       = AssetTypeHelper.IsBehaviorType((ITypeId)this.Type) || AssetTypeHelper.IsTriggerActionType((ITypeId)this.Type);
            bool flag4       = typeHelper.IsEffectType((ITypeId)this.Type);
            bool isShapeType = typeHelper.IsShapeType((ITypeId)this.Type);

            this.IsSketchShapeType = false;
            AssetCategoryPath rootPath = flag1 ? (AssetCategoryPath)PresetAssetCategoryPath.PrototypeRoot : (isShapeType ? (AssetCategoryPath)PresetAssetCategoryPath.ShapesRoot : (flag2 ? (AssetCategoryPath)PresetAssetCategoryPath.ControlsRoot : (flag3 ? (AssetCategoryPath)PresetAssetCategoryPath.BehaviorsRoot : (flag4 ? (AssetCategoryPath)PresetAssetCategoryPath.EffectsRoot : (AssetCategoryPath)null))));

            if (rootPath != null)
            {
                bool flag5             = false;
                bool hasCustomCategory = false;
                foreach (CustomAssetCategoryPath customPath in typeHelper.GetCustomAssetCategoryPaths(this.type))
                {
                    hasCustomCategory = true;
                    if (!string.IsNullOrEmpty(customPath.CategoryPath))
                    {
                        if (isShapeType && typeHelper.IsSketchShapesCategory(rootPath, customPath))
                        {
                            categoryPaths.Add(PresetAssetCategoryPath.PrototypeRoot.Append(customPath));
                            this.IsSketchShapeType = true;
                        }
                        categoryPaths.Add(rootPath.Append(customPath));
                    }
                    flag5 = ((flag5 ? true : false) | (customPath.AlwaysShows ? 1 : (string.IsNullOrEmpty(customPath.CategoryPath) ? true : false))) != 0;
                    categoryPaths.Add(PresetAssetCategoryPath.CategoriesRoot.Append(customPath));
                }
                if (this.exampleInfo != null && this.exampleInfo.Categories != null)
                {
                    EnumerableExtensions.ForEach <CustomAssetCategoryPath>((IEnumerable <CustomAssetCategoryPath>) this.exampleInfo.Categories, (Action <CustomAssetCategoryPath>)(customPath =>
                    {
                        hasCustomCategory = true;
                        if (string.IsNullOrEmpty(customPath.CategoryPath))
                        {
                            return;
                        }
                        if (isShapeType && typeHelper.IsSketchShapesCategory(rootPath, customPath))
                        {
                            categoryPaths.Add(PresetAssetCategoryPath.PrototypeRoot.Append(customPath));
                            this.IsSketchShapeType = true;
                        }
                        categoryPaths.Add(rootPath.Append(customPath));
                    }));
                }
                if (rootPath == PresetAssetCategoryPath.ControlsRoot)
                {
                    flag5 = flag5 & typeHelper.HasKnownPublicKey(this.Type) | typeHelper.IsCommonControlType((ITypeId)this.Type);
                }
                else if (flag3 || flag4 || (isShapeType || flag1))
                {
                    flag5 |= !hasCustomCategory;
                }
                if (flag5)
                {
                    categoryPaths.Add(rootPath);
                }
            }
            if (flag2)
            {
                categoryPaths.Add((AssetCategoryPath)PresetAssetCategoryPath.ControlsAll);
                switch (typeHelper.GetPrototypeScreenType(this.Type))
                {
                case PrototypeScreenType.NavigationScreen:
                    categoryPaths.Add((AssetCategoryPath)PresetAssetCategoryPath.PrototypeNavigations);
                    break;

                case PrototypeScreenType.CompositionScreen:
                    categoryPaths.Add((AssetCategoryPath)PresetAssetCategoryPath.PrototypeCompositions);
                    break;
                }
            }
            else
            {
                if (!flag3 || !typeHelper.IsPrototypingType(this.Type))
                {
                    return;
                }
                categoryPaths.Add((AssetCategoryPath)PresetAssetCategoryPath.PrototypeBehaviors);
                categoryPaths.Add((AssetCategoryPath)PresetAssetCategoryPath.BehaviorsPrototype);
            }
        }