public ValidationResult IsFormulaValid( string formula, ThresholdLevel level, ThresholdOperatorEnum thresholdOperator) { if (this.get_Log().get_IsDebugEnabled()) { this.get_Log().DebugFormat("Validating formula: {0} ...", (object)formula); } ValidationResult validationResult; try { validationResult = this._preProcessor.PreValidateFormula(formula, level, thresholdOperator); if (validationResult.get_IsValid()) { formula = this._preProcessor.PreProcessFormula(formula, level, thresholdOperator); this._variables = CoreThresholdProcessor.CreateVariables(CoreThresholdProcessor.CreateDefaultBaselineValues()); this.TryParse(formula, true); validationResult = ValidationResult.CreateValid(); } } catch (InvalidInputException ex) { validationResult = !ex.get_HasError() ? new ValidationResult(false, ((Exception)ex).Message) : new ValidationResult(false, (IEnumerable <string>)((IEnumerable <ExprEvalErrorDescription>)ex.get_Errors()).Select <ExprEvalErrorDescription, string>((Func <ExprEvalErrorDescription, string>)(er => CoreThresholdProcessor.GetErrorMessage(er))).ToArray <string>()); } catch (Exception ex) { this.get_Log().Error((object)string.Format("Unexpected error when validating formula: {0} ", (object)formula), ex); validationResult = new ValidationResult(false, ex.Message); } return(validationResult); }
// Token: 0x060004CE RID: 1230 RVA: 0x0001E2F0 File Offset: 0x0001C4F0 public ValidationResult IsFormulaValid(string formula, ThresholdLevel level, ThresholdOperatorEnum thresholdOperator) { if (base.Log.IsDebugEnabled) { base.Log.DebugFormat("Validating formula: {0} ...", formula); } ValidationResult validationResult; try { validationResult = this._preProcessor.PreValidateFormula(formula, level, thresholdOperator); if (validationResult.IsValid) { formula = this._preProcessor.PreProcessFormula(formula, level, thresholdOperator); this._variables = CoreThresholdProcessor.CreateVariables(CoreThresholdProcessor.CreateDefaultBaselineValues()); base.TryParse(formula, true); validationResult = ValidationResult.CreateValid(); } } catch (InvalidInputException ex) { if (ex.HasError) { validationResult = new ValidationResult(false, (from er in ex.Errors select CoreThresholdProcessor.GetErrorMessage(er)).ToArray <string>()); } else { validationResult = new ValidationResult(false, ex.Message); } } catch (Exception ex2) { base.Log.Error(string.Format("Unexpected error when validating formula: {0} ", formula), ex2); validationResult = new ValidationResult(false, ex2.Message); } return(validationResult); }