public IDisposable Subscribe(IObserver <Match> observer) { IObservable <Match> sequence = new RegexObservableFile(_regex, _filePaths[0]); sequence = (from filePath in _filePaths select filePath) .Skip(1) .Aggregate(sequence, (current, fp) => current.Concat(new RegexObservableFile(_regex, fp))); return(sequence.Subscribe(observer)); }
static void Main(string[] args) { var matchCount = 0; var rof = new RegexObservableFile(new Regex( @"^401-[^\s]+\s+[^\s]+\s+[^\s]+\s+IMPETRO\s+.*$", RegexOptions.Compiled | RegexOptions.Multiline), @"..\..\..\..\..\log.txt"); var d = rof.Subscribe(m => { matchCount++; Console.WriteLine(m.Value); }); Console.WriteLine(matchCount); }