mirror of
https://gitee.com/langsisi_admin/serein-flow
synced 2026-03-13 13:09:25 +08:00
修复了全局节点连接异常异常。
This commit is contained in:
@@ -7,7 +7,7 @@ using System.ComponentModel;
|
||||
using System.Net.Mime;
|
||||
using System.Threading;
|
||||
|
||||
namespace Serein.NodeFlow.Model
|
||||
namespace Serein.NodeFlow.Model.Nodes
|
||||
{
|
||||
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
using Serein.Library;
|
||||
using Serein.Library.Api;
|
||||
|
||||
namespace Serein.NodeFlow.Model
|
||||
namespace Serein.NodeFlow.Model.Nodes
|
||||
{
|
||||
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
using Serein.Library;
|
||||
using System.Security.AccessControl;
|
||||
|
||||
namespace Serein.NodeFlow.Model
|
||||
namespace Serein.NodeFlow.Model.Nodes
|
||||
{
|
||||
/// <summary>
|
||||
/// 单动作节点(用于动作控件)
|
||||
|
||||
@@ -4,7 +4,7 @@ using Serein.Script;
|
||||
using System.Dynamic;
|
||||
using System.Linq.Expressions;
|
||||
|
||||
namespace Serein.NodeFlow.Model
|
||||
namespace Serein.NodeFlow.Model.Nodes
|
||||
{
|
||||
/// <summary>
|
||||
/// 条件节点(用于条件控件)
|
||||
@@ -177,7 +177,7 @@ namespace Serein.NodeFlow.Model
|
||||
context.ExceptionOfRuning = ex;
|
||||
}
|
||||
|
||||
SereinEnv.WriteLine(InfoType.INFO, $"{result} {Expression} -> " + context.NextOrientation);
|
||||
SereinEnv.WriteLine(InfoType.INFO, $"{Expression} -> " + context.NextOrientation);
|
||||
//return result;
|
||||
return new FlowResult(this.Guid, context, judgmentResult);
|
||||
}
|
||||
@@ -236,19 +236,18 @@ namespace Serein.NodeFlow.Model
|
||||
var dataName = nameof(data);
|
||||
if (!expression.Equals(conditionExpression))
|
||||
{
|
||||
conditionExpression = expression;
|
||||
conditionExpression = expression.Trim();
|
||||
conditionScript = new SereinScript();
|
||||
var dataType = data is null ? typeof(object) : data.GetType();
|
||||
conditionExpression = expression.Trim();
|
||||
if (expression[0] == '.')
|
||||
{
|
||||
// 对象取值
|
||||
conditionExpression = $"return {dataName}{expression};";
|
||||
conditionExpression = $"return {dataName}{conditionExpression};";
|
||||
}
|
||||
else
|
||||
{
|
||||
// 直接表达式
|
||||
conditionExpression = $"return {dataName}.{expression};";
|
||||
conditionExpression = $"return {dataName}.{conditionExpression};";
|
||||
}
|
||||
var resultType = conditionScript.ParserScript(conditionExpression, new Dictionary<string, Type>
|
||||
{
|
||||
|
||||
@@ -3,7 +3,7 @@ using Serein.Library.Api;
|
||||
using Serein.Script;
|
||||
using System.Dynamic;
|
||||
|
||||
namespace Serein.NodeFlow.Model
|
||||
namespace Serein.NodeFlow.Model.Nodes
|
||||
{
|
||||
/// <summary>
|
||||
/// Expression Operation - 表达式操作
|
||||
|
||||
@@ -3,13 +3,14 @@ using Serein.Library;
|
||||
using Serein.Library.Utils;
|
||||
using System;
|
||||
|
||||
namespace Serein.NodeFlow.Model
|
||||
namespace Serein.NodeFlow.Model.Nodes
|
||||
{
|
||||
/// <summary>
|
||||
/// 触发器节点
|
||||
/// </summary>
|
||||
public class SingleFlipflopNode : NodeModelBase
|
||||
{
|
||||
|
||||
public SingleFlipflopNode(IFlowEnvironment environment) : base(environment)
|
||||
{
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ using Serein.NodeFlow.Services;
|
||||
using System.Dynamic;
|
||||
using System.Reflection;
|
||||
|
||||
namespace Serein.NodeFlow.Model
|
||||
namespace Serein.NodeFlow.Model.Nodes
|
||||
{
|
||||
|
||||
[NodeProperty(ValuePath = NodeValuePath.Node)]
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
using Serein.Library.Api;
|
||||
using System.Dynamic;
|
||||
|
||||
namespace Serein.NodeFlow.Model
|
||||
namespace Serein.NodeFlow.Model.Nodes
|
||||
{
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ namespace Serein.NodeFlow.Model
|
||||
public partial class SingleGlobalDataNode : NodeModelBase
|
||||
{
|
||||
/// <summary>
|
||||
/// 表达式
|
||||
/// 全局数据的Key名称
|
||||
/// </summary>
|
||||
[PropertyInfo(IsNotification = true)]
|
||||
private string _keyName;
|
||||
@@ -43,7 +43,7 @@ namespace Serein.NodeFlow.Model
|
||||
/// <summary>
|
||||
/// 数据来源的节点
|
||||
/// </summary>
|
||||
private IFlowNode? DataNode;
|
||||
public IFlowNode? DataNode { get; private set; } = null;
|
||||
|
||||
/// <summary>
|
||||
/// 有节点被放置
|
||||
@@ -52,12 +52,27 @@ namespace Serein.NodeFlow.Model
|
||||
/// <returns></returns>
|
||||
public bool PlaceNode(IFlowNode nodeModel)
|
||||
{
|
||||
if(nodeModel.ControlType is not (NodeControlType.Action or NodeControlType.Script))
|
||||
{
|
||||
SereinEnv.WriteLine(InfoType.INFO, "放置在全局数据必须是有返回值的[Action]节点,[Script]节点。");
|
||||
return false;
|
||||
}
|
||||
if (nodeModel.MethodDetails?.ReturnType is null
|
||||
|| nodeModel.MethodDetails.ReturnType == typeof(void))
|
||||
{
|
||||
SereinEnv.WriteLine(InfoType.INFO, "放置在全局数据必须是有返回值的[Action]节点,[Script]节点。");
|
||||
return false;
|
||||
}
|
||||
|
||||
if(DataNode is null)
|
||||
{
|
||||
// 放置节点
|
||||
nodeModel.ContainerNode = this;
|
||||
ChildrenNode.Add(nodeModel);
|
||||
DataNode = nodeModel;
|
||||
|
||||
MethodDetails.IsAsync = nodeModel.MethodDetails.IsAsync;
|
||||
MethodDetails.ReturnType = nodeModel.MethodDetails.ReturnType;
|
||||
return true;
|
||||
}
|
||||
else if (DataNode.Guid != nodeModel.Guid)
|
||||
|
||||
@@ -8,7 +8,7 @@ using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Serein.NodeFlow.Model
|
||||
namespace Serein.NodeFlow.Model.Nodes
|
||||
{
|
||||
|
||||
[NodeProperty(ValuePath = NodeValuePath.Node)]
|
||||
|
||||
@@ -13,7 +13,7 @@ using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Xml.Linq;
|
||||
|
||||
namespace Serein.NodeFlow.Model
|
||||
namespace Serein.NodeFlow.Model.Nodes
|
||||
{
|
||||
|
||||
[NodeProperty(ValuePath = NodeValuePath.Node)]
|
||||
@@ -263,20 +263,6 @@ namespace Serein.NodeFlow.Model
|
||||
{
|
||||
if (token.IsCancellationRequested) return new FlowResult(this.Guid, context);
|
||||
var @params = await flowCallNode.GetParametersAsync(context, token);
|
||||
//if (token.IsCancellationRequested) return new FlowResult(this.Guid, context);
|
||||
//context.AddOrUpdate($"{context.Guid}_{this.Guid}_Params", @params[0]); // 后面再改
|
||||
|
||||
/* if (IsScriptChanged)
|
||||
{
|
||||
lock (@params) {
|
||||
if (IsScriptChanged)
|
||||
{
|
||||
ReloadScript();// 执行时检查是否需要重新解析
|
||||
IsScriptChanged = false;
|
||||
context.Env.WriteLine(InfoType.INFO, $"[{Guid}]脚本解析完成");
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
IScriptInvokeContext scriptContext = new ScriptInvokeContext(context);
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Serein.NodeFlow.Model
|
||||
namespace Serein.NodeFlow.Model.Nodes
|
||||
{
|
||||
public class SingleUINode : NodeModelBase
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user