1. 重新设计了 JSON门户类的实现

2. Script脚本添加了原始字符串的实现
3. 修复了Script中无法对  \" 双引号转义的问题
4. 新增了对于集合嵌套取值的支持(目前仅是集合取值)
5. 重新设计了FlowWorkManagement任务启动的逻辑,修复了触发器无法正常运行的问题
6. 在ScriptBaseFunc中新增了 json() 本地函数,支持将字符串转为IJsonToken进行取值。
7. EmitHelper对于集合取值时,反射获取“get_item”委托时存在看你多个MethodInfo,现在可以传入子项类型,帮助匹配目标重载方法
This commit is contained in:
fengjiayi
2025-07-31 23:59:31 +08:00
parent 5f6a58168a
commit 1bccccc835
36 changed files with 948 additions and 335 deletions

View File

@@ -51,7 +51,20 @@ namespace Serein.Workbench
private void Application_Startup(object sender, StartupEventArgs e)
{
var projectService = App.GetService<FlowProjectService>();
#if DEBUG && true
try
{
var t = JsonHelper.Parse(TestJson.json);
var iss = t["PreviousNodes"]["IsSucceed"][0];
}
catch (Exception ex)
{
}
#endif
var projectService = App.GetService<FlowProjectService>();
if (e.Args.Length == 1)
{
string filePath = e.Args[0];

View File

@@ -24,6 +24,7 @@ namespace Serein.Workbench.Models
[ObservableProperty]
private ObservableCollection<MethodDetailsInfo> _methodInfo;
public List<MethodDetailsInfo> ActionNodes { get => MethodInfo.Where(x => x.NodeType == NodeType.Action.ToString()).ToList(); set { } }
public List<MethodDetailsInfo> FlipflopNodes { get => MethodInfo.Where(x => x.NodeType == NodeType.Flipflop.ToString()).ToList(); set { } }
public List<MethodDetailsInfo> UINodes { get => MethodInfo.Where(x => x.NodeType == NodeType.UI.ToString()).ToList(); set { } }

View File

@@ -109,7 +109,7 @@ namespace Serein.Workbench.Node.ViewModel
FlowCallNode.ResetTargetNode(); // 如果是不选择了,则重置一下
return;
}
UploadNode.Invoke(value);
UploadNode?.Invoke(value);
FlowCallNode.SetTargetNode(value.Guid); // 重新设置目标节点
}

64
Workbench/TestJson.cs Normal file
View File

@@ -0,0 +1,64 @@
using Serein.Library.Utils;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Serein.Workbench
{
internal class TestJson
{
public static string json = """
{
"CanvasGuid": "3d18d198-1ef7-4de5-870c-a072da47c182",
"Guid": "abe4ae47-b0e0-4616-afe1-621ec7b15370",
"IsPublic": false,
"AssemblyName": null,
"MethodName": null,
"Label": null,
"Type": "Script",
"PreviousNodes": {
"Upstream": [],
"IsSucceed": [
"24c74a00-974e-48b1-b0dc-ae8eb1cde7d4"
],
"IsFail": [],
"IsError": []
},
"SuccessorNodes": {
"Upstream": [],
"IsSucceed": [],
"IsFail": [],
"IsError": []
},
"TrueNodes": null,
"FalseNodes": null,
"UpstreamNodes": null,
"ErrorNodes": null,
"ParameterData": [
{
"State": false,
"SourceNodeGuid": "24c74a00-974e-48b1-b0dc-ae8eb1cde7d4",
"SourceType": "GetOtherNodeData",
"ArgName": "user",
"Value": ""
}
],
"ParentNodeGuid": null,
"ChildNodeGuids": [],
"Position": {
"X": 509.6,
"Y": 351.7
},
"IsInterrupt": false,
"IsEnable": true,
"IsProtectionParameter": false,
"CustomData": {
"Script": "if (user.Info.Age >= 35) {\r\n user.Info.Name = \"[失业]\" + user.Info.Name;\r\n return user.Info.Name+\" \"+user.Info.Age+\"岁\";\r\n} else {\r\n user.Info.Name = \"[牛马]\" + user.Info.Name;\r\n return user.Info.Name+\" \"+user.Info.Age+\"岁\";\r\n}"
}
}
""";
}
}