private SpeedModes speedMode; //采集速度模式 /// <summary> /// 构造函数 /// </summary> public SpiderSetting() { this.maxDepth = 5; this.requestTimeout = 0; this.iOTimeout = 0; this.readBufferSize = 1024; this.crawlThreads = 1; this.processThreads = 1; this.userAgent = DefaultUserAgent; this.referer = ""; this.requestEncoding = Encoding.Default; this.memLimitSize = 102400; this.depositePath = ""; this.speedMode = SpeedModes.Normal; this.contentHandlers = new ContentHandlerCollection(); }
protected SpiderSetting(SerializationInfo info, StreamingContext context) { this.name = info.GetString("name"); this.startUrl = info.GetValue("startUrl", typeof(StartUrl)) as StartUrl; this.maxDepth = info.GetInt16("maxDepth"); this.allowRedirect = info.GetBoolean("allowRedirect"); this.requestTimeout = info.GetInt32("requestTimeout"); this.iOTimeout = info.GetInt32("iOTimeout"); this.readBufferSize = info.GetInt32("readBufferSize"); this.crawlThreads = info.GetInt16("crawlThreads"); this.processThreads = info.GetInt16("processThreads"); this.proxy = info.GetValue("proxy", typeof(IWebProxy)) as IWebProxy; this.userAgent = info.GetString("userAgent"); this.referer = info.GetString("referer"); this.cookies = info.GetValue("cookies", typeof(CookieCollection)) as CookieCollection; this.requestEncoding = info.GetValue("requestEncoding", typeof(Encoding)) as Encoding; this.urlExtractor = info.GetValue("urlExtractor", typeof(UrlExtractor)) as UrlExtractor; this.contentHandlers = info.GetValue("contentHandlers", typeof(ContentHandlerCollection)) as ContentHandlerCollection; this.logger = info.GetValue("logger", typeof(ILogger)) as ILogger; this.memLimitSize = info.GetInt32("memLimitSize"); this.depositePath = info.GetString("depositePath"); this.speedMode = (SpeedModes)info.GetValue("speedMode", typeof(SpeedModes)); }