///<inheritdoc/>
        public async Task<IEnumerable<TldRule>> BuildAsync()
        {
            var ruleData = await this.LoadFromFile().ConfigureAwait(false);

            var ruleParser = new TldRuleParser();
            var rules = ruleParser.ParseRules(ruleData);
            return rules;
        }
示例#2
0
        public async Task <IEnumerable <TldRule> > BuildAsync()
        {
            var ruleData = await this.LoadFromFile(_fileName);

            var ruleParser = new TldRuleParser();
            var rules      = ruleParser.ParseRules(ruleData);

            return(rules);
        }
示例#3
0
        public DomainParser()
        {
            var    reader = Kooboo.Data.Embedded.EmbeddedHelper.GetStreamReader("Kooboo.Data.tld.dat", typeof(Kooboo.Data.Models.WebSite));
            string data   = reader.ReadToEnd();

            var ruleParser = new TldRuleParser();
            var rules      = ruleParser.ParseRules(data);

            this.AddRules(rules);
        }
示例#4
0
        public async Task <IEnumerable <TldRule> > BuildAsync()
        {
            var ruleParser = new TldRuleParser();

            var ruleData = await this._cacheProvider.GetValueAsync().ConfigureAwait(false);

            if (string.IsNullOrEmpty(ruleData))
            {
                ruleData = await this.LoadFromUrl(this._fileUrl).ConfigureAwait(false);

                await this._cacheProvider.SetValueAsync(ruleData).ConfigureAwait(false);
            }

            var rules = ruleParser.ParseRules(ruleData);

            return(rules);
        }
示例#5
0
        public async Task <IEnumerable <TldRule> > BuildAsync()
        {
            var ruleParser = new TldRuleParser();

            string ruleData;

            if (!this._cacheProvider.IsCacheValid())
            {
                ruleData = await this.LoadFromUrl(this._fileUrl).ConfigureAwait(false);

                await this._cacheProvider.SetAsync(ruleData).ConfigureAwait(false);
            }
            else
            {
                ruleData = await this._cacheProvider.GetAsync().ConfigureAwait(false);
            }

            var rules = ruleParser.ParseRules(ruleData);

            return(rules);
        }