当前位置: 首页>>代码示例>>C#>>正文


C# Asset.GetFilterList方法代码示例

本文整理汇总了C#中Asset.GetFilterList方法的典型用法代码示例。如果您正苦于以下问题:C# Asset.GetFilterList方法的具体用法?C# Asset.GetFilterList怎么用?C# Asset.GetFilterList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Asset的用法示例。


在下文中一共展示了Asset.GetFilterList方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetConfigAsset

        private static Asset GetConfigAsset(Asset currentAsset, string fileName, ConfigFileType fileType)
        {
            if (currentAsset.IsFolder)
            {
                List<Asset> childAssets = null;

                if (fileType == ConfigFileType.WebConfig)
                    childAssets = currentAsset.GetFileList(new AssetParams() { ExcludeFilterStatus = new List<string>() { "Retired", "Archived" } });
                else
                    childAssets = currentAsset.GetFilterList(new FilterParams() { ExcludeFilterStatus = new List<string>() { "Retired", "Archived" } });

                var configAssets = childAssets.Where(a => a.Label.Equals(fileName, StringComparison.OrdinalIgnoreCase));

                if (configAssets.Count() > 1)
                    throw new Exception("Multple " + fileName + " assets found at: " + currentAsset.AssetPath);

                var configAsset = configAssets.SingleOrDefault();

                if (configAsset != null && configAsset.IsLoaded)
                {
                    Out.DebugWriteLine("Found " + fileName + " asset at: " + configAsset.AssetPath);
                    return configAsset;
                }
            }

            if (fileType == ConfigFileType.WebConfig && currentAsset.Parent != null)
                return GetConfigAsset(currentAsset.Parent, fileName, fileType);
            else
                throw new Exception("No " + fileName + " assets found");
        }
开发者ID:rickeygalloway,项目名称:Test,代码行数:30,代码来源:Ih_ConfigFileHelper.cs

示例2: GetFilterList

        /// <summary>
        /// Filters everything even subfolders from the selected folder. Key = AssetID, Value = Asset.
        /// <para>If AssetType.Unspecified is selected, it will return all folders and files.</para>
        /// </summary>
        public static List<Asset> GetFilterList(Asset _assetFolder, AssetType _assetType = AssetType.Unspecified, string _path = "", bool excludeProjectTypes = false, List<string> excludeFolders = null, IhSiteBuilderLog siteLog = null)
        {
            FilterParams fpFilter = new FilterParams();
            fpFilter.ExcludeProjectTypes = excludeProjectTypes;

            if (!_assetType.Equals(AssetType.Unspecified))
                fpFilter.Add(Comparison.Equals, _assetType);

            Dictionary<string, Asset> dtAssets = new Dictionary<string, Asset>();
            if (!string.IsNullOrWhiteSpace(_path))
            {
                if (Asset.Load(_path).IsLoaded)
                    _assetFolder = Asset.Load(_path);
            }

            List<Asset> laAssets = _assetFolder.GetFilterList(fpFilter);

            if (excludeFolders != null)
            {
                laAssets = ExcludeFolderList(laAssets, excludeFolders);
            }
            foreach (Asset asAsset in laAssets)
            {
                if (!dtAssets.Keys.Contains(asAsset.BranchId.ToString()))
                {
                    if (asAsset.Type.Equals(AssetType.Folder))
                    {
                        dtAssets.Add(asAsset.BranchId.ToString(), asAsset);
                    }
                    else if (asAsset.Type.Equals(AssetType.File))
                    {
                        if (asAsset.WorkflowStatus.Name.Equals("Live") || asAsset.WorkflowStatus.Name.Equals("Stage") || asAsset.WorkflowStatus.Name.Equals("Draft") || asAsset.WorkflowStatus.Name.Equals(""))
                        {
                            dtAssets.Add(asAsset.BranchId.ToString(), asAsset);
                        }
                    }
                }
                else
                {
                    if (asAsset.WorkflowStatus.Name.Equals("Live"))
                    {
                        dtAssets[asAsset.BranchId.ToString()] = asAsset;
                    }
                    else if (asAsset.WorkflowStatus.Name.Equals("Stage"))
                    {
                        if (!dtAssets[asAsset.BranchId.ToString()].WorkflowStatus.Name.Equals("Live") && !dtAssets[asAsset.BranchId.ToString()].WorkflowStatus.Name.Equals("Stage"))
                        {
                            dtAssets[asAsset.BranchId.ToString()] = asAsset;
                        }
                    }
                    else if (asAsset.WorkflowStatus.Name.Equals("Draft"))
                    {
                        if (!dtAssets[asAsset.BranchId.ToString()].WorkflowStatus.Name.Equals("Live") && !dtAssets[asAsset.BranchId.ToString()].WorkflowStatus.Name.Equals("Stage") && !dtAssets[asAsset.BranchId.ToString()].WorkflowStatus.Name.Equals("Draft"))
                        {
                            dtAssets[asAsset.BranchId.ToString()] = asAsset;
                        }
                    }
                }
            }
            return dtAssets.Values.ToList<Asset>();
        }
开发者ID:rickeygalloway,项目名称:Test,代码行数:65,代码来源:IhSiteBuilderHelper.cs


注:本文中的Asset.GetFilterList方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。