Ejemplo n.º 1
0
        /// <summary>
        /// This method is called by main to check a link. After
        /// spidering through the site, the final list of bad links
        /// is displayed.
        /// </summary>
        /// <param name="url">The URL to check for bad links.</param>
        public void check(Uri url)
        {
            SpiderOptions options = new SpiderOptions();
            options.WorkloadManager = typeof(MemoryWorkloadManager).FullName;
            LinkReport report = new LinkReport();
            Spider spider = new Spider(options, report);
            spider.AddURL(url, null, 1);

            spider.Process();
            Console.WriteLine(spider.Status);

            if (report.Bad.Count > 0)
            {
                Console.WriteLine("Bad Links Found:");
                foreach (String str in report.Bad)
                {
                    Console.WriteLine(str);
                }
            }
            else
            {
                Console.WriteLine("No bad links were found.");
            }

        }
Ejemplo n.º 2
0
 /// <summary>
 /// Download an entire site.
 /// </summary>
 /// <param name="config">The spider configuration file to use.</param>
 /// <param name="baseHost">The URL to start from.</param>
 /// <param name="local">The local path to save files to.</param>
 public void Download(String config, Uri baseHost, String local)
 {
     WorldSpiderReport report = new WorldSpiderReport(local);
     SpiderOptions options = new SpiderOptions();
     options.Load(config);
     Spider spider = new Spider(options, report);
     spider.AddURL(baseHost, null, 1);
     spider.Process();
     Console.WriteLine(spider.Status);
 }
        /// <summary>
        /// Download an entire site.
        /// </summary>
        /// <param name="config">The spider configuration file to use.</param>
        /// <param name="baseURL">The URL to start from.></param>
        /// <param name="local">The local path to save files to.</param>
        public void Download(String config, Uri baseURL, String local)
        {
            SpiderReport report = new SpiderReport(local);
            SpiderOptions options = new SpiderOptions();
            options.Load(config);
            Spider spider = new Spider(options, report);
            spider.Logging.Console = true;
            spider.Logging.Filename = "c:\\spider.log";
            spider.Logging.Clear();

            spider.AddURL(baseURL, null, 1);
            spider.Process();
            Console.WriteLine(spider.Status);
        }