public async Task <IEnumerable <TldRule> > BuildAsync()
        {
            string ruleData = await LoadFromFile().ConfigureAwait(false);

            TldRuleParser         ruleParser = new TldRuleParser();
            IEnumerable <TldRule> rules      = ruleParser.ParseRules(ruleData);

            return(rules);
        }
Exemple #2
0
        public async Task <IEnumerable <TldRule> > BuildAsync()
        {
            TldRuleParser ruleParser = new TldRuleParser();

            string ruleData;

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

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

            IEnumerable <TldRule> rules = ruleParser.ParseRules(ruleData);

            return(rules);
        }