CheckCondition.cs 889 B

1234567891011121314151617181920212223242526272829303132
  1. using IwbZero.Expr;
  2. using IwbZero.ToolCommon.StringModel;
  3. namespace WeEngine.Functions
  4. {
  5. public class CheckCondition : RunTimeBase,IFunction
  6. {
  7. public string Invoke(ExprObject exprObj)
  8. {
  9. var child = exprObj.GetChild(0);
  10. GetPackage(child.Expr);
  11. //Rp.StartPackage();
  12. var child2 = exprObj.GetChild(2);
  13. var node = Rp.GetNodeByPath(child2?.Expr);
  14. if (node == null)
  15. {
  16. return "FALSE";
  17. }
  18. var child3 = exprObj.GetChild(4);
  19. if (child3!=null)
  20. {
  21. if (child3.ElementType == ExprElements.Value)
  22. {
  23. return child3.Expr.ValB().ToString().UAndT();
  24. }
  25. return ExprModule.Evaluate(child3.Expr);
  26. }
  27. return "TRUE";
  28. }
  29. }
  30. }