Skip to content

Instantly share code, notes, and snippets.

@rarous
Created October 4, 2012 10:28
Show Gist options
  • Select an option

  • Save rarous/3832779 to your computer and use it in GitHub Desktop.

Select an option

Save rarous/3832779 to your computer and use it in GitHub Desktop.
var items = CreateRequestUris(requestXml).
Select(Downloader.Download).
SelectMany(Parse);
return new Response(TransformResult(items));
readonly ReplaySubject<string> urlSubject = new ReplaySubject<string>();
protected override IEnumerable<string> CreateRequestUris(XmlElement requestXml)
{
urlSubject.OnNext(ListUrl);
return urlSubject.ToEnumerable();
}
protected override IEnumerable<Data> Parse(string text)
{
var html = text.ParseHtml();
NotifyNextPage(html);
// ...
return from row in rows select Data.Parse(row);
}
void NotifyNextPage(XElement html)
{
var formData = ParseFormData(html);
if (formData != null)
urlSubject.OnNext(ListUrl + formData);
else
urlSubject.OnCompleted();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment