2024-09-06 09:13:13 +08:00
|
|
|
|
using Serein.Library.SerinExpression;
|
|
|
|
|
|
using Serein.NodeFlow;
|
2024-08-06 16:09:46 +08:00
|
|
|
|
using System;
|
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
using System.Linq;
|
|
|
|
|
|
using System.Text;
|
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
|
|
|
|
|
|
namespace Serein.NodeFlow.Model
|
|
|
|
|
|
{
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Expression Operation - 表达式操作
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public class SingleExpOpNode : NodeBase
|
|
|
|
|
|
{
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 表达式
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public string Expression { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public override object? Execute(DynamicContext context)
|
|
|
|
|
|
{
|
|
|
|
|
|
var data = PreviousNode?.FlowData;
|
|
|
|
|
|
|
|
|
|
|
|
var newData = SerinExpressionEvaluator.Evaluate(Expression, data, out bool isChange);
|
|
|
|
|
|
|
2024-09-09 16:42:01 +08:00
|
|
|
|
FlowState = FlowStateType.Succeed;
|
2024-08-06 16:09:46 +08:00
|
|
|
|
Console.WriteLine(newData);
|
|
|
|
|
|
if (isChange)
|
|
|
|
|
|
{
|
|
|
|
|
|
return newData;
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
return PreviousNode?.FlowData;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|