mirror of
https://gitee.com/langsisi_admin/serein-flow
synced 2026-04-29 11:03:23 +08:00
重新确认开发方向
This commit is contained in:
@@ -82,8 +82,8 @@ namespace Serein.NodeFlow.Base
|
||||
for (int i = 0; i < nodeInfo.ParameterData.Length; i++)
|
||||
{
|
||||
Parameterdata? pd = nodeInfo.ParameterData[i];
|
||||
this.MethodDetails.ExplicitDatas[i].IsExplicitData = pd.State;
|
||||
this.MethodDetails.ExplicitDatas[i].DataValue = pd.Value;
|
||||
this.MethodDetails.ParameterDetailss[i].IsExplicitData = pd.State;
|
||||
this.MethodDetails.ParameterDetailss[i].DataValue = pd.Value;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -232,12 +232,12 @@ namespace Serein.NodeFlow.Base
|
||||
public static object?[]? GetParameters(IDynamicContext context, NodeModelBase nodeModel, MethodDetails md)
|
||||
{
|
||||
// 用正确的大小初始化参数数组
|
||||
if (md.ExplicitDatas.Length == 0)
|
||||
if (md.ParameterDetailss.Length == 0)
|
||||
{
|
||||
return null;// md.ActingInstance
|
||||
}
|
||||
|
||||
object?[]? parameters = new object[md.ExplicitDatas.Length];
|
||||
object?[]? parameters = new object[md.ParameterDetailss.Length];
|
||||
var flowData = nodeModel.PreviousNode?.FlowData; // 当前传递的数据
|
||||
var previousDataType = flowData?.GetType();
|
||||
|
||||
@@ -245,7 +245,7 @@ namespace Serein.NodeFlow.Base
|
||||
{
|
||||
|
||||
object? inputParameter; // 存放解析的临时参数
|
||||
var ed = md.ExplicitDatas[i]; // 方法入参描述
|
||||
var ed = md.ParameterDetailss[i]; // 方法入参描述
|
||||
|
||||
|
||||
if (ed.IsExplicitData) // 判断是否使用显示的输入参数
|
||||
|
||||
@@ -36,7 +36,26 @@ namespace Serein.NodeFlow
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
|
||||
public List<library> get(){
|
||||
}
|
||||
|
||||
libray
|
||||
{
|
||||
string dllname,
|
||||
MethodInfo[] nodeinfos
|
||||
}
|
||||
|
||||
methodInfo{
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 运行环境
|
||||
@@ -58,8 +77,6 @@ namespace Serein.NodeFlow
|
||||
sereinIOC.OnIOCMembersChanged += e => this?.OnIOCMembersChanged?.Invoke(e) ; // 监听IOC容器的注册
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 节点的命名空间
|
||||
/// </summary>
|
||||
@@ -169,9 +186,8 @@ namespace Serein.NodeFlow
|
||||
public List<NodeLibrary> NodeLibrarys { get; } = [];
|
||||
|
||||
/// <summary>
|
||||
/// 存储所有方法信息
|
||||
/// 描述所有DLL中NodeAction特性的方法的原始副本
|
||||
/// </summary>
|
||||
//private MethodDetailss { get; } = [];
|
||||
public Dictionary<NodeLibrary, List<MethodDetails>> MethodDetailss { get; } = [];
|
||||
|
||||
/// <summary>
|
||||
@@ -184,6 +200,10 @@ namespace Serein.NodeFlow
|
||||
/// 存放触发器节点(运行时全部调用)
|
||||
/// </summary>
|
||||
public List<SingleFlipflopNode> FlipflopNodes { get; } = [];
|
||||
|
||||
/// <summary>
|
||||
/// 从dll中加载的类的注册类型
|
||||
/// </summary>
|
||||
public Dictionary<RegisterSequence,List<Type>> AutoRegisterTypes { get; } = [];
|
||||
|
||||
/// <summary>
|
||||
@@ -336,16 +356,18 @@ namespace Serein.NodeFlow
|
||||
var dllPaths = project.Librarys.Select(it => it.Path).ToList();
|
||||
List<MethodDetails> methodDetailss = [];
|
||||
|
||||
//string currentPath = Environment.CurrentDirectory; // 获取当前目录
|
||||
//string path = Assembly.GetExecutingAssembly().Location; // 获取当前正在执行的文件的路径
|
||||
//string exePath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); // 获取包含可执行文件的目录
|
||||
//string basePath = AppDomain.CurrentDomain.BaseDirectory; // 获取应用程序的执行路径:
|
||||
|
||||
// 遍历依赖项中的特性注解,生成方法详情
|
||||
foreach (var dll in dllPaths)
|
||||
foreach (var dllPath in dllPaths)
|
||||
{
|
||||
var dllFilePath = System.IO.Path.GetFullPath(System.IO.Path.Combine(filePath, dll));
|
||||
var dllFilePath = Path.GetFullPath(Path.Combine(filePath, dllPath));
|
||||
//var dllFilePath = Path.GetFullPath(Path.Combine(Path.GetDirectoryName(filePath)!, dllPath));
|
||||
LoadDllNodeInfo(dllFilePath);
|
||||
}
|
||||
// 方法加载完成,缓存到运行环境中。
|
||||
//MethodDetailss.AddRange(methodDetailss);
|
||||
//methodDetailss.Clear();
|
||||
|
||||
|
||||
List<(NodeModelBase, string[])> regionChildNodes = new List<(NodeModelBase, string[])>();
|
||||
List<(NodeModelBase, Position)> ordinaryNodes = new List<(NodeModelBase, Position)>();
|
||||
@@ -1325,10 +1347,11 @@ namespace Serein.NodeFlow
|
||||
{
|
||||
public static Library.Entity.Library ToLibrary(this Assembly assembly)
|
||||
{
|
||||
var tmp = assembly.ManifestModule.Name;
|
||||
return new Library.Entity.Library
|
||||
{
|
||||
Name = assembly.GetName().Name,
|
||||
Path = assembly.Location,
|
||||
Path = assembly.ManifestModule.Name,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -12,9 +12,9 @@ namespace Serein.NodeFlow.Model
|
||||
|
||||
internal override Parameterdata[] GetParameterdatas()
|
||||
{
|
||||
if (base.MethodDetails.ExplicitDatas.Length > 0)
|
||||
if (base.MethodDetails.ParameterDetailss.Length > 0)
|
||||
{
|
||||
return MethodDetails.ExplicitDatas
|
||||
return MethodDetails.ParameterDetailss
|
||||
.Select(it => new Parameterdata
|
||||
{
|
||||
State = it.IsExplicitData,
|
||||
|
||||
@@ -82,9 +82,9 @@ namespace Serein.NodeFlow.Model
|
||||
}
|
||||
internal override Parameterdata[] GetParameterdatas()
|
||||
{
|
||||
if (base.MethodDetails.ExplicitDatas.Length > 0)
|
||||
if (base.MethodDetails.ParameterDetailss.Length > 0)
|
||||
{
|
||||
return MethodDetails.ExplicitDatas
|
||||
return MethodDetails.ParameterDetailss
|
||||
.Select(it => new Parameterdata
|
||||
{
|
||||
State = it.IsExplicitData,
|
||||
|
||||
@@ -134,7 +134,7 @@ public static class NodeMethodDetailsHelper
|
||||
MethodDynamicType = attribute.MethodDynamicType,
|
||||
MethodLockName = attribute.LockName,
|
||||
MethodTips = methodTips,
|
||||
ExplicitDatas = explicitDataOfParameters,
|
||||
ParameterDetailss = explicitDataOfParameters,
|
||||
ReturnType = returnType,
|
||||
};
|
||||
var dd = new DelegateDetails( emitMethodType, methodDelegate) ;
|
||||
@@ -173,7 +173,7 @@ public static class NodeMethodDetailsHelper
|
||||
/// </summary>
|
||||
/// <param name="parameters"></param>
|
||||
/// <returns></returns>
|
||||
private static ExplicitData[] GetExplicitDataOfParameters(ParameterInfo[] parameters)
|
||||
private static ParameterDetails[] GetExplicitDataOfParameters(ParameterInfo[] parameters)
|
||||
{
|
||||
|
||||
return parameters.Select((it, index) =>
|
||||
@@ -212,7 +212,7 @@ public static class NodeMethodDetailsHelper
|
||||
return methodInfo?.Invoke(obj, [enumValue]);
|
||||
};
|
||||
// 确保实例实现了所需接口
|
||||
ExplicitData ed = GetExplicitDataOfParameter(it, index, paremType, true, func);
|
||||
ParameterDetails ed = GetExplicitDataOfParameter(it, index, paremType, true, func);
|
||||
|
||||
return ed;
|
||||
}
|
||||
@@ -237,7 +237,7 @@ public static class NodeMethodDetailsHelper
|
||||
}).ToArray();
|
||||
}
|
||||
|
||||
private static ExplicitData GetExplicitDataOfParameter(ParameterInfo parameterInfo,
|
||||
private static ParameterDetails GetExplicitDataOfParameter(ParameterInfo parameterInfo,
|
||||
int index,
|
||||
Type paremType,
|
||||
bool isExplicitData,
|
||||
@@ -247,7 +247,7 @@ public static class NodeMethodDetailsHelper
|
||||
string explicitTypeName = GetExplicitTypeName(paremType);
|
||||
var items = GetExplicitItems(paremType, explicitTypeName);
|
||||
if ("Bool".Equals(explicitTypeName)) explicitTypeName = "Select"; // 布尔值 转为 可选类型
|
||||
return new ExplicitData
|
||||
return new ParameterDetails
|
||||
{
|
||||
IsExplicitData = isExplicitData, //attribute is null ? parameterInfo.HasDefaultValue : true,
|
||||
Index = index,
|
||||
@@ -255,9 +255,9 @@ public static class NodeMethodDetailsHelper
|
||||
ExplicitType = paremType,
|
||||
Convertor = func,
|
||||
DataType = parameterInfo.ParameterType,
|
||||
ParameterName = parameterInfo.Name,
|
||||
DataValue = parameterInfo.HasDefaultValue ? parameterInfo?.DefaultValue?.ToString() : "",
|
||||
Items = items.ToArray(),
|
||||
Name = parameterInfo.Name,
|
||||
DataValue = parameterInfo.HasDefaultValue ? parameterInfo?.DefaultValue?.ToString() : "", // 如果存在默认值,则使用默认值
|
||||
Items = items.ToArray(), // 如果是枚举值入参,则获取枚举类型的字面量
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user