mirror of
https://gitee.com/langsisi_admin/serein-flow
synced 2026-03-02 15:50:47 +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:
@@ -9,14 +9,7 @@ namespace Serein.Script.Node
|
||||
/// <summary>
|
||||
/// 布尔字面量
|
||||
/// </summary>
|
||||
public class BooleanNode : ASTNode
|
||||
public class BooleanNode(bool value) : ValueNode<bool>(value)
|
||||
{
|
||||
public bool Value { get; }
|
||||
public BooleanNode(bool value) => Value = value;
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return $"{Value}";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,16 +6,7 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace Serein.Script.Node
|
||||
{
|
||||
internal class CharNode : ASTNode
|
||||
internal class CharNode(char value) : ValueNode<char>(value)
|
||||
{
|
||||
public char Value { get; }
|
||||
public CharNode(string value)
|
||||
{
|
||||
Value = char.Parse(value);
|
||||
}
|
||||
public override string ToString()
|
||||
{
|
||||
return $"'{Value}'";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,15 +9,9 @@ namespace Serein.Script.Node
|
||||
/// <summary>
|
||||
/// 数值型节点
|
||||
/// </summary>
|
||||
public abstract class NumberNode<T> : ASTNode where T : struct, IComparable<T>
|
||||
public abstract class NumberNode<T> : ValueNode<T> where T : struct, IComparable<T>
|
||||
{
|
||||
public T Value { get; }
|
||||
public NumberNode(T value) => Value = value;
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return $"{Value}";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
8
Serein.Script/Node/ValueNode/RawStringNode.cs
Normal file
8
Serein.Script/Node/ValueNode/RawStringNode.cs
Normal file
@@ -0,0 +1,8 @@
|
||||
namespace Serein.Script.Node
|
||||
{
|
||||
public class RawStringNode(string value) : ValueNode<string>(value)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -9,11 +9,9 @@ namespace Serein.Script.Node
|
||||
/// <summary>
|
||||
/// 字符串字面量节点
|
||||
/// </summary>
|
||||
public class StringNode : ASTNode
|
||||
public class StringNode : ValueNode<string>
|
||||
{
|
||||
public string Value { get; }
|
||||
|
||||
public StringNode(string input)
|
||||
public StringNode(string input) : base()
|
||||
{
|
||||
// 使用 StringBuilder 来构建输出
|
||||
StringBuilder output = new StringBuilder(input.Length);
|
||||
@@ -59,11 +57,6 @@ namespace Serein.Script.Node
|
||||
}
|
||||
Value = output.ToString();
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return $"\"{Value}\"";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
26
Serein.Script/Node/ValueNode/ValueNode.cs
Normal file
26
Serein.Script/Node/ValueNode/ValueNode.cs
Normal file
@@ -0,0 +1,26 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Serein.Script.Node
|
||||
{
|
||||
public class ValueNode<T> : ASTNode
|
||||
{
|
||||
public T Value { get; protected set; }
|
||||
|
||||
public ValueNode()
|
||||
{
|
||||
|
||||
}
|
||||
public ValueNode(T value)
|
||||
{
|
||||
this.Value = value;
|
||||
}
|
||||
public override string ToString()
|
||||
{
|
||||
return $"{Value}";
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user