尝试将节点流导出为c#代码文件

This commit is contained in:
fengjiayi
2025-07-06 14:34:49 +08:00
parent 162dc7bcf8
commit b25fd9c83c
45 changed files with 1625 additions and 361 deletions

View File

@@ -5,6 +5,7 @@ using Serein.NodeFlow.Model;
using System.Collections.Concurrent;
using System.ComponentModel;
using System.Reflection;
using System.Text;
namespace Serein.NodeFlow
{
@@ -128,6 +129,32 @@ namespace Serein.NodeFlow
}
/// <summary>
/// 添加代码
/// </summary>
/// <param name="sb">字符串构建器</param>
/// <param name="retractCount">缩进次数4个空格</param>
/// <param name="code">要添加的代码</param>
/// <returns>字符串构建器本身</returns>
public static StringBuilder AddCode(this StringBuilder sb,
int retractCount = 0,
string code = null)
{
if (!string.IsNullOrWhiteSpace(code))
{
var retract = new string(' ', retractCount * 4);
sb.AppendLine(retract + code);
}
return sb;
}
///// <summary>
///// 从节点类型枚举中转为对应的 Model 类型
///// </summary>
@@ -165,4 +192,6 @@ namespace Serein.NodeFlow
//}
}
}