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); } }
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); }