更改了dll参数类型,更改了流程执行,添加了异常分支处理

This commit is contained in:
fengjiayi
2024-09-09 16:42:01 +08:00
parent b33c9ba857
commit 10f9738a2c
18 changed files with 541 additions and 490 deletions

View File

@@ -14,16 +14,22 @@
MethodDetails ??= node.MethodDetails;
}
/// <summary>
/// 条件节点重写执行方法
/// </summary>
/// <param name="context"></param>
/// <returns></returns>
public override object? Execute(DynamicContext context)
{
// bool allTrue = ConditionNodes.All(condition => Judge(context,condition.MethodDetails));
// bool IsAllTrue = true; // 初始化为 true
FlowState = true;
FlowState = FlowStateType.Succeed;
foreach (SingleConditionNode? node in ConditionNodes)
{
if (!Judge(context, node))
var state = Judge(context, node);
if (state == FlowStateType.Fail || FlowStateType.Fail == FlowStateType.Error)
{
FlowState = false;
FlowState = state;
break;// 一旦发现条件为假,立即退出循环
}
}
@@ -44,7 +50,7 @@
// }
//}
}
private bool Judge(DynamicContext context, SingleConditionNode node)
private FlowStateType Judge(DynamicContext context, SingleConditionNode node)
{
try
{
@@ -54,8 +60,8 @@
catch (Exception ex)
{
Console.WriteLine(ex.Message);
return FlowStateType.Error;
}
return false;
}