为ReadPropertyName方法添加JsonSerializerOptions (#44)

* 为ReadPropertyName方法添加JsonSerializerOptions

* 添加reader.read();

---------

Co-authored-by: Yezi <53083103+yeziuku@users.noreply.github.com>
This commit is contained in:
milimoe 2023-07-25 09:16:23 +08:00 committed by GitHub
parent 20926ebb09
commit 9631267010
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 3 deletions

View File

@ -4,6 +4,6 @@ namespace Milimoe.FunGame.Core.Interface.Base
{ {
internal interface IEntityConverter<T> internal interface IEntityConverter<T>
{ {
public void ReadPropertyName(ref Utf8JsonReader reader, string propertyName, ref T? result); public void ReadPropertyName(ref Utf8JsonReader reader, string propertyName, JsonSerializerOptions options, ref T? result);
} }
} }

View File

@ -17,13 +17,14 @@ namespace Milimoe.FunGame.Core.Library.Common.Architecture
if (reader.TokenType == JsonTokenType.PropertyName) if (reader.TokenType == JsonTokenType.PropertyName)
{ {
string propertyName = reader.GetString() ?? ""; string propertyName = reader.GetString() ?? "";
ReadPropertyName(ref reader, propertyName, ref result); reader.Read();
ReadPropertyName(ref reader, propertyName, options, ref result);
} }
} }
return 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);
} }
} }