private string userAgent; //User-Agent

        #endregion Fields

        #region Constructors

        /// <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();
        }
Example #2
0
        /// <summary>
        /// 构造函数
        /// </summary>
        private Url()
        {
            this.uri = null;
            this.uriEscape = true;
            this.checkSum = UInt32.MinValue;
            this.hostCheckSum = UInt32.MinValue;
            this.checkSumAlgorith = new GeneralUrlCheckSum(true);
            this.httpMethod = "GET";
            this.appendParams = null;
            this.maxTryTimes = 1;
            this.hasTriedTimes = 0;
            this.hasError = false;
            this.errorMsg = "";
            this.text = "";

            this.contentHandlers = new ContentHandlerCollection();

            this.domain = null;
            this.domainSuffixProvider = Core.DomainSuffixProvider.Default;

            this.allowExtractUrl = true;
        }
 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));
 }
Example #4
0
 protected Url(SerializationInfo info,StreamingContext context)
 {
     this.uri = info.GetValue("uri", typeof(Uri)) as Uri;
     this.uriEscape = info.GetBoolean("escape");
     this.checkSum = info.GetUInt32("checkSum");
     this.hostCheckSum = info.GetUInt32("hostCheckSum");
     this.checkSumAlgorith = info.GetValue("checkSumAlgorith", typeof(IUrlCheckSum)) as IUrlCheckSum;
     this.httpMethod = info.GetString("httpMethod");
     this.appendParams = info.GetValue("appendParams", typeof(NameValueCollection)) as NameValueCollection;
     this.ignoreParams = info.GetValue("ignoreParams", typeof(NameValueCollection)) as NameValueCollection;
     this.maxTryTimes = info.GetInt32("maxTryTimes");
     this.hasTriedTimes = info.GetInt32("hasTriedTimes");
     this.hasError = info.GetBoolean("hasError");
     this.errorMsg = info.GetString("errorMsg");
     this.contentHandlers = info.GetValue("contentHandlers", typeof(ContentHandlerCollection)) as ContentHandlerCollection;
     this.text = info.GetString("text");
     this.domainSuffixProvider = info.GetValue("domainSuffixProvider", typeof(IDomainSuffixPrivoder)) as IDomainSuffixPrivoder;
     this.allowExtractUrl = info.GetBoolean("allowExtractUrl");
 }