XFEExtension
【DLL】XFE各类拓展是一个C#的DLL库,旨在优化C#代码中常用语句的使用,并提供更简洁的访问方式,同时提供Xunit测试框架,快速搭建服务器/客户端,免费ChatGPTAPI接口,免费通讯服务器,XFE下载器,新增格式等
关注
0
Fork
0
Star
0
返回提交历史
Modified
XFEExtension.NetCore.Test/Program.cs
+1
-32
Modified
XFEExtension.NetCore/StringExtension/StringExtension.cs
+3
-2
Modified
XFEExtension.NetCore/XFEExtension.NetCore.csproj
+3
-2
Modified
XFEExtension.NetCore/XFETransform/StringConverter/JsonTransformer.cs
+11
-1
XFEstudio/XFEExtension
fix-现在string扩展方法中的IsNullOrEmpty和IsNullOrWhiteSpace可以正常判断null是否为空 fix-JsonTransformer的现在可以正常处理第一级为数组的情况
9f923c3
代码差异
4 个文件
+18
-37
@@ -1,9 +1,4 @@
1
using XFEExtension.NetCore.StringExtension;
2
using XFEExtension.NetCore.Test;
3
using XFEExtension.NetCore.XFEChatGPT;
4
using XFEExtension.NetCore.XFETransform;
5
using XFEExtension.NetCore.XFETransform.ObjectInfoAnalyzer;
6
using XFEExtension.NetCore.XFETransform.StringConverter;
1
using XFEExtension.NetCore.XFEChatGPT;
7
2
8
3
internal class Program
9
4
{
@@ -16,32 +11,6 @@ internal class Program
16
11
//client.DefaultRequestHeaders.Add("Origin", "https://www.piyao.org.cn");
17
12
//client.DefaultRequestHeaders.Add("Referer", "https://www.piyao.org.cn/");
18
13
//QueryableJsonNode jsonNode = @"C:\Users\XFEstudio\Desktop\新建 文本文档.txt".ReadOut()!;
19
var dictionary = new Dictionary<string, string>
20
{
21
{ "测试1", "测测" },
22
{ "测试2", "测测" },
23
{ "测试3", "测测" },
24
{ "测试4", "测测" }
25
}.X();
26
var testClass = new TestClass("张三", "测试秒睡", 14)
27
{
28
Enum = MyEnum.Test1,
29
OS = 1,
30
MyProperty = true,
31
Tags = [["测试1", "ce"], ["ce2", "ce3"]],
32
SubClass = new()
33
{
34
InnerClass = new()
35
{
36
Name = "李四",
37
Description = "李四的描述"
38
}
39
}
40
};
41
var result = XFEConverter.GetObjectInfo(StringConverter.ObjectAnalyzer, "分析对象", ObjectPlace.Main, 0, [testClass], testClass.GetType(), testClass, false, true, false);
42
var targetField = result.SubObjects[9].SubObjects[0].SubObjects[0];
43
targetField.FieldInfo.SetValue(targetField.Parent.Value, "王五");
44
Console.WriteLine(result.OutPutObject());
45
14
}
46
15
47
16
private static void XFEChatGPT_XFEChatGPTMessageReceived(object? sender, XFEExtension.NetCore.XFEChatGPT.ChatGPTInnerClass.HelperClass.MemorableGPTMessageReceivedEventArgs e)
@@ -1,4 +1,5 @@
1
1
using System.Diagnostics;
2
using System.Diagnostics.CodeAnalysis;
2
3
using System.Globalization;
3
4
using System.Text;
4
5
using System.Text.RegularExpressions;
@@ -78,14 +79,14 @@ public static partial class StringExtension
78
79
/// </summary>
79
80
/// <param name="str"></param>
80
81
/// <returns></returns>
81
public static bool IsNullOrEmpty(this string? str) => string.IsNullOrEmpty(str);
82
public static bool IsNullOrEmpty([NotNullWhen(false)] this string? str) => string.IsNullOrEmpty(str);
82
83
83
84
/// <summary>
84
85
/// 判断字符串是否是 null 、空字符串和仅包含空格的字符串
85
86
/// </summary>
86
87
/// <param name="str"></param>
87
88
/// <returns></returns>
88
public static bool IsNullOrWhiteSpace(this string? str) => string.IsNullOrWhiteSpace(str);
89
public static bool IsNullOrWhiteSpace([NotNullWhen(false)] this string? str) => string.IsNullOrWhiteSpace(str);
89
90
90
91
/// <summary>
91
92
/// 判断字符串是否为邮箱地址
@@ -5,7 +5,7 @@
5
5
<ImplicitUsings>enable</ImplicitUsings>
6
6
<Nullable>enable</Nullable>
7
7
<GenerateDocumentationFile>True</GenerateDocumentationFile>
8
<Version>3.2.2</Version>
8
<Version>3.2.3</Version>
9
9
<Title>XFEExtension</Title>
10
10
<RepositoryUrl>https://github.com/XFEstudio/XFEExtension</RepositoryUrl>
11
11
<AnalysisLevel>latest</AnalysisLevel>
@@ -21,7 +21,8 @@
21
21
<PackageReleaseNotes>
22
22
## 调整
23
23
24
修复:现在string扩展方法中的IsNullOrEmpty和IsNullOrWhiteSpace现在允许传入可为null的string对象
24
修复:现在string扩展方法中的IsNullOrEmpty和IsNullOrWhiteSpace可以正常判断null是否为空
25
修复:JsonTransformer的现在可以正常处理第一级为数组的情况
25
26
26
27
## 新增
27
28
@@ -54,10 +54,20 @@ public class JsonTransformer : StringConverter
54
54
{
55
55
if (objectInfo.Layer == 0)
56
56
{
57
outPutString += objectInfo.SubObjects is not null ? $$"""
57
if (objectInfo.IsArray)
58
{
59
outPutString += objectInfo.SubObjects is not null ? $$"""
60
[{{OutPutSubObjects(objectInfo.SubObjects)}}
61
]
62
""" : "null";
63
}
64
else
65
{
66
outPutString += objectInfo.SubObjects is not null ? $$"""
58
67
{{{OutPutSubObjects(objectInfo.SubObjects)}}
59
68
}
60
69
""" : "null";
70
}
61
71
}
62
72
else
63
73
{