internal override IEnumerable <string> Enumerate(IEnumerable <string> items, GlobController enumerator) { string deviceName = (device + ":" + "/"); return(new [] { deviceName }); }
internal override IEnumerable <string> Enumerate(IEnumerable <string> items, GlobController enumerator) { var result = items.SelectMany(t => enumerator.EnumerateFileSystemEntries(t)).Where(t => regex.IsMatch(t)); return(result); }
private Glob(string text, SegmentSequence[] segments) { _text = text; _segments = segments; _regexCache = new Lazy <Regex>(MakeRegex); _controller = new GlobController(); }
internal override IEnumerable<string> Enumerate(IEnumerable<string> items, GlobController enumerator) { foreach (Segment s in this.segments) { items = s.Enumerate(items, enumerator); } return items; }
internal override IEnumerable<string> Enumerate(IEnumerable<string> items, GlobController enumerator) { Queue<string> results = new Queue<string>(enumerator.OnlyDirectories(items)); while (results.Count > 0) { var item = results.Dequeue(); yield return item; var descendents = enumerator.EnumerateDirectories(item); foreach (var d in descendents) results.Enqueue(d); } }
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; }
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(); }
protected Glob(string text, Glob.GlobController controller) { if (controller == null) { controller = new GlobController(); } text = controller.ExpandEnvironmentVariables(text); Exception ex = _TryParse(text, out _segments); if (ex != null) { throw ex; } _text = text; _regexCache = new Lazy <Regex>(MakeRegex); _controller = controller; }
internal override IEnumerable<string> Enumerate(IEnumerable<string> items, GlobController enumerator) { return items.SelectMany(t => enumerator.EnumerateDirectories(t)); }
internal override IEnumerable<string> Enumerate(IEnumerable<string> items, GlobController enumerator) { return new [] { "/" }; }
internal override IEnumerable<string> Enumerate(IEnumerable<string> items, GlobController enumerator) { return items.Where(t => enumerator.DirectoryExists(t)); }
internal abstract IEnumerable<string> Enumerate(IEnumerable<string> items, GlobController enumerator);