예제 #1
0
파일: Policy.cs 프로젝트: zszqwe/anycmd
        /// <summary>
        /// Match the target of this policy.
        /// </summary>
        /// <param name="context">The evaluation context instance.</param>
        /// <returns>The retult evaluation of the policy target.</returns>
        public TargetEvaluationValue Match(EvaluationContext context)
        {
            if (context == null)
            {
                throw new ArgumentNullException("context");
            }
            var targetEvaluationValue = TargetEvaluationValue.Indeterminate;

            context.Trace("Evaluating Target...");
            context.AddIndent();
            try
            {
                // Evaluate the policy target
                targetEvaluationValue = TargetEvaluationValue.Match;
                if (_target != null)
                {
                    targetEvaluationValue = _target.Evaluate(context);
                }
                return(targetEvaluationValue);
            }
            finally
            {
                context.TraceContextValues();
                context.RemoveIndent();
                context.Trace("Target: {0}", targetEvaluationValue);
            }
        }
예제 #2
0
파일: PolicySet.cs 프로젝트: zszqwe/anycmd
        /// <summary>
        /// Match the target of this policy set.
        /// </summary>
        /// <param name="context">The evaluation context instance.</param>
        /// <returns>The retult evaluation of the policy set target.</returns>
        public TargetEvaluationValue Match(EvaluationContext context)
        {
            if (context == null)
            {
                throw new ArgumentNullException("context");
            }
            // Evaluate the policy target
            var targetEvaluationValue = TargetEvaluationValue.Match;

            if (_target != null)
            {
                targetEvaluationValue = _target.Evaluate(context);
                context.TraceContextValues();
            }
            return(targetEvaluationValue);
        }