Ejemplo n.º 1
0
        private bool FilterItem(BaseItem f, IReadOnlyCollection <BaseItemKind> excludeItemTypes, IReadOnlyCollection <BaseItemKind> includeItemTypes, IReadOnlyCollection <string> mediaTypes)
        {
            var baseItemKind = f.GetBaseItemKind();

            // Exclude item types
            if (excludeItemTypes.Count > 0 && excludeItemTypes.Contains(baseItemKind))
            {
                return(false);
            }

            // Include item types
            if (includeItemTypes.Count > 0 && !includeItemTypes.Contains(baseItemKind))
            {
                return(false);
            }

            // Include MediaTypes
            if (mediaTypes.Count > 0 && !mediaTypes.Contains(f.MediaType ?? string.Empty, StringComparer.OrdinalIgnoreCase))
            {
                return(false);
            }

            return(true);
        }