Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
StringConverter.cs
Go to the documentation of this file.
2
3internal sealed class StringConverter : JsonConverter<string>
4{
6 {
7 return reader.GetString();
8 }
9
11 {
12 if (value == null)
13 {
14 writer.WriteNullValue();
15 }
16 else
17 {
18 writer.WriteStringValue(value.AsSpan());
19 }
20 }
21
23 {
24 return reader.GetString();
25 }
26
28 {
29 if (options.DictionaryKeyPolicy != null && !isWritingExtensionDataProperty)
30 {
31 value = options.DictionaryKeyPolicy.ConvertName(value);
32 if (value == null)
33 {
35 }
36 }
37 writer.WritePropertyName(value);
38 }
39}
override string Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
override void WriteAsPropertyNameCore(Utf8JsonWriter writer, string value, JsonSerializerOptions options, bool isWritingExtensionDataProperty)
override string ReadAsPropertyNameCore(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
override void Write(Utf8JsonWriter writer, string value, JsonSerializerOptions options)
static void ThrowInvalidOperationException_NamingPolicyReturnNull(JsonNamingPolicy namingPolicy)