Exemplo n.º 1
0
 /// <summary>
 /// Removes The Given Rule Object From RuleSet
 /// </summary>
 /// <param name="rule">The Rule Object To Be Removed</param>
 /// <returns></returns>
 public bool RemoveRule(Rule rule)
 {
     rule.BaseRuleList = null;
     Rules.Remove(rule);
     Rules.TrimToSize();
     return true;
 }
Exemplo n.º 2
0
 /// <summary>
 /// Search the value in the denylist and reports the deny status
 /// </summary>
 /// <param name="values">The Value To Be Checked</param>
 /// <param name="lasterror">The Last Occured Error</param>
 /// <returns>True or False according to the situation</returns>
 private bool CheckValue(string values, ref string lasterror,out Rule problemRule)
 {
     problemRule = null;
     if (values == null)
         return true;
     values = values.Trim();
     if (values.Length != 0)
     {
         if (blocklist != null)
         {
             for (int i = 0; i < blocklist.Count; i++)
             {
                 Rule txtrule = blocklist[i] as Rule;
                 if (txtrule.Check(values))
                 {
                     problemRule = txtrule;
                     lasterror = txtrule.Name;
                     log.Info("Validation Failure has been found invalidation of rule:" + txtrule.Name + " with pattern " + txtrule.Pattern + " with type " + txtrule.RuleString());
                     return false;
                 }
             }
         }
     }
     return true;
 }
Exemplo n.º 3
0
 /// <summary>
 /// Adds The Given Rule Object To The RuleSet
 /// </summary>
 /// <param name="rule"></param>
 /// <returns></returns>
 public bool AddRule(Rule rule)
 {
     Rules.Add(rule);
     rule.BaseRuleList = this;
     return true;
 }