Пример #1
0
        public static BaseCrawler CreateCralwer(FeedUriTypes uriType, string uri, string localPath, DateTime localVersion, string ua = null, ProxyType proxyType = ProxyType.NULL)
        {
            BaseCrawler crawler = null;

            switch (uriType)
            {
            case FeedUriTypes.Http:      // "http://"
                crawler = new HttpCrawler(uriType, uri, localPath, localVersion, ua, proxyType);
                break;

            case FeedUriTypes.Ftp:       // "ftp://"
                // crawler = new FtpCrawler(uriType, uri, localPath, localVersion);
                throw new NotImplementedException();

            case FeedUriTypes.SearchGold:        // //depot/
                // crawler = new SearchGoldCrawler(uriType, uri, localPath, localVersion);
                throw new NotImplementedException();

            case FeedUriTypes.ShareFolder:       // \\\\machine\\
                crawler = new FileCrawler(uriType, uri, localPath, localVersion);
                break;

            case FeedUriTypes.Cosmos:       // "https://cosmos08.osdinfra.net/cosmos/"
                crawler = new CosmosCrawler(uriType, uri, localPath, localVersion);
                break;

            default:
                throw new NotImplementedException();
            }
            crawler.UserAgent = ua;
            return(crawler);
        }
Пример #2
0
        public static BaseCrawler CreateCralwer(FeedUriTypes uriType, string uri, Encoding encoding, string localPath, DateTime localVersion, string ua = null, ProxyType proxyType = ProxyType.NULL)
        {
            BaseCrawler crawler = BaseCrawler.CreateCralwer(uriType, uri, localPath, localVersion, ua, proxyType);

            crawler.Encoding = encoding;

            return(crawler);
        }