private static PageTuple GetPageTup(PageRequest req, DateTime?lastModif, int num) { string response = "page " + num; DateTime?nextModif = (lastModif < DateTime.Now) ? lastModif?.AddDays(1) : null; PageTuple pageTup = new PageTuple(response, nextModif); return(pageTup); }
public static IObservable <PageTuple> GetPages(DateTime startModif) { DateTime from = DateTime.Today.AddDays(-2); DateTime until = DateTime.Today; PageRequest req = new PageRequest("url", "chan1", from, until, null); PageTuple startTup = new PageTuple(null, startModif); IObservable <PageTuple> pages = Observable.Range(1, 100) .Scan(startTup, (acc, num) => GetPageTup(req, acc.LastModif, num)) .TakeWhile(page => page.LastModif != null); return(pages); }