Пример #1
0
        public WebsiteParser(WebsiteParserRequest WebsiteParserRequest)
        {
            taskId           = WebsiteParserRequest.TaskId;
            baseUrl          = WebsiteParserRequest.DomainName;
            maxDeep          = WebsiteParserRequest.MaxDeep;
            domainExtentions = WebsiteParserRequest.DomainExtentions;
            domainName       = WebsiteParserRequest.DomainName;
            domainLevel      = WebsiteParserRequest.DomainLevel;

            DicAllInternalUrls = new Dictionary <string, int>();
        }
Пример #2
0
        public MultiThreadWebsiteParser(MultiThreadWebsiteParserRequest MultiThreadWebsiteParserRequest)
        {
            tasks = new List <Task>();

            maxDeep          = MultiThreadWebsiteParserRequest.MaxDeep;
            domainLevel      = MultiThreadWebsiteParserRequest.EDomainLevel;
            domainExtentions = MultiThreadWebsiteParserRequest.DomainExtentions;

            WebSitesConcurrentQueue.WebSites    = new ConcurrentQueue <string>(MultiThreadWebsiteParserRequest.WebsiteUrls);
            WebSitesConcurrentQueue.AllWebSites = new ConcurrentQueue <string>();
        }
Пример #3
0
        public static bool IsCorrectDomainLevel(string domainName, EDomainLevel EDomainLevel)
        {
            bool result = false;

            domainName = domainName.Replace("www.", "");

            switch (EDomainLevel)
            {
            case EDomainLevel.SecondLevel:
                result = domainName.Split('.').Length == 3;
                break;

            case EDomainLevel.ThirdLevel:
                result = domainName.Split('.').Length == 4;
                break;
            }

            return(result);
        }