mirror of
https://gitee.com/langsisi_admin/serein-flow
synced 2026-03-02 15:50:47 +08:00
版本号更新
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
|
||||
<PropertyGroup>
|
||||
<Title>SereinFow</Title>
|
||||
<Version>1.2.3</Version>
|
||||
<Version>1.2.4</Version>
|
||||
<Description>动态节点流、可视化编辑的基本依赖,支持导入C# DLL生成自定义节点,提供二次开发支持,适合用于可视化编程和流程设计</Description>
|
||||
<PackageReadmeFile>README.md</PackageReadmeFile>
|
||||
<RepositoryUrl>https://github.com/fhhyyp/serein-flow</RepositoryUrl>
|
||||
|
||||
@@ -12,8 +12,13 @@ namespace Serein.Library.Utils
|
||||
public static class TypeHelper
|
||||
{
|
||||
|
||||
|
||||
public static string GetFriendlyName(this Type type,bool isFullName = true)
|
||||
/// <summary>
|
||||
/// 对于泛型类型以友好格式显示其文本值
|
||||
/// </summary>
|
||||
/// <param name="type"></param>
|
||||
/// <param name="isFullName"></param>
|
||||
/// <returns></returns>
|
||||
public static string GetFriendlyName(this Type type, bool isFullName = true)
|
||||
{
|
||||
if (type.IsGenericType)
|
||||
{
|
||||
@@ -45,11 +50,20 @@ namespace Serein.Library.Utils
|
||||
}
|
||||
else
|
||||
{
|
||||
return TypeMap.TryGetValue(type, out var alias) ? alias : isFullName ? type.FullName : type.Name; ;
|
||||
|
||||
if (isFullName)
|
||||
{
|
||||
return type.FullName;
|
||||
}
|
||||
else
|
||||
{
|
||||
return type.Name;
|
||||
}
|
||||
//return TypeMap.TryGetValue(type, out var alias) ? alias : isFullName ? type.FullName : type.Name; ;
|
||||
}
|
||||
}
|
||||
|
||||
private static readonly Dictionary<Type, string> TypeMap = new Dictionary<Type, string>
|
||||
/*private static readonly Dictionary<Type, string> TypeMap = new Dictionary<Type, string>
|
||||
{
|
||||
[typeof(int)] = "int",
|
||||
[typeof(string)] = "string",
|
||||
@@ -67,7 +81,7 @@ namespace Serein.Library.Utils
|
||||
[typeof(ulong)] = "ulong",
|
||||
[typeof(ushort)] = "ushort",
|
||||
[typeof(sbyte)] = "sbyte",
|
||||
};
|
||||
};*/
|
||||
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<Version>1.2.3</Version>
|
||||
<Version>1.2.4</Version>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
<BaseOutputPath>..\.\.Output</BaseOutputPath>
|
||||
|
||||
<Title>为 SereinFlow 提供的 JSON 扩展</Title>
|
||||
<Version>1.0.0</Version>
|
||||
<Version>1.0.1</Version>
|
||||
<Description>通过 NewtonsoftJson 实现JSON门户扩展,用于解决 Serein.Proto.* 项目下需要 JSON 序列化与反序列化的场景</Description>
|
||||
<PackageLicenseExpression>MIT</PackageLicenseExpression>
|
||||
<PackageRequireLicenseAcceptance>True</PackageRequireLicenseAcceptance>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netstandard2.0</TargetFramework>
|
||||
<Version>1.2.3</Version>
|
||||
<Version>1.2.4</Version>
|
||||
<IsRoslynComponent>false</IsRoslynComponent><!--控制代码生成器-->
|
||||
<!--<IsRoslynComponent>true</IsRoslynComponent>-->
|
||||
<BaseOutputPath>..\.\.Output</BaseOutputPath>
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
<BaseOutputPath>..\.\.Output</BaseOutputPath>
|
||||
|
||||
<Title>基于Json数据载体的WebSocket交互工具包</Title>
|
||||
<Version>1.0.0</Version>
|
||||
<Version>1.0.1</Version>
|
||||
<Description>基于Json数据载体的WebSocket交互工具包</Description>
|
||||
<PackageLicenseExpression>MIT</PackageLicenseExpression>
|
||||
<PackageRequireLicenseAcceptance>True</PackageRequireLicenseAcceptance>
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<BaseOutputPath>..\.\.Output</BaseOutputPath>
|
||||
|
||||
<Title>基于AST实现的脚本语言</Title>
|
||||
<Version>1.0.0</Version>
|
||||
<Version>1.0.1</Version>
|
||||
<Description>使用了Emit构造委托缓存调用,性能客观。提供了类型推导、转换C#代码功能。用于流程图中脚本处理,也可在其他地方进行使用。</Description>
|
||||
<PackageLicenseExpression>MIT</PackageLicenseExpression>
|
||||
<PackageReadmeFile>README.md</PackageReadmeFile>
|
||||
|
||||
@@ -82,12 +82,12 @@ namespace Serein.Script
|
||||
string? returnContent;
|
||||
if (_isTaskMain)
|
||||
{
|
||||
returnContent = $"global::{taskFullName}<global::{methodResultType.FullName}>";
|
||||
returnContent = $"global::{taskFullName}<global::{methodResultType.GetFriendlyName()}>";
|
||||
sereinScriptMethodInfo.IsAsync = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
returnContent = $"global::{methodResultType.FullName}";
|
||||
returnContent = $"global::{methodResultType.GetFriendlyName()}";
|
||||
sereinScriptMethodInfo.IsAsync = false;
|
||||
}
|
||||
|
||||
@@ -118,7 +118,7 @@ namespace Serein.Script
|
||||
{
|
||||
var varName = idf.Name;
|
||||
var varType = _symbolInfos[idf];
|
||||
AppendLine($"global::{varType.FullName} {varName} = default; // 变量");
|
||||
AppendLine($"global::{varType.GetFriendlyName()} {varName} = default; // 变量");
|
||||
}
|
||||
AppendLine("");
|
||||
|
||||
@@ -163,7 +163,7 @@ namespace Serein.Script
|
||||
ParameterType = type,
|
||||
ParamName = paramName,
|
||||
});
|
||||
return $"global::{type.FullName} {paramName}";
|
||||
return $"global::{type.GetFriendlyName()} {paramName}";
|
||||
});
|
||||
return string.Join(',', values);
|
||||
}
|
||||
@@ -177,7 +177,6 @@ namespace Serein.Script
|
||||
case ReturnNode returnNode: // 程序退出节点
|
||||
void ConvertCodeOfReturnNode(ReturnNode returnNode)
|
||||
{
|
||||
|
||||
Append(Tab);
|
||||
if (returnNode.Value is not null)
|
||||
{
|
||||
@@ -205,7 +204,50 @@ namespace Serein.Script
|
||||
Append("\"\"\"");
|
||||
break;
|
||||
case StringNode stringNode: // 字符串字面量
|
||||
Append($"\"{stringNode.Value}\"");
|
||||
void ConvertCodeOfStringNode(StringNode stringNode)
|
||||
{
|
||||
static string EscapeForCSharpString(string input)
|
||||
{
|
||||
return input
|
||||
.Replace("\\", "\\\\")
|
||||
.Replace("\"", "\\\"")
|
||||
.Replace("\0", "\\0")
|
||||
.Replace("\a", "\\a")
|
||||
.Replace("\b", "\\b")
|
||||
.Replace("\f", "\\f")
|
||||
.Replace("\n", "\\n")
|
||||
.Replace("\r", "\\r")
|
||||
.Replace("\t", "\\t")
|
||||
.Replace("\v", "\\v");
|
||||
}
|
||||
var value = stringNode.Value;
|
||||
var sp = value.Split(Environment.NewLine);
|
||||
if(sp.Length == 1)
|
||||
{
|
||||
Append($"\"{value}\"");
|
||||
}
|
||||
else
|
||||
{
|
||||
Append($"\"");
|
||||
foreach (var s in sp)
|
||||
{
|
||||
var content = EscapeForCSharpString(s);
|
||||
if(OperatingSystem.IsWindows())
|
||||
{
|
||||
Append($"\\r\\n{content}");
|
||||
}
|
||||
else if (OperatingSystem.IsLinux())
|
||||
{
|
||||
Append($"\\n{content}");
|
||||
}
|
||||
|
||||
}
|
||||
Append($"\"");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
ConvertCodeOfStringNode(stringNode);
|
||||
break;
|
||||
case BooleanNode booleanNode: // 布尔值字面量
|
||||
Append($"{(booleanNode.Value ? "true" : "false")}");
|
||||
@@ -333,7 +375,7 @@ namespace Serein.Script
|
||||
{
|
||||
var arrType = this._symbolInfos[arrayDefintionNode];
|
||||
var tab = new string(' ', (_indentLevel + 1) * 4);
|
||||
Append($"new global::{arrType.FullName}{{{Environment.NewLine}");
|
||||
Append($"new global::{arrType.GetFriendlyName()}{{{Environment.NewLine}");
|
||||
for (int index = 0; index < arrayDefintionNode.Elements.Count; index++)
|
||||
{
|
||||
ASTNode? e = arrayDefintionNode.Elements[index];
|
||||
@@ -360,7 +402,7 @@ namespace Serein.Script
|
||||
{
|
||||
var propertyName = property.Key;
|
||||
var propertyType = _symbolInfos[property.Value];
|
||||
AppendLine($"public global::{propertyType.FullName} {propertyName} {{ get; set; }}");
|
||||
AppendLine($"public global::{propertyType.GetFriendlyName()} {propertyName} {{ get; set; }}");
|
||||
}
|
||||
Unindent();
|
||||
AppendLine("}");
|
||||
@@ -507,7 +549,7 @@ namespace Serein.Script
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -49,6 +49,7 @@
|
||||
<Compile Remove="Themes\ConnectionControl.xaml.cs" />
|
||||
<Compile Remove="Themes\ExplicitDataControl.xaml.cs" />
|
||||
<Compile Remove="Themes\ObjectViewerControl1.xaml.cs" />
|
||||
<Compile Remove="Tool\IEventBus.cs" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
Reference in New Issue
Block a user