Exemplo n.º 1
0
        protected virtual bool MatchItemEquals(T item, FilterPart part)
        {
            if (item?.FilterString == null)
            {
                return(false);
            }
            var ret = item.FilterString.Equals(part.FilterString, StringComparison.OrdinalIgnoreCase);

            return(part.Negate ? !ret : ret);
        }
Exemplo n.º 2
0
        protected override bool MatchItemStartsWith(MenuCommandBoundItem item, FilterPart part)
        {
            var shortcut = false;

            if (FilterParts.Count == 1 && part.FilterString.Length > 1)
            {
                var strings = part.FilterString.ToUpper().Select(c => c.ToString());
                var pattern = string.Join(".*", strings);
                shortcut = Regex.IsMatch(item.PathFilterString, pattern, RegexOptions.None);
            }

            return(shortcut || base.MatchItemStartsWith(item, part));
        }
Exemplo n.º 3
0
        protected virtual bool MatchItemContaining(T item, FilterPart part)
        {
            if (item?.FilterString == null)
            {
                return(false);
            }

            if (part.Negate)
            {
                return(item.FilterString.IndexOf(part.FilterString, StringComparison.OrdinalIgnoreCase) == -1);
            }
            return(item.FilterString.IndexOf(part.FilterString, StringComparison.OrdinalIgnoreCase) != -1);
        }
Exemplo n.º 4
0
        protected virtual bool MatchItemStartsWith(T item, FilterPart part)
        {
            if (item?.FilterString == null)
            {
                return(false);
            }

            if (FilterParts.Count == 0)
            {
                return(true);
            }

            var ret = item.FilterString.StartsWith(FilterParts.First().FilterString, StringComparison.OrdinalIgnoreCase);

            return(part.Negate ? !ret : ret);
        }