public void ProcessRequest(HttpContext context) { string config = context.Request.QueryString["c"]; string url = context.Request.QueryString["u"]; string pathToConfig = String.Format("/configs/{0}.config", config); Config.BatchNumber = 0; Config.Load(context.Server.MapPath(pathToConfig)); Page page = new Page(url); page.Process(); HtmlViewerPage viewerPage = new HtmlViewerPage(); context.Response.Write(viewerPage.GetContent(page)); }
public void ProcessUrl(Page url) { Xml.WriteStartElement("page"); Xml.WriteAttributeString("url", url.Url.AbsoluteUri); foreach (PagePart thisPart in url.Parts) { Xml.WriteStartElement("part"); Xml.WriteAttributeString("name", thisPart.Name); if (thisPart.HasContent) { if (thisPart.HasMarkup) { Xml.WriteCData(thisPart.Content); } else { Xml.WriteString(thisPart.Content); } } Xml.WriteStartElement("messages"); foreach(Message thisMessage in thisPart.Messages) { Xml.WriteStartElement("message"); Xml.WriteAttributeString("sender",thisMessage.Sender); Xml.WriteAttributeString("type", thisMessage.Type); Xml.WriteAttributeString("text", thisMessage.Text); Xml.WriteEndElement(); } Xml.WriteEndElement(); Xml.WriteEndElement(); } Xml.WriteEndElement(); }
private void LoadUrls(string pathToUrlFile) { Pages = new List<Page>(); //Load up the URLs List<string> urlsToProcess = new List<String>(); foreach (string thisUrl in File.ReadAllLines(pathToUrlFile).Distinct()) { string cleanedThisUrl = thisUrl.Trim(); //If it's blank, skip it if (cleanedThisUrl.Length == 0) { continue; } //If it's the break line, end the loop if (cleanedThisUrl.ToLowerInvariant() == "#end") { break; } //If it's the start line, clear the current list if (cleanedThisUrl.ToLowerInvariant() == "#start") { urlsToProcess.Clear(); } //If it's a comment, skip it if (cleanedThisUrl[0] == '#') { continue; } //Add it urlsToProcess.Add(cleanedThisUrl); } Log.Write(String.Format("Found {0} URL(s)", urlsToProcess.Count.ToString())); //Add them all as pages foreach(string url in urlsToProcess) { Page page = new Page(url); page.Job = this; Pages.Add(page); } }