internal override int EvaluateCore(Expression expression, EvaluationContext context, out object result) { result = null; IVRuntimeContext runtime = context as IVRuntimeContext; // 两个输入参数 string moduleID = expression.Parameters[0].ToString(); string key = expression.Parameters[1].ToString(); IDictionary output; if (!runtime.TaskOutputs.TryGetValue(moduleID, out output)) { logger.ErrorFormat("没有找到模块{0}的输出参数", moduleID); return(ResponseCode.MODULE_NOT_FOUND); } if (!output.Contains(key)) { logger.ErrorFormat("模块{0}的输出不存在参数:{1}", moduleID, key); return(ResponseCode.PROPERTY_NOT_FOUND); } result = output[key]; return(ResponseCode.SUCCESS); }
internal override int EvaluateCore(Expression expression, EvaluationContext context, out object result) { result = false; IVRuntimeContext runtime = context as IVRuntimeContext; if (expression.Parameters.Any(v => v == null)) { return(ResponseCode.EXPR_PARAMS_NULL_REFERENCE); } if (expression.Parameters.Any(v => string.IsNullOrEmpty(v.ToString()))) { return(ResponseCode.EXPR_PARAMS_NULL_REFERENCE); } string first = expression.Parameters[0].ToString(); this.PubMessage("第1个参数 = {0}", first); int total = expression.Children.Count; for (int i = 1; i < total; i++) { string current = expression.Parameters[i].ToString(); this.PubMessage("第{0}个参数 = {1}", i + 1, current); if (string.Compare(first, current, false) != 0) { result = false; return(ResponseCode.SUCCESS); } } result = true; return(ResponseCode.SUCCESS); }
internal override int EvaluateCore(Expression expression, EvaluationContext context, out object result) { result = null; IVRuntimeContext runtime = context as IVRuntimeContext; // 表达式是${XXX}类型的 if (expression.Parameters.Count == 0) { if (!runtime.MacroDefinitions.TryGetValue(expression.ExpressionText, out result)) { logger.ErrorFormat("不存在宏定义:{0}", expression.ExpressionText); return(ResponseCode.MACRO_NOT_FOUND); } else { return(ResponseCode.SUCCESS); } } // 表达式是$macro('XXX')类型的 string macroName = expression.Parameters[0].ToString(); if (string.IsNullOrEmpty(macroName)) { return(ResponseCode.EXPR_PARAMS_ILLEGAL); } if (!runtime.MacroDefinitions.TryGetValue(macroName, out result)) { logger.ErrorFormat("不存在宏定义:{0}", macroName); return(ResponseCode.MACRO_NOT_FOUND); } return(ResponseCode.SUCCESS); }