protected virtual PresetTreeRoot CreateIncludeEntry(XmlNode configuration)
        {
            var database = GetExpectedAttribute(configuration, "database");
            var path     = GetExpectedAttribute(configuration, "path");

            // ReSharper disable once PossibleNullReferenceException
            var name      = configuration.Attributes["name"];
            var nameValue = name == null?path.Substring(path.LastIndexOf('/') + 1) : name.Value;

            var root = new PresetTreeRoot(nameValue, path, database);

            return(root);
        }
        /// <summary>
        ///     Checks if a preset includes a given item
        /// </summary>
        protected PredicateResult Includes(PresetTreeRoot entry, IItemData itemData)
        {
            // check for db match
            if (!itemData.DatabaseName.Equals(entry.DatabaseName, StringComparison.OrdinalIgnoreCase))
            {
                return(new PredicateResult(false));
            }

            // check for path match
            var unescapedPath = entry.Path.Replace(@"\*", "*");

            if (!itemData.Path.StartsWith(unescapedPath + "/", StringComparison.OrdinalIgnoreCase) &&
                !itemData.Path.Equals(unescapedPath, StringComparison.OrdinalIgnoreCase))
            {
                return(new PredicateResult(false));
            }

            // check excludes
            return(ExcludeMatches(entry, itemData));
        }
 protected virtual PredicateResult ExcludeMatches(PresetTreeRoot entry, IItemData itemData)
 {
     return(new PredicateResult(true));
 }