Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
JsonMetadataServicesConverter.cs
Go to the documentation of this file.
2
4
6{
8
10
12
14 {
15 get
16 {
17 if (_converter == null)
18 {
20 }
21 return _converter;
22 }
23 }
24
26
27 internal override Type KeyType => Converter.KeyType;
28
29 internal override Type ElementType => Converter.ElementType;
30
31 internal override bool ConstructorIsParameterized => Converter.ConstructorIsParameterized;
32
38
40 {
43 {
44 if (jsonTypeInfo.PropertyCache == null)
45 {
46 jsonTypeInfo.InitializePropCache();
47 }
48 if (jsonTypeInfo.ParameterCache == null && jsonTypeInfo.IsObjectWithParameterizedCtor)
49 {
50 jsonTypeInfo.InitializeParameterCache();
51 }
52 }
53 return Converter.OnTryRead(ref reader, typeToConvert, options, ref state, out value);
54 }
55
57 {
59 if (!state.SupportContinuation && jsonTypeInfo is JsonTypeInfo<T> { SerializeHandler: not null } jsonTypeInfo2)
60 {
62 if (context != null && context.CanUseSerializationLogic)
63 {
64 jsonTypeInfo2.SerializeHandler(writer, value);
65 return true;
66 }
67 }
68 if (_converterStrategy == ConverterStrategy.Object && jsonTypeInfo.PropertyCache == null)
69 {
70 jsonTypeInfo.InitializePropCache();
71 }
72 return Converter.OnTryWrite(writer, value, options, ref state);
73 }
74}
JsonMetadataServicesConverter(Func< JsonConverter< T > > converterCreator, ConverterStrategy converterStrategy)
override bool OnTryWrite(Utf8JsonWriter writer, T value, JsonSerializerOptions options, ref WriteStack state)
override bool OnTryRead(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options, ref ReadStack state, out T value)
JsonTypeInfo(Type type, JsonSerializerOptions options)