From 96312670104767a9a1a8771f8bf4109abbd30b45 Mon Sep 17 00:00:00 2001 From: milimoe <110188673+milimoe@users.noreply.github.com> Date: Tue, 25 Jul 2023 09:16:23 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=BAReadPropertyName=E6=96=B9=E6=B3=95?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0JsonSerializerOptions=20(#44)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 为ReadPropertyName方法添加JsonSerializerOptions * 添加reader.read(); --------- Co-authored-by: Yezi <53083103+yeziuku@users.noreply.github.com> --- Interface/Base/IEntityConverter.cs | 2 +- Library/Common/Architecture/BaseEntityConverter.cs | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Interface/Base/IEntityConverter.cs b/Interface/Base/IEntityConverter.cs index c1fd4f9..ed1ecca 100644 --- a/Interface/Base/IEntityConverter.cs +++ b/Interface/Base/IEntityConverter.cs @@ -4,6 +4,6 @@ namespace Milimoe.FunGame.Core.Interface.Base { internal interface IEntityConverter { - public void ReadPropertyName(ref Utf8JsonReader reader, string propertyName, ref T? result); + public void ReadPropertyName(ref Utf8JsonReader reader, string propertyName, JsonSerializerOptions options, ref T? result); } } diff --git a/Library/Common/Architecture/BaseEntityConverter.cs b/Library/Common/Architecture/BaseEntityConverter.cs index e935b40..33309a9 100644 --- a/Library/Common/Architecture/BaseEntityConverter.cs +++ b/Library/Common/Architecture/BaseEntityConverter.cs @@ -17,13 +17,14 @@ namespace Milimoe.FunGame.Core.Library.Common.Architecture if (reader.TokenType == JsonTokenType.PropertyName) { string propertyName = reader.GetString() ?? ""; - ReadPropertyName(ref reader, propertyName, ref result); + reader.Read(); + ReadPropertyName(ref reader, propertyName, options, ref result); } } return result; } - public abstract void ReadPropertyName(ref Utf8JsonReader reader, string propertyName, ref T? result); + public abstract void ReadPropertyName(ref Utf8JsonReader reader, string propertyName, JsonSerializerOptions options, ref T? result); } }