Ejemplo n.º 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);
        }
Ejemplo n.º 2
0
 public Crawler(int maximalDepth)
 {
     this.maximalDepth = maximalDepth;
     this.result       = new CrawlResult();
 }
Ejemplo n.º 3
0
 public void addResult(CrawlResult result)
 {
     this.results.AddLast(result);
 }