从Serein.Library分离了WebSocket/Modbus;新增了Json门户类,用于未来的Http、WebSocket、Mqtt、gRPC、QUIC扩展。

This commit is contained in:
fengjiayi
2025-07-27 23:34:01 +08:00
parent ab2adfde80
commit d3c3210ccc
70 changed files with 2306 additions and 554 deletions

View File

@@ -152,7 +152,7 @@ namespace Serein.NodeFlow.Env
currentFlowEnvironment.FlowControl.ActivateFlipflopNode(nodeGuid);
}
/// <inheritdoc/>
/* /// <inheritdoc/>
public async Task<(bool, RemoteMsgUtil)> ConnectRemoteEnv(string addres, int port, string token)
{
// 连接成功,切换远程环境
@@ -160,11 +160,11 @@ namespace Serein.NodeFlow.Env
if (isConnect)
{
/* remoteFlowEnvironment ??= new RemoteFlowEnvironment(remoteMsgUtil, this.Event, this.UIContextOperation);
currentFlowEnvironment = remoteFlowEnvironment;*/
*//* remoteFlowEnvironment ??= new RemoteFlowEnvironment(remoteMsgUtil, this.Event, this.UIContextOperation);
currentFlowEnvironment = remoteFlowEnvironment;*//*
}
return (isConnect, remoteMsgUtil);
}
}*/
/// <inheritdoc/>
public async Task<bool> ExitFlowAsync()
@@ -172,7 +172,7 @@ namespace Serein.NodeFlow.Env
return await currentFlowEnvironment.FlowControl.ExitFlowAsync();
}
/// <inheritdoc/>
/* /// <inheritdoc/>
public void ExitRemoteEnv()
{
currentFlowEnvironment.ExitRemoteEnv();
@@ -183,7 +183,7 @@ namespace Serein.NodeFlow.Env
public async Task<FlowEnvInfo> GetEnvInfoAsync()
{
return await currentFlowEnvironment.GetEnvInfoAsync();
}
}*/
/// <inheritdoc/>
public async Task<SereinProjectData> GetProjectInfoAsync()
@@ -288,7 +288,7 @@ namespace Serein.NodeFlow.Env
return await currentFlowEnvironment.FlowControl.StartFlowAsync<TResult>(startNodeGuid);
}
/// <inheritdoc/>
/* /// <inheritdoc/>
public async Task StartRemoteServerAsync(int port = 7525)
{
await currentFlowEnvironment.StartRemoteServerAsync(port);
@@ -298,7 +298,7 @@ namespace Serein.NodeFlow.Env
public void StopRemoteServer()
{
currentFlowEnvironment.StopRemoteServer();
}
}*/
/// <inheritdoc/>
public void TerminateFlipflopNode(string nodeGuid)

View File

@@ -1,25 +1,10 @@
using Microsoft.CodeAnalysis.CSharp.Syntax;
using Newtonsoft.Json;
using Serein.Library;
using Serein.Library;
using Serein.Library.Api;
using Serein.Library.FlowNode;
using Serein.Library.Utils;
using Serein.Library.Utils.SereinExpression;
using Serein.NodeFlow.Services;
using Serein.NodeFlow.Tool;
using Serein.Script.Node;
using System;
using System.Collections.Specialized;
using System.Diagnostics;
using System.Net.Http.Headers;
using System.Net.Mime;
using System.Reactive;
using System.Reflection;
using System.Security.AccessControl;
using System.Text;
using System.Threading.Tasks;
using System.Timers;
using static Serein.Library.Api.IFlowEnvironment;
namespace Serein.NodeFlow.Env
{
@@ -296,7 +281,7 @@ namespace Serein.NodeFlow.Env
public void LoadProject(string filePath)
{
string content = System.IO.File.ReadAllText(filePath); // 读取整个文件内容
var FlowProjectData = JsonConvert.DeserializeObject<SereinProjectData>(content);
var FlowProjectData = JsonHelper.Deserialize<SereinProjectData>(content);
var FileDataPath = System.IO.Path.GetDirectoryName(filePath)!; // filePath;//
@@ -351,7 +336,7 @@ namespace Serein.NodeFlow.Env
public async Task LoadProjetAsync(string filePath)
{
string content = await System.IO.File.ReadAllTextAsync(filePath); // 读取整个文件内容
var FlowProjectData = JsonConvert.DeserializeObject<SereinProjectData>(content);
var FlowProjectData = JsonHelper.Deserialize<SereinProjectData>(content);
var FileDataPath = System.IO.Path.GetDirectoryName(filePath)!; // filePath;//
if(FlowProjectData is null)
{
@@ -396,9 +381,10 @@ namespace Serein.NodeFlow.Env
/// <param name="addres">远程环境地址</param>
/// <param name="port">远程环境端口</param>
/// <param name="token">密码</param>
public async Task<(bool, RemoteMsgUtil)> ConnectRemoteEnv(string addres, int port, string token)
/*public async Task<(bool, RemoteMsgUtil)> ConnectRemoteEnv(string addres, int port, string token)
{
if (IsControlRemoteEnv)
throw new NotImplementedException("远程环境未实现的方法 ConnectRemoteEnv");
*//*if (IsControlRemoteEnv)
{
await Console.Out.WriteLineAsync($"当前已经连接远程环境");
return (false, null);
@@ -410,9 +396,9 @@ namespace Serein.NodeFlow.Env
Addres = addres,
Port = port,
Token = token,
/*ThemeJsonKey = LocalFlowEnvironment.ThemeKey,
*//*ThemeJsonKey = LocalFlowEnvironment.ThemeKey,
MsgIdJsonKey = LocalFlowEnvironment.MsgIdKey,
DataJsonKey = LocalFlowEnvironment.DataKey,*/
DataJsonKey = LocalFlowEnvironment.DataKey,*//*
};
var remoteMsgUtil = new RemoteMsgUtil(controlConfiguration);
var result = await remoteMsgUtil.ConnectAsync();
@@ -423,8 +409,8 @@ namespace Serein.NodeFlow.Env
}
await Console.Out.WriteLineAsync("连接成功开始验证Token");
IsControlRemoteEnv = true;
return (true, remoteMsgUtil);
}
return (true, remoteMsgUtil);*//*
}*/
/// <summary>
/// 退出远程环境

View File

@@ -80,7 +80,7 @@ namespace Serein.NodeFlow.Model
}
public abstract partial class NodeModelBase : IDynamicFlowNode
public abstract partial class NodeModelBase : ISereinFlow
{
/// <summary>
/// 是否为基础节点

View File

@@ -1,22 +1,5 @@
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using Serein.Library;
using Serein.Library;
using Serein.Library.Api;
using Serein.Library.Utils;
using Serein.Library.Utils.SereinExpression;
using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel.Design;
using System.Linq;
using System.Linq.Expressions;
using System.Net.Http.Headers;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Xml.Linq;
namespace Serein.NodeFlow.Model
{
@@ -29,7 +12,7 @@ namespace Serein.NodeFlow.Model
/// <summary>
/// 节点基类
/// </summary>
public abstract partial class NodeModelBase : IDynamicFlowNode
public abstract partial class NodeModelBase : ISereinFlow
{
/// <summary>
/// 实体节点创建完成后调用的方法,调用时间早于 LoadInfo() 方法

View File

@@ -1,11 +1,7 @@
using Newtonsoft.Json.Linq;
using Serein.Library;
using Serein.Library;
using Serein.Library.Api;
using Serein.Library.Utils;
using Serein.Library.Utils.SereinExpression;
using System.Dynamic;
using System.Reactive;
using System.Reflection.Metadata;
namespace Serein.NodeFlow.Model
{

View File

@@ -1,17 +1,8 @@
using Newtonsoft.Json.Linq;
using Serein.Library;
using Serein.Library;
using Serein.Library.Api;
using Serein.NodeFlow.Services;
using Serein.Script;
using System;
using System.Collections.Generic;
using System.Dynamic;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using System.Xml.Linq;
using static System.Runtime.InteropServices.JavaScript.JSType;
namespace Serein.NodeFlow.Model
{

View File

@@ -1,14 +1,6 @@
using Newtonsoft.Json.Linq;
using Serein.Library;
using Serein.Library;
using Serein.Library.Api;
using Serein.Library.Utils;
using System;
using System.Collections.Generic;
using System.Dynamic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;
namespace Serein.NodeFlow.Model
{

View File

@@ -1,18 +1,11 @@
using Newtonsoft.Json.Linq;
using Serein.Library;
using Serein.Library;
using Serein.Library.Api;
using Serein.Library.Utils;
using Serein.NodeFlow.Env;
using Serein.NodeFlow.Model;
using Serein.Script;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading.Tasks;
using System.Xml.Linq;
namespace Serein.NodeFlow.Services
{
@@ -233,7 +226,7 @@ namespace Serein.NodeFlow.Services
}
else
{
var value = pd.DataValue.ToConvert(parameterInfo.ParameterType);
var value = pd.DataValue.ToConvertValueType(parameterInfo.ParameterType);
sb_invoke_login.AppendCode(3, $"global::{paramtTypeFullName} value{index} = (global::{paramtTypeFullName}){value}; // 获取当前节点的上一节点数据");
}
@@ -603,7 +596,7 @@ namespace Serein.NodeFlow.Services
}
else
{
var value = pd.DataValue.ToConvert(parameterInfo.ParameterType);
var value = pd.DataValue.ToConvertValueType(parameterInfo.ParameterType);
sb_invoke_login.AppendCode(3, $"global::{paramtTypeFullName} value{index} = (global::{paramtTypeFullName}){value}; // 获取当前节点的上一节点数据");
}

View File

@@ -1,21 +1,6 @@
using Microsoft.Extensions.ObjectPool;
using Newtonsoft.Json.Linq;
using Serein.Library;
using Serein.Library;
using Serein.Library.Api;
using Serein.Library.Utils;
using Serein.NodeFlow;
using Serein.NodeFlow.Model;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading.Tasks;
using System.Xml;
using System.Xml.Linq;
namespace Serein.NodeFlow.Services
{