Пример #1
0
        public bool Analyze(HealthcheckData healthcheckData, ICollection <DomainKey> AllowedMigrationDomains)
        {
            bool hasTheRuleMatched = false;

            // PingCastle 2.5
            Points = 0;
            int?valueReturnedByAnalysis = AnalyzeDataNew(healthcheckData, AllowedMigrationDomains);

            if (valueReturnedByAnalysis == null)
            {
                valueReturnedByAnalysis = 0;
                if (Details != null)
                {
                    valueReturnedByAnalysis = Details.Count;
                }
            }
            foreach (var computation in RuleComputation)
            {
                int points = 0;
                if (computation.HasMatch((int)valueReturnedByAnalysis, ref points))
                {
                    hasTheRuleMatched = true;
                    Points            = points;
                    if (DetailRationale != null)
                    {
                        Rationale = DetailRationale;
                        Rationale = Rationale.Replace("{count}", valueReturnedByAnalysis.ToString());
                        Rationale = Rationale.Replace("{threshold}", computation.Threshold.ToString());
                    }
                    break;
                }
            }
            return(hasTheRuleMatched);
        }
Пример #2
0
 protected virtual void UpdateLabelsAfterMatch(int valueReturnedByAnalysis, RuleComputationAttribute computation)
 {
     if (DetailRationale != null)
     {
         Rationale = DetailRationale;
         Rationale = Rationale.Replace("{count}", valueReturnedByAnalysis.ToString());
         Rationale = Rationale.Replace("{threshold}", computation.Threshold.ToString());
     }
 }