/// <summary> /// Registers the specified regex to be used as exclusion matcher. /// </summary> /// <param name="regex">The regex.</param> /// <returns>This insance</returns> /// <exception cref="System.ArgumentNullException">regex is null</exception> public FileSet Exclude(Regex regex) { if (regex == null) { throw new ArgumentNullException("regex"); } return(Add(Exclusion.By(regex))); }
/// <summary> /// Registers the specified predicate to be used as exclusion matcher. /// </summary> /// <param name="predicate">The predicate.</param> /// <returns>This instance</returns> /// <exception cref="System.ArgumentNullException">predicate is null</exception> public FileSet Exclude(Func <string, bool> predicate) { if (predicate == null) { throw new ArgumentNullException("predicate"); } return(Add(Exclusion.By(predicate))); }
/// <summary> /// Adds the specified file exclusion pattern. /// </summary> /// <param name="pattern">The pattern.</param> /// <returns>This instance</returns> /// <exception cref="System.ArgumentException"> /// Pattern cannot be null or contain whitespace only, contain forward slashes of inclusion pattern markers /// </exception> public FileSet Exclude(string pattern) { if (string.IsNullOrWhiteSpace(pattern)) { throw new ArgumentException("Pattern cannot be null or contain whitespace only", "pattern"); } foreach (var part in pattern.Split(patternSeparator, StringSplitOptions.RemoveEmptyEntries)) { if (part.StartsWith("-:")) { throw new ArgumentException("Exclude does not accept patterns with exclusion markers : " + part, pattern); } Add(Exclusion.By(FilePath.From(part))); } return(this); }