public PathMatcher(string pattern) { if (string.IsNullOrWhiteSpace(pattern)) throw new ArgumentNullException("pattern"); if (pattern.StartsWith("!")) throw new ArgumentException("Negated patterns should not be used", "pattern"); // Strip leading forward slash from pattern as matched paths don't start with the path separator character if (pattern.StartsWith(GitIgnorePathSeparator + string.Empty)) pattern = pattern.Substring(1); _matcher = new FileNameMatcher(pattern, GitIgnorePathSeparator); }
public DirectoryMatcher(string pattern) { if (string.IsNullOrWhiteSpace(pattern)) throw new ArgumentNullException("pattern"); if (pattern.StartsWith("!")) throw new ArgumentException("Negated patterns should not be used", "pattern"); if (pattern[pattern.Length - 1] != Path.DirectorySeparatorChar) throw new ArgumentException("Matches directories only, not files", "pattern"); _matcher = new FileNameMatcher(pattern.Substring(0, pattern.Length - 1), null); }
public FileMatcher(string pattern) { if (string.IsNullOrWhiteSpace(pattern)) throw new ArgumentNullException("pattern"); if (pattern.StartsWith("!")) throw new ArgumentException("Negated patterns should not be used", "pattern"); if (pattern.Contains(Path.DirectorySeparatorChar)) throw new ArgumentException("Matches files only, not directories", "pattern"); _matcher = new FileNameMatcher(pattern, null); }
/// <summary> /// A copy constructor which creates a new <seealso cref="FileNameMatcher"/> with the /// same state and Reset point like <code>other</code>. /// </summary> /// <param name="other"> /// another <seealso cref="FileNameMatcher"/> instance. /// </param> public FileNameMatcher(FileNameMatcher other) : this(other._headsStartValue, other._heads) { if (other == null) throw new System.ArgumentNullException("other"); }