/// <summary> /// Construct a spider object. The options parameter /// specifies the options for this spider. The report /// parameter specifies the class that the spider is to /// report progress to. /// </summary> /// <param name="options">The configuration options for this spider.</param> /// <param name="report">A SpiderReportable class to report progress to</param> public Spider(SpiderOptions options, SpiderReportable report) { this.options = options; this.report = report; this.workloadManager = (WorkloadManager)Assembly.GetExecutingAssembly().CreateInstance(this.options.WorkloadManager); this.workloadManager.Init(this); report.Init(this); // add filters if (options.Filter != null) { foreach (String name in options.Filter) { SpiderFilter filter = (SpiderFilter)Assembly.GetExecutingAssembly().CreateInstance(name); if (filter == null) { throw new SpiderException("Invalid filter specified: " + name); } this.filters.Add(filter); } } // perform startup if (String.Compare(options.Startup, SpiderOptions.STARTUP_RESUME) == 0) { this.workloadManager.Resume(); } else { this.workloadManager.Clear(); } }
/// <summary> /// Construct a spider object. The options parameter /// specifies the options for this spider. The report /// parameter specifies the class that the spider is to /// report progress to. /// </summary> /// <param name="options">The configuration options for this spider.</param> /// <param name="report">A SpiderReportable class to report progress to</param> public Spider(SpiderOptions options, SpiderReportable report) { this.options = options; this.report = report; this.workloadManager = (WorkloadManager)Assembly.GetExecutingAssembly().CreateInstance(this.options.WorkloadManager); this.workloadManager.Init(this); report.Init(this); // add filters if (options.Filter != null) { foreach (String name in options.Filter) { SpiderFilter filter = (SpiderFilter)Assembly.GetExecutingAssembly().CreateInstance(name); if (filter == null) throw new SpiderException("Invalid filter specified: " + name); this.filters.Add(filter); } } // perform startup if (String.Compare(options.Startup, SpiderOptions.STARTUP_RESUME) == 0) { this.workloadManager.Resume(); } else { this.workloadManager.Clear(); } }