优化了节点连接

This commit is contained in:
fengjiayi
2024-10-28 15:21:08 +08:00
parent f20cfb755c
commit 561b6d764f
28 changed files with 295 additions and 165 deletions

View File

@@ -2,6 +2,7 @@
using Serein.Library.Utils;
using System;
using System.Linq;
using System.Text;
namespace Serein.Library
{
@@ -12,7 +13,7 @@ namespace Serein.Library
[NodeProperty(ValuePath = NodeValuePath.Method)]
public partial class MethodDetails
{
private readonly IFlowEnvironment env;
// private readonly IFlowEnvironment env;
/// <summary>
/// 对应的节点
@@ -58,10 +59,10 @@ namespace Serein.Library
/// <summary>
/// 方法说明
/// 方法别名
/// </summary>
[PropertyInfo]
private string _methodTips;
private string _methodAnotherName;
/// <summary>
@@ -109,7 +110,7 @@ namespace Serein.Library
throw new ArgumentException("无效的节点类型");
}
MethodName = Info.MethodName;
MethodTips = Info.MethodTips;
MethodAnotherName = Info.MethodAnotherName;
MethodDynamicType = nodeType;
ReturnType = Type.GetType(Info.ReturnTypeFullName);
ParameterDetailss = Info.ParameterDetailsInfos.Select(pinfo => new ParameterDetails(pinfo)).ToArray();
@@ -121,10 +122,12 @@ namespace Serein.Library
/// <returns></returns>
public MethodDetailsInfo ToInfo()
{
return new MethodDetailsInfo
{
MethodName = MethodName,
MethodTips = MethodTips,
MethodAnotherName = MethodAnotherName,
NodeType = MethodDynamicType.ToString(),
ParameterDetailsInfos = ParameterDetailss.Select(p => p.ToInfo()).ToArray(),
ReturnTypeFullName = ReturnType.FullName,
@@ -142,7 +145,7 @@ namespace Serein.Library
ActingInstance = this.ActingInstance,
ActingInstanceType = this.ActingInstanceType,
MethodDynamicType = this.MethodDynamicType,
MethodTips = this.MethodTips,
MethodAnotherName = this.MethodAnotherName,
ReturnType = this.ReturnType,
MethodName = this.MethodName,
MethodLockName = this.MethodLockName,
@@ -152,9 +155,23 @@ namespace Serein.Library
return md;
}
public override string ToString()
{
StringBuilder sb = new StringBuilder();
sb.AppendLine($"方法别名:{this.MethodAnotherName}");
sb.AppendLine($"方法名称:{this.MethodName}");
sb.AppendLine($"需要实例:{this.ActingInstanceType.FullName}");
sb.AppendLine($"");
sb.AppendLine($"入参参数信息:");
foreach (var arg in this.ParameterDetailss)
{
sb.AppendLine($" {arg.ToString()}");
}
sb.AppendLine($"");
sb.AppendLine($"返回值信息:");
sb.AppendLine($" {this.ReturnType.FullName}");
return sb.ToString();
}
///// <summary>
///// 每个节点有独自的MethodDetails实例

View File

@@ -29,7 +29,7 @@ namespace Serein.Library
/// <summary>
/// 方法说明
/// </summary>
public string MethodTips { get; set; }
public string MethodAnotherName { get; set; }
/// <summary>
/// 参数内容

View File

@@ -12,12 +12,6 @@ namespace Serein.Library
[NodeProperty(ValuePath = NodeValuePath.DebugSetting)]
public partial class NodeDebugSetting
{
/// <summary>
/// 对应的节点
/// </summary>
[PropertyInfo(IsProtection = true)]
private NodeModelBase _nodeModel;
/// <summary>
/// 创建属于某个节点的调试设置
/// </summary>
@@ -26,6 +20,13 @@ namespace Serein.Library
{
NodeModel = nodeModel;
}
/// <summary>
/// 对应的节点
/// </summary>
[PropertyInfo(IsProtection = true)]
private NodeModelBase _nodeModel;
/// <summary>
/// 是否使能
/// </summary>
@@ -41,11 +42,9 @@ namespace Serein.Library
/// <summary>
/// 中断级别,暂时停止继续执行后继分支。
/// </summary>
[PropertyInfo(IsNotification = true, CustomCode = "NodeModel?.Env?.SetNodeInterruptAsync(NodeModel?.Guid, value);")]
[PropertyInfo(IsNotification = true)] // CustomCode = "NodeModel?.Env?.SetNodeInterruptAsync(NodeModel?.Guid, value);"
private bool _isInterrupt = false;
//private const string MyInteruptCode = "NodeModel?.Env?.SetNodeInterruptAsync(NodeModel?.Guid, value);"; // 添加到中断的自定义代码
/// <summary>
/// 取消中断的回调函数
/// </summary>

View File

@@ -81,7 +81,6 @@ namespace Serein.Library
[PropertyInfo]
private Exception _runingException ;
}

View File

@@ -53,7 +53,7 @@ namespace Serein.Library
{
Guid = Guid,
MethodName = MethodDetails?.MethodName,
Label = DisplayName ?? "",
Label = MethodDetails?.MethodAnotherName,
Type = this.GetType().ToString(),
TrueNodes = trueNodes.ToArray(),
FalseNodes = falseNodes.ToArray(),

View File

@@ -68,7 +68,6 @@ namespace Serein.Library
[PropertyInfo]
private string _argDataSourceNodeGuid;
/// <summary>
/// 方法入参需要的类型。
/// </summary>
@@ -128,7 +127,6 @@ namespace Serein.Library
ExplicitType = Type.GetType(info.ExplicitTypeFullName);
ExplicitTypeName = info.ExplicitTypeName;
Items = info.Items;
}
/// <summary>
@@ -171,6 +169,19 @@ namespace Serein.Library
};
return pd;
}
public override string ToString()
{
if(_convertor is null)
{
return $"[{this.Index}] {this.Name} : {this.DataType.FullName}";
}
else
{
}
return $"[{this.Index}] {this.Name} : {this.ExplicitType.FullName} -> {this.DataType.FullName}";
}
}