重新设计了FlowLIbrary相关类;为工作台默认添加了基础依赖、默认画布。

This commit is contained in:
fengjiayi
2025-07-28 12:16:29 +08:00
parent 6354c4c7fd
commit ccb8e49abc
39 changed files with 497 additions and 453 deletions

View File

@@ -179,19 +179,14 @@ namespace Serein.Library.Api
/// </summary>
public class LoadDllEventArgs : FlowEventArgs
{
public LoadDllEventArgs(NodeLibraryInfo nodeLibraryInfo, List<MethodDetailsInfo> MethodDetailss)
public LoadDllEventArgs(FlowLibraryInfo nodeLibraryInfo)
{
this.NodeLibraryInfo = nodeLibraryInfo;
this.MethodDetailss = MethodDetailss;
}
/// <summary>
/// 已加载了的程序集
/// </summary>
public NodeLibraryInfo NodeLibraryInfo { get;}
/// <summary>
/// dll文件中有效的流程方法描述
/// </summary>
public List<MethodDetailsInfo> MethodDetailss { get;}
public FlowLibraryInfo NodeLibraryInfo { get;}
}
/// <summary>
@@ -791,7 +786,7 @@ namespace Serein.Library.Api
/// <summary>
/// 是否全局中断
/// </summary>
bool IsGlobalInterrupt { get; }
bool _IsGlobalInterrupt { get; }
/// <summary>
/// <para>表示是否正在控制远程</para>

View File

@@ -1,13 +1,10 @@
using Microsoft.CodeAnalysis.CSharp.Syntax;
using Serein.Library.Api;
using Serein.Library.Api;
using Serein.Library.Utils;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Xml.Linq;
namespace Serein.Library
{

View File

@@ -14,18 +14,21 @@ namespace Serein.Library
/// 基础功能
/// </summary>
[DynamicFlow(Name ="[基础功能]")]
public static class SereinBaseFunction
public static class FlowBaseLibrary
{
[NodeAction(NodeType.Action, "对象透传")]
public static object SereinTransmissionObject(object value) => value;
public static object TransmissionObject(object value) => value;
[NodeAction(NodeType.Action, "键值对组装")]
public static Dictionary<string, object> SereinKvDataCollection(string argName,
params object[] value)
public static Dictionary<string, object> DictSet(string argNames, params object[] value)
{
var names = argName.Split(';');
var count = Math.Min(value.Length, names.Length);
var names = argNames.Split(';');
if(value.Length != names.Length)
{
throw new ArgumentException("参数名称数量与入参数量不一致");
}
var count = value.Length;
var dict = new Dictionary<string, object>();
for (int i = 0; i < count; i++)
{
@@ -35,13 +38,13 @@ namespace Serein.Library
}
[NodeAction(NodeType.Action, "数组组装")]
public static object[] SereinListDataCollection(params object[] value)
public static object[] ArraySet(params object[] value)
{
return value;
}
[NodeAction(NodeType.Action, "输出")]
public static object[] SereinConsole(params object[] value)
public static object[] Console(params object[] value)
{
foreach (var item in value)
{
@@ -51,7 +54,7 @@ namespace Serein.Library
}
[NodeAction(NodeType.Action, "逻辑分支")]
public static object SereinLogicalBranch([NodeParam(IsExplicit = false)]bool @bool,
public static object LogicalBranch([NodeParam(IsExplicit = false)]bool @bool,
object t_value,
object f_value)
{
@@ -59,7 +62,7 @@ namespace Serein.Library
}
[NodeAction(NodeType.Action, "文本拼接")]
public static string SereinTextJoin(params object[] value)
public static string TextJoin(params object[] value)
{
StringBuilder sb = new StringBuilder();
foreach (var item in value)
@@ -83,19 +86,19 @@ namespace Serein.Library
[NodeAction(NodeType.Action, "键值对动态构建对象")]
public static object SereinKvDataToObject(Dictionary<string, object> dict,
public static object CreateDynamicObjectOfDict(Dictionary<string, object> dict,
string classTypeName = "newClass_dynamic",
bool IsPrint = false)
{
if (!DynamicObjectHelper.TryResolve(dict, classTypeName, out var result))
{
Console.WriteLine("赋值过程中有错误,请检查属性名和类型!");
System.Console.WriteLine("赋值过程中有错误,请检查属性名和类型!");
}
else
{
if (IsPrint)
{
Console.WriteLine("创建完成,正在打印结果");
System.Console.WriteLine("创建完成,正在打印结果");
DynamicObjectHelper.PrintObjectProperties(result);
}
}
@@ -104,7 +107,7 @@ namespace Serein.Library
[NodeAction(NodeType.Action, "设置或更新全局数据")]
public static object SereinAddOrUpdateFlowGlobalData(string name, object data)
public static object AddOrUpdateFlowGlobalData(string name, object data)
{
SereinEnv.AddOrUpdateFlowGlobalData(name, data);
return data;

View File

@@ -631,7 +631,7 @@ namespace Serein.Library
public string ProjectFileLocation => throw new NotImplementedException();
public bool IsGlobalInterrupt => throw new NotImplementedException();
public bool _IsGlobalInterrupt => throw new NotImplementedException();
public bool IsControlRemoteEnv => throw new NotImplementedException();

View File

@@ -12,13 +12,12 @@ namespace Serein.Library
/// <summary>
/// 环境方法信息
/// </summary>
public LibraryMds[] LibraryMds { get; set; }
public FlowLibraryInfo[] LibraryMds { get; set; }
/// <summary>
/// 项目信息
/// </summary>
public SereinProjectData Project { get; set; }
// IOC节点对象信息
}
@@ -26,16 +25,27 @@ namespace Serein.Library
/// <summary>
/// 程序集相关的方法信息
/// </summary>
public class LibraryMds
public class FlowLibraryInfo
{
/// <summary>
/// 程序集名称
/// </summary>
public string AssemblyName { get; set; }
/// <summary>
/// 文件名
/// </summary>
public string FileName { get; set; }
/// <summary>
/// 路径
/// </summary>
public string FilePath { get; set; }
/// <summary>
/// 相关的方法详情
/// </summary>
public MethodDetailsInfo[] Mds { get; set; }
public List<MethodDetailsInfo> MethodInfos { get; set; }
}
@@ -57,7 +67,7 @@ namespace Serein.Library
/// 依赖的DLL
/// </summary>
public NodeLibraryInfo[] Librarys { get; set; }
public FlowLibraryInfo[] Librarys { get; set; }
/// <summary>
/// 画布集合
@@ -89,29 +99,16 @@ namespace Serein.Library
}
/*
/// <summary>
/// 项目依赖的程序集,项目文件相关
/// </summary>
/// <summary>
public class NodeLibraryInfo
public class FlowLibraryInfo
{
/// <summary>
/// 文件名
/// </summary>
public string FileName { get; set; }
/// <summary>
/// 路径
/// </summary>
public string FilePath { get; set; }
/// <summary>
/// 所属的程序集名称
/// </summary>
public string AssemblyName { get; set; }
}
*/
/// <summary>
/// 节点信息,项目文件相关

View File

@@ -1,4 +1,5 @@
using System;
using System.Text.RegularExpressions;
namespace Serein.Library
{
@@ -85,9 +86,9 @@ namespace Serein.Library
public sealed class NodeActionAttribute : Attribute
{
public NodeActionAttribute(NodeType methodDynamicType,
string methodTips = "",
bool scan = true,
string lockName = "")
string methodTips = "",
bool scan = true,
string lockName = "")
{
Scan = scan;
MethodDynamicType = methodDynamicType;
@@ -110,6 +111,10 @@ namespace Serein.Library
/// 暂无意义
/// </summary>
public string LockName;
/// <summary>
/// 分组名称,暂无意义
/// </summary>
public string GroupName;
}

View File

@@ -1,16 +1,17 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<Version>1.2.1.1</Version>
<TargetFrameworks>net8.0;net462</TargetFrameworks>
<BaseOutputPath>..\.\.Output</BaseOutputPath>
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
<Title>SereinFow</Title>
<Version>1.2.2</Version>
<Description>动态节点流、可视化编辑的基本依赖支持导入C# DLL生成自定义节点提供二次开发支持适合用于可视化编程和流程设计</Description>
<PackageReadmeFile>README.md</PackageReadmeFile>
<RepositoryUrl>https://github.com/fhhyyp/serein-flow</RepositoryUrl>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<PackageRequireLicenseAcceptance>True</PackageRequireLicenseAcceptance>
<TargetFrameworks>net8.0;net462</TargetFrameworks>
<BaseOutputPath>..\.\.Output</BaseOutputPath>
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
<LangVersion>latest</LangVersion>
<SatelliteResourceLanguages>no</SatelliteResourceLanguages>
@@ -22,6 +23,22 @@
<CompilerGeneratedFilesOutputPath>.\obj\g</CompilerGeneratedFilesOutputPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Debug|net8.0|AnyCPU'">
<NoWarn>1701;1702;1573</NoWarn>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Debug|net462|AnyCPU'">
<NoWarn>1701;1702;1573</NoWarn>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Release|net8.0|AnyCPU'">
<NoWarn>1701;1702;1573</NoWarn>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Release|net462|AnyCPU'">
<NoWarn>1701;1702;1573</NoWarn>
</PropertyGroup>
<ItemGroup>
<Compile Remove="Http\**" />
<Compile Remove="Network\**" />
@@ -45,7 +62,7 @@
<ItemGroup>
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.13.0" />
<PackageReference Include="Microsoft.Extensions.ObjectPool" Version="9.0.0" />
<PackageReference Include="System.IO.Ports" Version="9.0.7" />
<PackageReference Include="System.Reactive" Version="6.0.1" />

View File

@@ -1,5 +1,4 @@
using Microsoft.CodeAnalysis.CSharp.Syntax;
using Serein.Library.Api;
using Serein.Library.Api;
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;