Esempio n. 1
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="crawlerSetting">Settings for this job</param>
        /// <param name="host">the host to do crawling on it</param>
        /// <param name="threadsNumber">number of threads for crawling the specified host</param>
        public Crawler(CrawlSetting crawlerSetting, Host[] hosts, int threadsNumber = 1)
        {
            _crawlSetting = crawlerSetting;
            _threadsNumber = threadsNumber;

            for (int i = 0; i < hosts.Length; i++)
            {
                if (!Uri.IsWellFormedUriString(hosts[i].HostName, UriKind.Absolute))
                {
                    throw new InvalidDataException(string.Format("invalid host name : {0}",hosts[i].HostName));
                }
            }

            _hosts = hosts;
        }
Esempio n. 2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="crawlerSetting">Settings for this job</param>
        /// <param name="host">the host to do crawling on it</param>
        /// <param name="threadsNumber">number of threads for crawling the specified host</param>
        public Crawler(CrawlSetting crawlerSetting, Host[] hosts, int threadsNumber = 1)
        {
            _crawlSetting  = crawlerSetting;
            _threadsNumber = threadsNumber;

            for (int i = 0; i < hosts.Length; i++)
            {
                if (!Uri.IsWellFormedUriString(hosts[i].HostName, UriKind.Absolute))
                {
                    throw new InvalidDataException(string.Format("invalid host name : {0}", hosts[i].HostName));
                }
            }

            _hosts = hosts;
        }