internal static bool Match(TextMatchType matchType, string text, string messageText) { if (matchType == TextMatchType.All) { return(true); } if (messageText == null) { return(false); } switch (matchType) { case TextMatchType.Exactly: return(messageText == text); case TextMatchType.StartWith: return(messageText.StartsWith(text, StringComparison.Ordinal)); case TextMatchType.Regex: return(Regex.IsMatch(messageText, text, RegexOptions.IgnoreCase | RegexOptions.Singleline)); default: return(false); } }
internal static bool Match(TextMatchType matchType, string text, string messageText) { if (matchType == TextMatchType.All) return true; if (messageText == null) return false; switch (matchType) { case TextMatchType.Exactly: return messageText == text; case TextMatchType.StartWith: return messageText.StartsWith(text, StringComparison.Ordinal); case TextMatchType.Regex: return Regex.IsMatch(messageText, text, RegexOptions.IgnoreCase | RegexOptions.Singleline); default: return false; } }
public TextRuleAttribute(TextMatchType matchType, string text) : base(MessageType.Text) { MatchType = matchType; Text = text; }
public VoiceRuleAttribute(TextMatchType matchType, string text) : base(MessageType.Voice) { MatchType = matchType; Text = text; }