Beispiel #1
0
 public bool matches(Tag t)
 {
     for (int i = 1; i <= symbs.Len; i++)
     {
         Reach  value = t.val(symbs[i]);
         string comp  = comps[i];
         string ptn   = patts[i];
         bool   neg   = comp.StartsWith("!");
         if (neg)
         {
             comp = comp.Substring(1);
         }
         if (comp.Equals("=="))
         {
             if (neg ^ value.equals(ptn))
             {
                 return(true);
             }
         }
         else if (comp.Equals("°="))
         {
             if (neg ^ value.Equals(ptn))
             {
                 return(true);
             }
         }
         else if (comp.Equals("~~"))
         {
             if (neg ^ new Regex(ptn).IsMatch(value.text))
             {
                 return(true);
             }
         }
         else if (comp.Equals("°~"))
         {
             if (neg ^ new Regex(ptn.ToUpper()).IsMatch(value.uText))
             {
                 return(true);
             }
         }
         else
         {
             throw new Exception("Invalid Compare Operator for Tag Filter! Use one of these: == °= ~~ °~ !== !°= !~~ !°~");
         }
     }
     return(false);
 }