mirror of
https://gitee.com/langsisi_admin/serein-flow
synced 2026-03-03 00:00:49 +08:00
1. 重新设计了 JSON门户类的实现
2. Script脚本添加了原始字符串的实现 3. 修复了Script中无法对 \" 双引号转义的问题 4. 新增了对于集合嵌套取值的支持(目前仅是集合取值) 5. 重新设计了FlowWorkManagement任务启动的逻辑,修复了触发器无法正常运行的问题 6. 在ScriptBaseFunc中新增了 json() 本地函数,支持将字符串转为IJsonToken进行取值。 7. EmitHelper对于集合取值时,反射获取“get_item”委托时存在看你多个MethodInfo,现在可以传入子项类型,帮助匹配目标重载方法
This commit is contained in:
@@ -159,7 +159,7 @@ namespace Serein.Library
|
||||
/// </summary>
|
||||
/// <param name="type">类型信息</param>
|
||||
/// <param name="emitType">操作类型</param>
|
||||
public DelegateDetails(Type type, EmitType emitType)
|
||||
public DelegateDetails(Type type, EmitType emitType, Type? itemType = null)
|
||||
{
|
||||
if (emitType == EmitType.CollectionSetter)
|
||||
{
|
||||
@@ -170,7 +170,7 @@ namespace Serein.Library
|
||||
else if (emitType == EmitType.CollectionGetter)
|
||||
{
|
||||
this.emitType = EmitType.CollectionGetter;
|
||||
collectionGetter = EmitHelper.CreateCollectionGetter(type);
|
||||
collectionGetter = EmitHelper.CreateCollectionGetter(type, itemType);
|
||||
}
|
||||
else if (emitType == EmitType.ArrayCreate)
|
||||
{
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using Serein.Library.Api;
|
||||
using Serein.Library.Utils;
|
||||
using System;
|
||||
using System.Net;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Serein.Library
|
||||
@@ -82,33 +83,92 @@ namespace Serein.Library
|
||||
/// <summary>
|
||||
/// 触发类型
|
||||
/// </summary>
|
||||
|
||||
public TriggerDescription Type { get; set; }
|
||||
/// <summary>
|
||||
/// 触发时传递的数据
|
||||
/// </summary>
|
||||
public TResult Value { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 触发器上下文构造函数
|
||||
/// </summary>
|
||||
/// <param name="ffState"></param>
|
||||
public FlipflopContext(FlipflopStateType ffState)
|
||||
public FlipflopContext()
|
||||
{
|
||||
State = ffState;
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 触发器上下文构造函数,传入状态和数据值
|
||||
/// 成功触发器上下文,表示触发器执行成功并返回结果
|
||||
/// </summary>
|
||||
/// <param name="ffState"></param>
|
||||
/// <param name="value"></param>
|
||||
public FlipflopContext(FlipflopStateType ffState, TResult value)
|
||||
/// <typeparam name="TResult"></typeparam>
|
||||
/// <param name="result"></param>
|
||||
/// <returns></returns>
|
||||
public static FlipflopContext<TResult> Ok<TResult>(TResult result)
|
||||
{
|
||||
State = ffState;
|
||||
Value = value;
|
||||
return new FlipflopContext<TResult>()
|
||||
{
|
||||
State = FlipflopStateType.Succeed,
|
||||
Type = TriggerDescription.External,
|
||||
Value = result,
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 表示触发器执行失败
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static FlipflopContext<TResult> Fail()
|
||||
{
|
||||
return new FlipflopContext<TResult>()
|
||||
{
|
||||
State = FlipflopStateType.Fail,
|
||||
Type = TriggerDescription.External,
|
||||
Value = default,
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 表示触发器执行过程中发生了错误
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static FlipflopContext<TResult> Error()
|
||||
{
|
||||
return new FlipflopContext<TResult>()
|
||||
{
|
||||
State = FlipflopStateType.Error,
|
||||
Type = TriggerDescription.External,
|
||||
Value = default,
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 取消触发器上下文,表示触发器被外部取消
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static FlipflopContext<TResult> Cancel()
|
||||
{
|
||||
return new FlipflopContext<TResult>()
|
||||
{
|
||||
State = FlipflopStateType.Cancel,
|
||||
Type = TriggerDescription.External,
|
||||
Value = default,
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 超时触发器上下文,表示触发器在指定时间内未完成
|
||||
/// </summary>
|
||||
/// <param name="state"></param>
|
||||
/// <returns></returns>
|
||||
public static FlipflopContext<TResult> Overtime(FlipflopStateType state = FlipflopStateType.Fail)
|
||||
{
|
||||
return new FlipflopContext<TResult>()
|
||||
{
|
||||
State = state,
|
||||
Type = TriggerDescription.Overtime,
|
||||
Value = default,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -98,7 +98,7 @@ namespace Serein.Library
|
||||
/// 起始节点
|
||||
/// </summary>
|
||||
[DataInfo]
|
||||
private IFlowNode _startNode;
|
||||
private IFlowNode? _startNode;
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -15,7 +15,6 @@ namespace Serein.Library
|
||||
{
|
||||
|
||||
private readonly SortedDictionary<string, CallNode> _callNodes = new SortedDictionary<string,CallNode>();
|
||||
//private readonly Dictionary<string, CallNode> _callNodes = new Dictionary<string,CallNode>();
|
||||
|
||||
/// <summary>
|
||||
/// 索引器,允许通过字符串索引访问CallNode
|
||||
@@ -700,7 +699,7 @@ namespace Serein.Library
|
||||
}
|
||||
/// <inheritdoc/>
|
||||
|
||||
public void WriteLine(InfoType type, string message, InfoClass @class = InfoClass.Trivial)
|
||||
public void WriteLine(InfoType type, string message, InfoClass @class = InfoClass.Debug)
|
||||
{
|
||||
Console.WriteLine(message);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user