XFE Git
XFE Studio Git
Git 首页 全局搜索
XFE 主站 文档 NuGet

XFEExtension

【DLL】XFE各类拓展是一个C#的DLL库,旨在优化C#代码中常用语句的使用,并提供更简洁的访问方式,同时提供Xunit测试框架,快速搭建服务器/客户端,免费ChatGPTAPI接口,免费通讯服务器,XFE下载器,新增格式等

公开
关注 0 Fork 0 Star 0
返回提交历史

XFEstudio/XFEExtension

fix-对象解析现在不会对ValueType进行误处理

2233b7d
XFE工作室室长 <mail@xfegzs.com>
提交于

代码差异

3 个文件 +15 -20
Modified XFEExtension.NetCore.Test/Program.cs +12 -12
@@ -1,4 +1,5 @@
1 1 using XFEExtension.NetCore.FileExtension;
2 using XFEExtension.NetCore.StringExtension;
2 3 using XFEExtension.NetCore.XFEChatGPT;
3 4 using XFEExtension.NetCore.XFETransform.JsonConverter;
4 5
@@ -8,19 +9,18 @@ internal class Program
8 9 public static string CurrentDialogID { get; set; } = Guid.NewGuid().ToString();
9 10 private static void Main(string[] args)
10 11 {
11 using var client = new HttpClient();
12 client.DefaultRequestHeaders.Add("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/129.0.0.0 Safari/537.36 Edg/129.0.0.0");
13 client.DefaultRequestHeaders.Add("Origin", "https://www.piyao.org.cn");
14 client.DefaultRequestHeaders.Add("Referer", "https://www.piyao.org.cn/");
15 QueryableJsonNode jsonNode = @"C:\Users\XFEstudio\Desktop\work\C#\GitHub\XFEstudio\XUnitConsole\XUnitConsole\bin\Debug\net8.0\Json存储.txt".ReadOut()!;
16 //foreach (var node in jsonNode["data"]["package:list","name", "avatar_url_template"].PackageInListObject())
17 //{
18 // Console.WriteLine($"名称:{node["name"]}\tID:{node["avatar_url_template"]}");
19 //}
20 foreach (var node in jsonNode["data"].GetChildNodes())
12 //using var client = new HttpClient();
13 //client.DefaultRequestHeaders.Add("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/129.0.0.0 Safari/537.36 Edg/129.0.0.0");
14 //client.DefaultRequestHeaders.Add("Origin", "https://www.piyao.org.cn");
15 //client.DefaultRequestHeaders.Add("Referer", "https://www.piyao.org.cn/");
16 //QueryableJsonNode jsonNode = @"C:\Users\XFEstudio\Desktop\新建 文本文档.txt".ReadOut()!;
17 var dictionary = new Dictionary<string, string>
21 18 {
22 Console.WriteLine($"名称:{node["name"]}");
23 }
19 { "测试1", "测测" },
20 { "测试2", "测测" },
21 { "测试3", "测测" },
22 { "测试4", "测测" }
23 }.X();
24 24 }
25 25
26 26 private static void XFEChatGPT_XFEChatGPTMessageReceived(object? sender, XFEExtension.NetCore.XFEChatGPT.ChatGPTInnerClass.HelperClass.MemorableGPTMessageReceivedEventArgs e)
Modified XFEExtension.NetCore/XFEExtension.NetCore.csproj +2 -2
@@ -5,7 +5,7 @@
5 5 <ImplicitUsings>enable</ImplicitUsings>
6 6 <Nullable>enable</Nullable>
7 7 <GenerateDocumentationFile>True</GenerateDocumentationFile>
8 <Version>3.1.5</Version>
8 <Version>3.1.6</Version>
9 9 <Title>XFEExtension</Title>
10 10 <RepositoryUrl>https://github.com/XFEstudio/XFEExtension</RepositoryUrl>
11 11 <AnalysisLevel>latest</AnalysisLevel>
@@ -20,7 +20,7 @@
20 20 <PackageTags>XFE;拓展;GPT;Server;服务器;测试;XFEExtension</PackageTags>
21 21 <PackageReleaseNotes>## 调整
22 22
23 现在Json节点值为string类型
23 对象解析现在不会对ValueType进行误处理
24 24
25 25 ## 新增
26 26
Modified XFEExtension.NetCore/XFETransform/XFEConverter.cs +1 -6
@@ -17,7 +17,7 @@ public class XFEConverter
17 17 /// <returns></returns>
18 18 public static bool IsBasicType(Type type)
19 19 {
20 return type == typeof(string) || type == typeof(int) || type == typeof(double) || type == typeof(float) || type == typeof(decimal) || type == typeof(long) || type == typeof(short) || type == typeof(byte) || type == typeof(bool) || type == typeof(char) || type == typeof(nint) || type == typeof(uint) || type == typeof(ulong) || type == typeof(ushort) || type == typeof(sbyte) || type == typeof(DateTime);
20 return type == typeof(string) || type == typeof(int) || type == typeof(double) || type == typeof(float) || type == typeof(decimal) || type == typeof(long) || type == typeof(short) || type == typeof(byte) || type == typeof(bool) || type == typeof(char) || type == typeof(nint) || type == typeof(uint) || type == typeof(ulong) || type == typeof(ushort) || type == typeof(sbyte) || type == typeof(DateTime) || type == typeof(TimeSpan);
21 21 }
22 22
23 23 /// <summary>
@@ -99,15 +99,10 @@ public class XFEConverter
99 99 return new ObjectInfoImpl(stringConverter, name, objectPlace, layer, type, true, value);
100 100 else
101 101 {
102
103 102 if (type.IsAssignableTo(typeof(Enum)))
104 103 {
105 104 return new ObjectInfoImpl(stringConverter, name, ObjectPlace.Enum, layer, type, false, value);
106 105 }
107 else if (type.IsValueType)
108 {
109 return new ObjectInfoImpl(stringConverter, name, objectPlace, layer, type, false, value);
110 }
111 106 else if (value is Exception exception)
112 107 {
113 108 return new ObjectInfoImpl(stringConverter, name, objectPlace, layer, type, false, exception.ToString());