private void AddRule(string fullPath, EvaluatorRule evaluatorRule)
 {
     if (evaluatorRule == null)
     {
         return;
     }
     _rwLocker.EnterWriteLock();
     try
     {
         if (_rules.ContainsKey(fullPath))
         {
             _logger.Warn(String.Format("Rule from file {0} already added.", fullPath));
             return;
         }
         _rules.Add(fullPath, evaluatorRule);
         evaluatorRule.Config.WatchForChanges();
         evaluatorRule.Config.ConfigChanged += UpdateRule;
         evaluatorRule.Config.ConfigRenamed += RenameRule;
         _logger.Info("New rule added " + evaluatorRule.Id);
     }
     finally
     {
         _rwLocker.ExitWriteLock();
     }
 }
        private void UpdateRule(object sender, ConfigChangedEventArgs e)
        {
            EvaluatorRule rule = CreateEvaluatorRule(e.ConfigPath);

            RemoveRule(e.ConfigPath);
            AddRule(e.ConfigPath, rule);
        }
 private static EvaluatorRule CreateEvaluatorRule(string filePath)
 {
     EvaluatorRule rule = null;
     try
     {
         FileInfo fileInfo = new FileInfo(filePath);
         EvaluatorRuleConfig evaluatorRuleConfig = new EvaluatorRuleConfig(fileInfo.FullName);
         rule = new EvaluatorRule(evaluatorRuleConfig);
     }
     catch (Exception ex)
     {
         _logger.Error("Cannot create rule from rule config file " + filePath + ": " + ex);
     }
     return rule;
 }
        private static EvaluatorRule CreateEvaluatorRule(string filePath)
        {
            EvaluatorRule rule = null;

            try
            {
                FileInfo            fileInfo            = new FileInfo(filePath);
                EvaluatorRuleConfig evaluatorRuleConfig = new EvaluatorRuleConfig(fileInfo.FullName);
                rule = new EvaluatorRule(evaluatorRuleConfig);
            }
            catch (Exception ex)
            {
                _logger.Error("Cannot create rule from rule config file " + filePath + ": " + ex);
            }
            return(rule);
        }
 private void AddRule(string fullPath, EvaluatorRule evaluatorRule)
 {
     if (evaluatorRule == null) return;
     _rwLocker.EnterWriteLock();
     try
     {
         if (_rules.ContainsKey(fullPath))
         {
             _logger.Warn(String.Format("Rule from file {0} already added.", fullPath));
             return;
         }
         _rules.Add(fullPath, evaluatorRule);
         evaluatorRule.Config.WatchForChanges();
         evaluatorRule.Config.ConfigChanged += UpdateRule;
         evaluatorRule.Config.ConfigRenamed += RenameRule;
         _logger.Info("New rule added " + evaluatorRule.Id);
     }
     finally
     {
         _rwLocker.ExitWriteLock();
     }
 }