Beispiel #1
0
        public async Task <CrawlResult> PerformCrawlingAsync(LinkedList <string> links, int depth)
        {
            CrawlResult currentCrawlResult = new CrawlResult();

            foreach (string link in links)
            {
                try
                {
                    Site currentSite = null;
                    if (depth < maximalDepth)
                    {
                        currentSite = SiteSurfer.watchSite(link);
                        if (currentSite.InnerLinks != null)
                        {
                            currentCrawlResult = await PerformCrawlingAsync(currentSite.InnerLinks, depth + 1);
                        }
                        if (currentCrawlResult != null)
                        {
                            result.addResult(currentCrawlResult);
                        }
                        currentCrawlResult.setSite(currentSite);
                    }
                }
                catch {
                    throw new Exception();
                }
            }
            return(result);
        }
Beispiel #2
0
 public Crawler(int maximalDepth)
 {
     this.maximalDepth = maximalDepth;
     this.result       = new CrawlResult();
 }
Beispiel #3
0
 public void addResult(CrawlResult result)
 {
     this.results.AddLast(result);
 }