添加项目文件。

This commit is contained in:
zgf committed 2023-07-25 19:20:18 +08:00
1 parent 05e131ca4e
commit 514d6f5255
1162 files changed
+81255

No files matched your search

@@ -0,0 +1,40 @@
using System;
using System.Text.Json;
using System.Text.Json.Serialization;
namespace System.Text.Json.Serialization
{
/// <summary>
/// StringIgnoreLTGTConvert
/// 忽略客户端提交的 &lt;及&gt;字符
/// </summary>
public class StringIgnoreLTGTConverter : JsonConverter<string>
{
public override string Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
{
if (reader.TokenType == JsonTokenType.Null)
{
return null;
}
if (reader.TokenType == JsonTokenType.String)
{
return reader.GetString().Replace("<", string.Empty).Replace(">", string.Empty);
}
return null;
}
public override void Write(Utf8JsonWriter writer, string value, JsonSerializerOptions options)
{
if (value == null)
{
writer.WriteNullValue();
}
else
{
writer.WriteStringValue(value);
}
}
}
}