Example #1
0
        public void BuildOrUpdateComponent(FilterType filterType, List <FilterItem> itemsToFilter)
        {
            if (!itemsToFilter.Any())
            {
                if (FilterComponents.ContainsKey(filterType))
                {
                    FilterComponents.Remove(filterType);
                }
            }

            IFilterComponent component;

            switch (filterType)
            {
            case FilterType.WordWhiteList:
                component = new WordWhitelistComponent(itemsToFilter);
                break;

            case FilterType.WordBlackList:
                component = new WordBlackListComponent(itemsToFilter);
                break;

            case FilterType.UserWhiteList:
                component = new UserWhitelistComponent(itemsToFilter);
                break;

            case FilterType.UserBlackList:
                component = new UserBlacklistComponent(itemsToFilter);
                break;

            default:
                return;
            }
            FilterComponents[filterType] = component;
        }
        public void BuildOrUpdateComponent(FilterType filterType, List <string> stringsToFilter)
        {
            if (!stringsToFilter.Any())
            {
                return;
            }
            List <FilterItem> toFilter = BuildFilterItems(stringsToFilter);
            IFilterComponent  component;

            switch (filterType)
            {
            case FilterType.WordWhiteList:
                component = new WordWhitelistComponent(toFilter);
                break;

            case FilterType.WordBlackList:
                component = new WordBlackListComponent(toFilter);
                break;

            case FilterType.UserWhiteList:
                component = new UserWhitelistComponent(toFilter);
                break;

            case FilterType.UserBlackList:
                component = new UserBlacklistComponent(toFilter);
                break;

            default:
                return;
            }
            FilterComponents[filterType] = component;
        }