mirror of
https://gitee.com/langsisi_admin/serein-flow
synced 2026-03-20 16:26:34 +08:00
1. 移除了FlipflopContext,统一流程API
2. Script项目脚本修复了 RawString 原始字符串存在的问题 3. Script使用了ValueNode统一了值类型节点,为后续扩展更多的值类型做准备 4. TypeHelper.ToTypeOfString()方法中添加了部分值类型的"Type[]”与“List<Type>”的显式定义,用于脚本在类型中定义数组成员 5. Script项目脚本默认挂载的json方法拆分为jsonObj(String)与jsonStr(Object)以支持序列化与反序列化 6. 项目保存为dnf项目文件时,将不再保存名称为”Default"并且没有节点的画布,避免重复保存时默认画布增多。
This commit is contained in:
@@ -15,10 +15,12 @@ namespace Serein.Library.Api
|
||||
/// 触发器完成的状态(根据业务场景手动设置)
|
||||
/// </summary>
|
||||
FlipflopStateType State { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 触发类型
|
||||
/// </summary>
|
||||
TriggerDescription Type { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 触发时传递的数据
|
||||
/// </summary>
|
||||
|
||||
@@ -14,16 +14,22 @@ namespace Serein.Library.Api
|
||||
/// </summary>
|
||||
public interface IFlowContext
|
||||
{
|
||||
/// <summary>
|
||||
/// 标识流程
|
||||
/// </summary>
|
||||
string Guid {get; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否记录流程信息
|
||||
/// </summary>
|
||||
bool IsRecordInvokeInfo { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 标识流程
|
||||
/// <para>用于同一个流程上下文中共享、存储任意数据</para>
|
||||
/// <para>流程完毕时,如果存储的对象实现了 IDisposable 接口,将会自动调用</para>
|
||||
/// <para>谨慎使用,注意数据的生命周期和内存管理</para>
|
||||
/// </summary>
|
||||
string Guid {get; }
|
||||
object? Tag { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 运行环境
|
||||
|
||||
@@ -1012,7 +1012,6 @@ namespace Serein.Library.Api
|
||||
void SetUIContextOperation(UIContextOperation uiContextOperation);
|
||||
#endregion
|
||||
|
||||
|
||||
#region 项目相关操作
|
||||
|
||||
/// <summary>
|
||||
@@ -1068,7 +1067,6 @@ namespace Serein.Library.Api
|
||||
bool TryGetDelegateDetails(string assemblyName, string methodName, out DelegateDetails del);
|
||||
#endregion
|
||||
|
||||
|
||||
#region 类库依赖相关
|
||||
|
||||
/// <summary>
|
||||
@@ -1099,8 +1097,6 @@ namespace Serein.Library.Api
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
#region 远程相关
|
||||
/*/// <summary>
|
||||
/// 启动远程服务
|
||||
@@ -1142,8 +1138,6 @@ namespace Serein.Library.Api
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
#region 节点中断、表达式(暂时没用)
|
||||
#if false
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ namespace Serein.Library
|
||||
/// <param name="message"></param>
|
||||
/// <param name="isCancel"></param>
|
||||
/// <param name="clsss"></param>
|
||||
public FlipflopException(string message, bool isCancel = true,CancelClass clsss = CancelClass.CancelBranch) :base(message)
|
||||
public FlipflopException(string message, bool isCancel = true, CancelClass clsss = CancelClass.CancelBranch) :base(message)
|
||||
{
|
||||
IsCancel = isCancel;
|
||||
Type = clsss;
|
||||
|
||||
@@ -27,6 +27,14 @@ namespace Serein.Library
|
||||
RunState = RunState.Running;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// <para>用于同一个流程上下文中共享、存储任意数据</para>
|
||||
/// <para>流程完毕时,如果存储的对象实现了 IDisposable 接口,将会自动调用</para>
|
||||
/// <para>谨慎使用,注意数据的生命周期和内存管理</para>
|
||||
/// </summary>
|
||||
public object? Tag { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 是否记录流程调用信息
|
||||
/// </summary>
|
||||
@@ -78,7 +86,6 @@ namespace Serein.Library
|
||||
private readonly ConcurrentDictionary<string, ConcurrentDictionary<int, object>> dictNodeParams = new ConcurrentDictionary<string, ConcurrentDictionary<int, object>>();
|
||||
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 记录流程调用信息
|
||||
@@ -255,11 +262,15 @@ namespace Serein.Library
|
||||
/// </summary>
|
||||
public void Reset()
|
||||
{
|
||||
if(Tag is IDisposable disposable)
|
||||
{
|
||||
disposable.Dispose(); // 释放 Tag 中的资源
|
||||
}
|
||||
this.dictNodeFlowData?.Clear();
|
||||
ExceptionOfRuning = null;
|
||||
flowInvokeInfos.Clear();
|
||||
NextOrientation = ConnectionInvokeType.None;
|
||||
RunState = RunState.Running;
|
||||
flowInvokeInfos.Clear();
|
||||
Guid = global::System.Guid.NewGuid().ToString();
|
||||
}
|
||||
|
||||
|
||||
@@ -143,7 +143,7 @@ namespace Serein.Library
|
||||
/// </summary>
|
||||
/// <param name="content"></param>
|
||||
/// <returns></returns>
|
||||
public static IJsonToken json(string content)
|
||||
public static IJsonToken jsonObj(string content)
|
||||
{
|
||||
/*if (string.IsNullOrWhiteSpace(content))
|
||||
{
|
||||
@@ -152,6 +152,20 @@ namespace Serein.Library
|
||||
return JsonHelper.Parse(content);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 转为JSON字符串
|
||||
/// </summary>
|
||||
/// <param name="content"></param>
|
||||
/// <returns></returns>
|
||||
public static string jsonStr(object data)
|
||||
{
|
||||
if (data is null)
|
||||
{
|
||||
return "{}";
|
||||
}
|
||||
return JsonHelper.Serialize(data);
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
@@ -55,11 +55,15 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Remove="Api\IFlipflopContext.cs" />
|
||||
<Compile Remove="Enums\FlipflopStateType.cs" />
|
||||
<Compile Remove="Extension\FlowModelExtension.cs" />
|
||||
<Compile Remove="FlowNode\Attribute.cs" />
|
||||
<Compile Remove="FlowNode\FlipflopContext.cs" />
|
||||
<Compile Remove="FlowNode\NodeModelBaseData.cs" />
|
||||
<Compile Remove="FlowNode\NodeModelBaseFunc.cs" />
|
||||
<Compile Remove="FlowNode\ScriptFlowApi.cs" />
|
||||
<Compile Remove="Utils\ExpressionHelper.cs" />
|
||||
<Compile Remove="Utils\NativeDllHelper.cs" />
|
||||
<Compile Remove="Utils\RemoteMsgUtil.cs" />
|
||||
</ItemGroup>
|
||||
|
||||
@@ -70,7 +70,6 @@ namespace Serein.Library.Utils
|
||||
};
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 字面量转为对应类型
|
||||
/// </summary>
|
||||
@@ -84,11 +83,13 @@ namespace Serein.Library.Utils
|
||||
return Type.GetType(valueStr);
|
||||
}
|
||||
|
||||
#region 常见值类型
|
||||
|
||||
if (valueStr.Equals("bool", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return typeof(bool);
|
||||
}
|
||||
|
||||
#region 整数型
|
||||
else if (valueStr.Equals("sbyte", StringComparison.OrdinalIgnoreCase)
|
||||
|| valueStr.Equals(nameof(SByte), StringComparison.OrdinalIgnoreCase))
|
||||
@@ -167,6 +168,170 @@ namespace Serein.Library.Utils
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
#region Array数组类型
|
||||
if (valueStr.Equals("bool" + "[]", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return typeof(bool[]);
|
||||
}
|
||||
#region 整数型
|
||||
else if (valueStr.Equals("sbyte" + "[]", StringComparison.OrdinalIgnoreCase)
|
||||
|| valueStr.Equals(nameof(SByte) + "[]", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return typeof(SByte[]);
|
||||
}
|
||||
else if (valueStr.Equals("short" + "[]", StringComparison.OrdinalIgnoreCase)
|
||||
|| valueStr.Equals(nameof(Int16) + "[]", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return typeof(Int16[]);
|
||||
}
|
||||
else if (valueStr.Equals("int" + "[]", StringComparison.OrdinalIgnoreCase)
|
||||
|| valueStr.Equals(nameof(Int32) + "[]", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return typeof(Int32[]);
|
||||
}
|
||||
else if (valueStr.Equals("long" + "[]", StringComparison.OrdinalIgnoreCase)
|
||||
|| valueStr.Equals(nameof(Int64) + "[]", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return typeof(Int64[]);
|
||||
}
|
||||
|
||||
else if (valueStr.Equals("byte" + "[]", StringComparison.OrdinalIgnoreCase)
|
||||
|| valueStr.Equals(nameof(Byte) + "[]", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return typeof(Byte[]);
|
||||
}
|
||||
else if (valueStr.Equals("ushort" + "[]", StringComparison.OrdinalIgnoreCase)
|
||||
|| valueStr.Equals(nameof(UInt16) + "[]", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return typeof(UInt16[]);
|
||||
}
|
||||
else if (valueStr.Equals("uint" + "[]", StringComparison.OrdinalIgnoreCase)
|
||||
|| valueStr.Equals(nameof(UInt32) + "[]", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return typeof(UInt32[]);
|
||||
}
|
||||
else if (valueStr.Equals("ulong" + "[]", StringComparison.OrdinalIgnoreCase)
|
||||
|| valueStr.Equals(nameof(UInt64) + "[]", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return typeof(UInt64[]);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 浮点型
|
||||
else if (valueStr.Equals("float" + "[]", StringComparison.OrdinalIgnoreCase)
|
||||
|| valueStr.Equals(nameof(Single) + "[]", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return typeof(Single[]);
|
||||
}
|
||||
else if (valueStr.Equals("double" + "[]", StringComparison.OrdinalIgnoreCase)
|
||||
|| valueStr.Equals(nameof(Double) + "[]", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return typeof(Double[]);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 小数型
|
||||
|
||||
else if (valueStr.Equals("decimal" + "[]", StringComparison.OrdinalIgnoreCase)
|
||||
|| valueStr.Equals(nameof(Decimal) + "[]", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return typeof(Decimal[]);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 其他常见的类型
|
||||
else if (valueStr.Equals(nameof(String) + "[]", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return typeof(String[]);
|
||||
}
|
||||
#endregion
|
||||
#endregion
|
||||
|
||||
#region List<> 数组类型
|
||||
if (valueStr.Equals("list<bool>", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return typeof(List<bool>);
|
||||
}
|
||||
|
||||
#region 整数型
|
||||
else if (valueStr.Equals("list<sbyte>", StringComparison.OrdinalIgnoreCase)
|
||||
|| valueStr.Equals(nameof(List<SByte>), StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return typeof(List<SByte>);
|
||||
}
|
||||
else if (valueStr.Equals("list<short>", StringComparison.OrdinalIgnoreCase)
|
||||
|| valueStr.Equals(nameof(List<Int16>), StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return typeof(List<Int16>);
|
||||
}
|
||||
else if (valueStr.Equals("list<int>", StringComparison.OrdinalIgnoreCase)
|
||||
|| valueStr.Equals(nameof(List<Int32>), StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return typeof(List<Int32>);
|
||||
}
|
||||
else if (valueStr.Equals("list<long>", StringComparison.OrdinalIgnoreCase)
|
||||
|| valueStr.Equals(nameof(List<Int64>), StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return typeof(List<Int64>);
|
||||
}
|
||||
|
||||
else if (valueStr.Equals("list<byte>", StringComparison.OrdinalIgnoreCase)
|
||||
|| valueStr.Equals(nameof(List<Byte>), StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return typeof(List<Byte>);
|
||||
}
|
||||
else if (valueStr.Equals("list<ushort>", StringComparison.OrdinalIgnoreCase)
|
||||
|| valueStr.Equals(nameof(List<UInt16>), StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return typeof(List<UInt16>);
|
||||
}
|
||||
else if (valueStr.Equals("list<uint>", StringComparison.OrdinalIgnoreCase)
|
||||
|| valueStr.Equals(nameof(List<UInt32>), StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return typeof(List<UInt32>);
|
||||
}
|
||||
else if (valueStr.Equals("list<ulong>", StringComparison.OrdinalIgnoreCase)
|
||||
|| valueStr.Equals(nameof(List<UInt64>), StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return typeof(List<UInt64>);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 浮点型
|
||||
else if (valueStr.Equals("list<float>", StringComparison.OrdinalIgnoreCase)
|
||||
|| valueStr.Equals(nameof(List<Single>), StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return typeof(List<Single>);
|
||||
}
|
||||
else if (valueStr.Equals("list<double>", StringComparison.OrdinalIgnoreCase)
|
||||
|| valueStr.Equals(nameof(List<Double>), StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return typeof(List<Double>);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 小数型
|
||||
|
||||
else if (valueStr.Equals("list<decimal>", StringComparison.OrdinalIgnoreCase)
|
||||
|| valueStr.Equals(nameof(List<Decimal>), StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return typeof(List<Decimal>);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 其他常见的类型
|
||||
|
||||
else if (valueStr.Equals(nameof(List<String>), StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return typeof(List<String>);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
else
|
||||
{
|
||||
throw new ArgumentException($"无法解析的字面量类型[{valueStr}]");
|
||||
|
||||
Reference in New Issue
Block a user