static bool StaticEquals(Glob lhs, Glob rhs) { if (ReferenceEquals(lhs, rhs)) { return(true); } if (ReferenceEquals(lhs, null) || ReferenceEquals(rhs, null)) { return(false); } return(lhs._text == rhs._text); }
public static Glob Combine(Glob arg1, Glob arg2, Glob arg3) { if (arg1 == null) { throw new ArgumentNullException("arg1"); } if (arg2 == null) { throw new ArgumentNullException("arg2"); } if (arg3 == null) { throw new ArgumentNullException("arg3"); } return Combine(arg1, Combine(arg2, arg3)); }
internal static IEnumerable<string> FilterDirectory(Glob glob, string directory, Predicate<string> match, GlobController enumerator) { var items = Enumerable.Empty<string>(); IEnumerable<string> subItemsStart = new[] { enumerator.ExpandEnvironmentVariables(directory) }; foreach (SegmentSequence sub in glob._segments) { var subItems = sub.Enumerate(subItemsStart, enumerator); items = items.Concat(subItems); } return items .Where(t => match(t)) .Distinct(); }
public static Glob Combine(Glob arg1, Glob arg2) { if (arg1 == null) { throw new ArgumentNullException("arg1"); } if (arg2 == null) { throw new ArgumentNullException("arg2"); } if (object.ReferenceEquals(arg1, arg2)) return arg1; if (arg1.IsAnything || arg2.IsAnything) return Glob.Anything; return new Glob(arg1._text + ";" + arg2._text, arg1._segments.Concat(arg2._segments).ToArray<SegmentSequence>()); }
static Exception _TryParse(string text, out Glob value) { return _TryParse(text, new GlobController(), out value); }
public static bool TryParse(string text, out Glob value) { return _TryParse(text, out value) == null; }
private GlobTemplate(IEnumerable <string> variables, string glob, string regex) { _variables = new List <string>(variables); _regex = new Regex(regex); _glob = Glob.Parse(glob); }
public override string ToString() { return(Glob.ToString()); }
public IEnumerable <GlobTemplateMatch> EnumerateFileSystemEntries(string workingDirectory) { return(NewMatches(WindowsPathSeparators(Glob.EnumerateFileSystemEntries(workingDirectory)))); }
public IEnumerable <GlobTemplateMatch> EnumerateFileSystemEntries() { return(NewMatches(WindowsPathSeparators(Glob.EnumerateFileSystemEntries()))); }
public IEnumerable <GlobTemplateMatch> EnumerateDirectories() { return(NewMatches(WindowsPathSeparators(Glob.EnumerateDirectories()))); }
public bool IsMatch(string input) { return(Glob.IsMatch(input)); }
public IEnumerable <string> EnumerateFiles(string workingDirectory) { return(Glob.FilterDirectory(this, workingDirectory ?? _controller.WorkingDirectory, _controller.FileExists, this._controller)); }