Exemplo n.º 1
0
        private bool OrRequirementsMet(IEnumerable <string> itemAttributes)
        {
            var orRequirements = AttributeRequirements.Where(r => r.Contains("/"));

            foreach (var orRequirement in orRequirements)
            {
                var options = orRequirement.Split('/');
                if (itemAttributes.Any(a => options.Any(o => a.Contains(o))) == false)
                {
                    return(false);
                }
            }

            return(true);
        }
Exemplo n.º 2
0
        private bool NotRequirementsMet(IEnumerable <string> itemAttributes)
        {
            var notRequirements = AttributeRequirements.Where(r => r.StartsWith("!"));

            foreach (var notRequirement in notRequirements)
            {
                var requirement = notRequirement.Substring(1);
                if (itemAttributes.Any(a => a.Contains(requirement)))
                {
                    return(false);
                }
            }

            return(true);
        }
Exemplo n.º 3
0
        private bool AndRequirementsMet(IEnumerable <string> itemAttributes)
        {
            var andRequirements = AttributeRequirements.Where(r => !r.Contains("/") && !r.Contains("!"));

            return(!andRequirements.Any() || andRequirements.All(r => itemAttributes.Any(a => a.Contains(r))));
        }