예제 #1
0
        private bool MatchFileName(string FileName, string FileNamePattern, string DefaultNameSpace)
        {
            Regex regex;

            try
            {
                regex = regexBuilder.Build(DefaultNameSpace, FileNamePattern, false);
                return(regex.Match(FileName).Success);
            }
            catch (Exception ex)
            {
                Log(ex);
                return(false);
            }
        }
예제 #2
0
        public IStringMatcher CreateStringMatcher(string NameSpace, IEnumerable <string> Patterns)
        {
            StringMatcher matcher;
            Regex         regex;

            matcher = new StringMatcher();
            foreach (string pattern in Patterns)
            {
                if (!Try(() => regexBuilder.Build(NameSpace, pattern, false)).OrAlert(out regex, $"Failed to build regex: {pattern}"))
                {
                    continue;
                }
                matcher.Add(regex);
            }
            return(matcher);
        }