コード例 #1
0
ファイル: MainForm.cs プロジェクト: hahadalin/imewlconverter
        private IList<ISingleFilter> GetFilters()
        {
            var filters = new List<ISingleFilter>();
            if (filterConfig.NoFilter)
            {
                return filters;
            }
            if (filterConfig.IgnoreEnglish)
            {
                filters.Add(new EnglishFilter());
            }
            var lenFilter = new LengthFilter();
            lenFilter.MinLength = filterConfig.WordLengthFrom;
            lenFilter.MaxLength = filterConfig.WordLengthTo;

            if (filterConfig.WordLengthFrom > 1 || filterConfig.WordLengthTo < 9999)
            {
                filters.Add(lenFilter);
            }
            var rankFilter = new RankFilter();
            rankFilter.MaxLength = filterConfig.WordRankTo;
            rankFilter.MinLength = filterConfig.WordRankFrom;
            if (filterConfig.WordRankFrom > 1 || filterConfig.WordRankTo < 999999)
            {
                filters.Add(rankFilter);
            }
            if (filterConfig.IgnoreSpace)
            {
                filters.Add(new SpaceFilter());
            }
            if (filterConfig.IgnorePunctuation)
            {
                filters.Add(new ChinesePunctuationFilter());
                filters.Add(new EnglishPunctuationFilter());
            }
            if (filterConfig.IgnoreNumber)
            {
                filters.Add(new NumberFilter());
            }

            return filters;
        }
コード例 #2
0
ファイル: MainForm.cs プロジェクト: yongsun/imewlconverter
        private IList<ISingleFilter> GetFilters()
        {
            var filters = new List<ISingleFilter>();
            if (filterEnglish)
            {
                filters.Add(new EnglishFilter());
            }
            var lenFilter = new LengthFilter();
                lenFilter.MinLength = minLength;
                lenFilter.MaxLength = maxLength;

            if (minLength>1 || maxLength<9999)
            {
                filters.Add(lenFilter);
            }
            var rankFilter = new RankFilter();
            rankFilter.MaxLength = maxRank;
            rankFilter.MinLength = minRank;
            if (minRank > 1 || maxRank < 999999)
            {
                filters.Add(rankFilter);
            }
            if (filterSpaceWord)
            {
                filters.Add(new SpaceFilter());
            }
            return filters;
        }