版本号更新

This commit is contained in:
fengjiayi
2025-08-04 14:57:17 +08:00
parent 219bac9e8d
commit 34939cd34c
9 changed files with 77 additions and 20 deletions

View File

@@ -2,7 +2,7 @@
<PropertyGroup> <PropertyGroup>
<Title>SereinFow</Title> <Title>SereinFow</Title>
<Version>1.2.3</Version> <Version>1.2.4</Version>
<Description>动态节点流、可视化编辑的基本依赖支持导入C# DLL生成自定义节点提供二次开发支持适合用于可视化编程和流程设计</Description> <Description>动态节点流、可视化编辑的基本依赖支持导入C# DLL生成自定义节点提供二次开发支持适合用于可视化编程和流程设计</Description>
<PackageReadmeFile>README.md</PackageReadmeFile> <PackageReadmeFile>README.md</PackageReadmeFile>
<RepositoryUrl>https://github.com/fhhyyp/serein-flow</RepositoryUrl> <RepositoryUrl>https://github.com/fhhyyp/serein-flow</RepositoryUrl>

View File

@@ -12,8 +12,13 @@ namespace Serein.Library.Utils
public static class TypeHelper public static class TypeHelper
{ {
/// <summary>
public static string GetFriendlyName(this Type type,bool isFullName = true) /// 对于泛型类型以友好格式显示其文本值
/// </summary>
/// <param name="type"></param>
/// <param name="isFullName"></param>
/// <returns></returns>
public static string GetFriendlyName(this Type type, bool isFullName = true)
{ {
if (type.IsGenericType) if (type.IsGenericType)
{ {
@@ -45,11 +50,20 @@ namespace Serein.Library.Utils
} }
else 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(int)] = "int",
[typeof(string)] = "string", [typeof(string)] = "string",
@@ -67,7 +81,7 @@ namespace Serein.Library.Utils
[typeof(ulong)] = "ulong", [typeof(ulong)] = "ulong",
[typeof(ushort)] = "ushort", [typeof(ushort)] = "ushort",
[typeof(sbyte)] = "sbyte", [typeof(sbyte)] = "sbyte",
}; };*/
/// <summary> /// <summary>

View File

@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<Version>1.2.3</Version> <Version>1.2.4</Version>
<TargetFramework>net8.0</TargetFramework> <TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings> <ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable> <Nullable>enable</Nullable>

View File

@@ -8,7 +8,7 @@
<BaseOutputPath>..\.\.Output</BaseOutputPath> <BaseOutputPath>..\.\.Output</BaseOutputPath>
<Title>为 SereinFlow 提供的 JSON 扩展</Title> <Title>为 SereinFlow 提供的 JSON 扩展</Title>
<Version>1.0.0</Version> <Version>1.0.1</Version>
<Description>通过 NewtonsoftJson 实现JSON门户扩展用于解决 Serein.Proto.* 项目下需要 JSON 序列化与反序列化的场景</Description> <Description>通过 NewtonsoftJson 实现JSON门户扩展用于解决 Serein.Proto.* 项目下需要 JSON 序列化与反序列化的场景</Description>
<PackageLicenseExpression>MIT</PackageLicenseExpression> <PackageLicenseExpression>MIT</PackageLicenseExpression>
<PackageRequireLicenseAcceptance>True</PackageRequireLicenseAcceptance> <PackageRequireLicenseAcceptance>True</PackageRequireLicenseAcceptance>

View File

@@ -2,7 +2,7 @@
<PropertyGroup> <PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework> <TargetFramework>netstandard2.0</TargetFramework>
<Version>1.2.3</Version> <Version>1.2.4</Version>
<IsRoslynComponent>false</IsRoslynComponent><!--控制代码生成器--> <IsRoslynComponent>false</IsRoslynComponent><!--控制代码生成器-->
<!--<IsRoslynComponent>true</IsRoslynComponent>--> <!--<IsRoslynComponent>true</IsRoslynComponent>-->
<BaseOutputPath>..\.\.Output</BaseOutputPath> <BaseOutputPath>..\.\.Output</BaseOutputPath>

View File

@@ -8,7 +8,7 @@
<BaseOutputPath>..\.\.Output</BaseOutputPath> <BaseOutputPath>..\.\.Output</BaseOutputPath>
<Title>基于Json数据载体的WebSocket交互工具包</Title> <Title>基于Json数据载体的WebSocket交互工具包</Title>
<Version>1.0.0</Version> <Version>1.0.1</Version>
<Description>基于Json数据载体的WebSocket交互工具包</Description> <Description>基于Json数据载体的WebSocket交互工具包</Description>
<PackageLicenseExpression>MIT</PackageLicenseExpression> <PackageLicenseExpression>MIT</PackageLicenseExpression>
<PackageRequireLicenseAcceptance>True</PackageRequireLicenseAcceptance> <PackageRequireLicenseAcceptance>True</PackageRequireLicenseAcceptance>

View File

@@ -7,7 +7,7 @@
<BaseOutputPath>..\.\.Output</BaseOutputPath> <BaseOutputPath>..\.\.Output</BaseOutputPath>
<Title>基于AST实现的脚本语言</Title> <Title>基于AST实现的脚本语言</Title>
<Version>1.0.0</Version> <Version>1.0.1</Version>
<Description>使用了Emit构造委托缓存调用性能客观。提供了类型推导、转换C#代码功能。用于流程图中脚本处理,也可在其他地方进行使用。</Description> <Description>使用了Emit构造委托缓存调用性能客观。提供了类型推导、转换C#代码功能。用于流程图中脚本处理,也可在其他地方进行使用。</Description>
<PackageLicenseExpression>MIT</PackageLicenseExpression> <PackageLicenseExpression>MIT</PackageLicenseExpression>
<PackageReadmeFile>README.md</PackageReadmeFile> <PackageReadmeFile>README.md</PackageReadmeFile>

View File

@@ -82,12 +82,12 @@ namespace Serein.Script
string? returnContent; string? returnContent;
if (_isTaskMain) if (_isTaskMain)
{ {
returnContent = $"global::{taskFullName}<global::{methodResultType.FullName}>"; returnContent = $"global::{taskFullName}<global::{methodResultType.GetFriendlyName()}>";
sereinScriptMethodInfo.IsAsync = true; sereinScriptMethodInfo.IsAsync = true;
} }
else else
{ {
returnContent = $"global::{methodResultType.FullName}"; returnContent = $"global::{methodResultType.GetFriendlyName()}";
sereinScriptMethodInfo.IsAsync = false; sereinScriptMethodInfo.IsAsync = false;
} }
@@ -118,7 +118,7 @@ namespace Serein.Script
{ {
var varName = idf.Name; var varName = idf.Name;
var varType = _symbolInfos[idf]; var varType = _symbolInfos[idf];
AppendLine($"global::{varType.FullName} {varName} = default; // 变量"); AppendLine($"global::{varType.GetFriendlyName()} {varName} = default; // 变量");
} }
AppendLine(""); AppendLine("");
@@ -163,7 +163,7 @@ namespace Serein.Script
ParameterType = type, ParameterType = type,
ParamName = paramName, ParamName = paramName,
}); });
return $"global::{type.FullName} {paramName}"; return $"global::{type.GetFriendlyName()} {paramName}";
}); });
return string.Join(',', values); return string.Join(',', values);
} }
@@ -177,7 +177,6 @@ namespace Serein.Script
case ReturnNode returnNode: // 程序退出节点 case ReturnNode returnNode: // 程序退出节点
void ConvertCodeOfReturnNode(ReturnNode returnNode) void ConvertCodeOfReturnNode(ReturnNode returnNode)
{ {
Append(Tab); Append(Tab);
if (returnNode.Value is not null) if (returnNode.Value is not null)
{ {
@@ -205,7 +204,50 @@ namespace Serein.Script
Append("\"\"\""); Append("\"\"\"");
break; break;
case StringNode stringNode: // 字符串字面量 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; break;
case BooleanNode booleanNode: // 布尔值字面量 case BooleanNode booleanNode: // 布尔值字面量
Append($"{(booleanNode.Value ? "true" : "false")}"); Append($"{(booleanNode.Value ? "true" : "false")}");
@@ -333,7 +375,7 @@ namespace Serein.Script
{ {
var arrType = this._symbolInfos[arrayDefintionNode]; var arrType = this._symbolInfos[arrayDefintionNode];
var tab = new string(' ', (_indentLevel + 1) * 4); 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++) for (int index = 0; index < arrayDefintionNode.Elements.Count; index++)
{ {
ASTNode? e = arrayDefintionNode.Elements[index]; ASTNode? e = arrayDefintionNode.Elements[index];
@@ -360,7 +402,7 @@ namespace Serein.Script
{ {
var propertyName = property.Key; var propertyName = property.Key;
var propertyType = _symbolInfos[property.Value]; var propertyType = _symbolInfos[property.Value];
AppendLine($"public global::{propertyType.FullName} {propertyName} {{ get; set; }}"); AppendLine($"public global::{propertyType.GetFriendlyName()} {propertyName} {{ get; set; }}");
} }
Unindent(); Unindent();
AppendLine("}"); AppendLine("}");
@@ -507,7 +549,7 @@ namespace Serein.Script
} }
} }
} }

View File

@@ -49,6 +49,7 @@
<Compile Remove="Themes\ConnectionControl.xaml.cs" /> <Compile Remove="Themes\ConnectionControl.xaml.cs" />
<Compile Remove="Themes\ExplicitDataControl.xaml.cs" /> <Compile Remove="Themes\ExplicitDataControl.xaml.cs" />
<Compile Remove="Themes\ObjectViewerControl1.xaml.cs" /> <Compile Remove="Themes\ObjectViewerControl1.xaml.cs" />
<Compile Remove="Tool\IEventBus.cs" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>