示例#1
0
        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;
     }
 }
示例#3
0
 public TextRuleAttribute(TextMatchType matchType, string text)
     : base(MessageType.Text)
 {
     MatchType = matchType;
     Text      = text;
 }
示例#4
0
 public VoiceRuleAttribute(TextMatchType matchType, string text)
     : base(MessageType.Voice)
 {
     MatchType = matchType;
     Text      = text;
 }
 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;
 }