Exemplo n.º 1
0
        protected void UpdateCommandCache()
        {
            ChannelCriterionCommandCache = new Dictionary <string, Dictionary <string, long> >();
            var newRegexes = new HashSet <string>();

            using (DemoderationContext ctx = GetNewContext())
            {
                foreach (Criterion crit in ctx.Criteria.Where(c => c.Enabled))
                {
                    Dictionary <string, long> commandCacheForChannel = ObtainCommandCacheForChannel(crit.Channel);
                    commandCacheForChannel[crit.Name] = crit.ID;

                    newRegexes.Add(crit.DetectionRegex);
                }
            }
            RegexCache.ReplaceAllWith(newRegexes);
        }
Exemplo n.º 2
0
        protected virtual void RebuildRegexCache()
        {
            var newPatterns = new HashSet <string>();

            foreach (BounceCriterion criterion in Config.Criteria)
            {
                if (criterion.ChannelRegexes != null)
                {
                    newPatterns.UnionWith(criterion.ChannelRegexes);
                }
                if (criterion.NicknameRegexes != null)
                {
                    newPatterns.UnionWith(criterion.NicknameRegexes);
                }
            }
            RegexCache.ReplaceAllWith(newPatterns);
        }