mirror of
https://gitee.com/langsisi_admin/serein-flow
synced 2026-04-16 21:06:35 +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:
46
Serein.Extend.NewtonsoftJson/NewtonsoftJsonValueToken.cs
Normal file
46
Serein.Extend.NewtonsoftJson/NewtonsoftJsonValueToken.cs
Normal file
@@ -0,0 +1,46 @@
|
||||
using Newtonsoft.Json.Linq;
|
||||
using Serein.Library.Api;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Serein.Extend.NewtonsoftJson
|
||||
{
|
||||
public sealed class NewtonsoftJsonValueToken : IJsonToken
|
||||
{
|
||||
private readonly JToken _token;
|
||||
|
||||
public NewtonsoftJsonValueToken(JToken token)
|
||||
{
|
||||
_token = token ?? throw new ArgumentNullException(nameof(token));
|
||||
}
|
||||
|
||||
public bool IsNull => _token.Type == JTokenType.Null || _token.Type == JTokenType.Undefined;
|
||||
public bool IsObject => false;
|
||||
public bool IsArray => false;
|
||||
|
||||
|
||||
|
||||
public string GetString() => _token.Type == JTokenType.Null ? string.Empty : _token.ToString();
|
||||
public int GetInt32() => _token.Value<int>();
|
||||
public bool GetBoolean() => _token.Value<bool>();
|
||||
|
||||
public IJsonToken this[object key] => throw new InvalidOperationException("不是对象/数组类型");
|
||||
public IEnumerable<IJsonToken> EnumerateArray() => throw new InvalidOperationException("不是数组类型");
|
||||
|
||||
public T ToObject<T>() => _token.ToObject<T>();
|
||||
public object ToObject(Type type) => _token.ToObject(type);
|
||||
public override string ToString() => _token.ToString();
|
||||
|
||||
public bool TryGetValue(string name, out IJsonToken token) => throw new InvalidOperationException("不是对象类型");
|
||||
|
||||
public IJsonToken? GetValue(string name) => throw new InvalidOperationException("不是对象类型");
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user