mirror of
https://gitee.com/langsisi_admin/serein-flow
synced 2026-03-02 15:50:47 +08:00
45 lines
1.1 KiB
C#
45 lines
1.1 KiB
C#
|
|
using Serein.DynamicFlow.SerinExpression;
|
|||
|
|
using System;
|
|||
|
|
using System.Collections.Generic;
|
|||
|
|
using System.Linq;
|
|||
|
|
using System.Text;
|
|||
|
|
using System.Threading.Tasks;
|
|||
|
|
|
|||
|
|
namespace Serein.DynamicFlow.NodeModel
|
|||
|
|
{
|
|||
|
|
/// <summary>
|
|||
|
|
/// Expression Operation - 表达式操作
|
|||
|
|
/// </summary>
|
|||
|
|
public class SingleExpOpNode : NodeBase
|
|||
|
|
{
|
|||
|
|
public string Expression { get; set; }
|
|||
|
|
|
|||
|
|
|
|||
|
|
public override object? Execute(DynamicContext context)
|
|||
|
|
{
|
|||
|
|
//if (PreviousNode != null && PreviousNode.FlowData == null)
|
|||
|
|
//{
|
|||
|
|
// // 存在
|
|||
|
|
// throw new InvalidOperationException("previous node data is null.");
|
|||
|
|
//}
|
|||
|
|
//else
|
|||
|
|
//{
|
|||
|
|
|
|||
|
|
//}
|
|||
|
|
var data = PreviousNode?.FlowData;
|
|||
|
|
var newData = SerinExpressionEvaluator.Evaluate(Expression, data, out bool isChange);
|
|||
|
|
FlowState = true;
|
|||
|
|
Console.WriteLine(newData);
|
|||
|
|
if (isChange)
|
|||
|
|
{
|
|||
|
|
return newData;
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
return PreviousNode?.FlowData;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|