private void StartButton_Click(object sender, System.EventArgs e) { if (StartButton.Text == "Start") { // copy all nodes from routing to crawl map lock (Routing.BucketList) foreach (DhtContact contact in Routing.ContactMap.Values) { if (!CrawlMap.ContainsKey(contact.RoutingID)) { CrawlMap[contact.RoutingID] = new CrawlNode(contact); } } Status = CrawlStatus.Active; StartButton.Text = "Pause"; } else if (StartButton.Text == "Pause") { Status = CrawlStatus.Paused; StartButton.Text = "Resume"; } else if (StartButton.Text == "Resume") { Status = CrawlStatus.Active; StartButton.Text = "Pause"; } }
private void doSetSiteStatus(Site s, CrawlStatus cs) { switch (cs) { case CrawlStatus.Completed: listView1.Items.Find(s.Name, true).First().SubItems[1].Text = "Completed"; listView1.Items.Find(s.Name, true).First().SubItems[1].BackColor = System.Drawing.Color.Green; break; case CrawlStatus.Crawling: listView1.Items.Find(s.Name, true).First().SubItems[1].Text = "Crawling"; listView1.Items.Find(s.Name, true).First().SubItems[1].BackColor = System.Drawing.Color.Blue; break; case CrawlStatus.Error: listView1.Items.Find(s.Name, true).First().SubItems[1].Text = "Error!"; listView1.Items.Find(s.Name, true).First().SubItems[1].BackColor = System.Drawing.Color.Red; break; case CrawlStatus.NotCrawled: listView1.Items.Find(s.Name, true).First().SubItems[1].Text = "Not Crawled"; listView1.Items.Find(s.Name, true).First().SubItems[1].BackColor = System.Drawing.Color.LightGray; break; case CrawlStatus.Pending: listView1.Items.Find(s.Name, true).First().SubItems[1].Text = "Pending"; listView1.Items.Find(s.Name, true).First().SubItems[1].BackColor = System.Drawing.Color.Gold; break; case CrawlStatus.Stopped: listView1.Items.Find(s.Name, true).First().SubItems[1].Text = "Stopped"; listView1.Items.Find(s.Name, true).First().SubItems[1].BackColor = System.Drawing.Color.DarkRed; break; } }
public CrawlAnnounceItem(Webpage page, CrawlStatus crawlStatus, string description, DateTime dateTime, CrawlingSharedResource crawlingSharedResource) { this.CrawlingSharedResource = crawlingSharedResource; this.Description = description; this.Page = page; this.CrawlStatus = crawlStatus; this.DateTime = dateTime; }
public CrawlAnnounceItem(Webpage page, CrawlStatus crawlStatus, string description, DateTime dateTime, CrawlingSharedResource crawlingSharedResource) { this.CrawlingSharedResource = crawlingSharedResource; this.Description = description; this.Page = page; this.CrawlStatus = crawlStatus; this.DateTime = dateTime; }
private void InitialReceives() { //perform a diff on the documents users want checked versus what's been claimed Receive <CheckDocuments>(check => { var availableDocs = new List <CrawlDocument>(); var discoveredDocs = new List <CrawlDocument>(); foreach (var doc in check.Documents) { //first time we've seen this doc if (!_recordedDocuments.ContainsKey(doc)) { _recordedDocuments[doc] = CrawlStatus.StartCrawl(check.Requestor, check.EstimatedCrawlTime ?? _defaultCrawlTime); availableDocs.Add(doc); discoveredDocs.Add(doc); } else if (_recordedDocuments[doc] .TryClaim(check.Requestor, check.EstimatedCrawlTime ?? _defaultCrawlTime)) { //TODO: add status message about new actor taking over processing here availableDocs.Add(doc); } } Sender.Tell(new ProcessDocuments(availableDocs, check.Requestor)); Sender.Tell(new DiscoveredDocuments(discoveredDocs, check.Requestor)); }); Receive <CompletedDocument>(doc => { if (!_recordedDocuments.ContainsKey(doc.Document)) { _recordedDocuments[doc.Document] = CrawlStatus.StartCrawl(doc.CompletedBy, _defaultCrawlTime); } _recordedDocuments[doc.Document].MarkAsComplete(); }); }
public void SetSiteStatus(Site s, CrawlStatus cs) { this.Invoke(new SetSiteDelegate(doSetSiteStatus), s, cs); }
private void StartButton_Click(object sender, System.EventArgs e) { if(StartButton.Text == "Start") { // copy all nodes from routing to crawl map lock(Routing.BucketList) foreach(DhtContact contact in Routing.ContactMap.Values) if (!CrawlMap.ContainsKey(contact.RoutingID)) CrawlMap[contact.RoutingID] = new CrawlNode(contact); Status = CrawlStatus.Active; StartButton.Text = "Pause"; } else if(StartButton.Text == "Pause") { Status = CrawlStatus.Paused; StartButton.Text = "Resume"; } else if(StartButton.Text == "Resume") { Status = CrawlStatus.Active; StartButton.Text = "Pause"; } }