Exemple #1
0
        IMediaFileFilter CreateCtgFilter(XElement xcf)
        {
            var ctg   = xcf.GetAttributeValue(XNames.xnCategory);
            var sctgs = xcf.GetAttributeValue(XNames.xaValue);

            if (string.IsNullOrEmpty(sctgs))
            {
                return(null);
            }
            CtgFilter rz = new CtgFilter()
            {
                UseNegate  = xcf.GetAttributeBool(XNames.xaNegate),
                UseAndRule = xcf.GetAttributeBool(XN.xaUseAnd),
                Categories = new HashSet <string>(sctgs.Split(new char[] { '|' }, StringSplitOptions.RemoveEmptyEntries), StringComparer.InvariantCultureIgnoreCase),
                Definition = Project.CategoryDefinitions.FirstOrDefault(r => ctg.Equals(r.Title, StringComparison.InvariantCultureIgnoreCase))
            };

            if (rz.Definition == null)
            {
                return(null);
            }
            return(rz);
        }
Exemple #2
0
        /// <summary>
        /// Gets the filter.
        /// </summary>
        /// <returns></returns>
        public Func <MediaFile, bool> GetFilter()
        {
            CtgFilter rz = new CtgFilter(this);

            return(rz.IsMatching);
        }