public bool Matches(HItem hItem) { int index = parts.Length - 1; HItem currentHItem = hItem; while (index >= 0) { if (currentHItem == null) { return(false); } bool isMatch = currentHItem.Name == parts[index] && (index != parts.Length - 1 || !isDirectoryOnly || currentHItem is HDirectory); if (isMatch) { index--; } else { index = parts.Length - 1; } currentHItem = currentHItem.Parent; } if (isRooted && currentHItem != null) { return(false); } return(true); }
public bool MatchPath(HItem item) { return(Items.Any(x => x.Matches(item))); }