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, 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))); }
static Exception _TryParse(string text, GlobController controller, out Glob value) { text = controller.ExpandEnvironmentVariables(text); SegmentSequence[] segments; Exception ex = _TryParse(text, out segments); value = null; if (ex == null) { value = new Glob(text, segments); return(null); } else { return(ex); } }
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 IEnumerable <string> EnumerateFiles(string workingDirectory) { return(Glob.FilterDirectory(this, workingDirectory ?? _controller.WorkingDirectory, _controller.FileExists, this._controller)); }
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)); }