Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
DictionaryDefaultConverter.cs
Go to the documentation of this file.
3
5
6internal abstract class DictionaryDefaultConverter<TDictionary, TKey, TValue> : JsonDictionaryConverter<TDictionary, TKey, TValue> where TDictionary : IEnumerable<KeyValuePair<TKey, TValue>>
7{
8 internal override bool CanHaveIdMetadata => true;
9
11 {
13 if (state.Current.CollectionEnumerator == null)
14 {
16 if (!enumerator.MoveNext())
17 {
18 enumerator.Dispose();
19 return true;
20 }
21 }
22 else
23 {
24 enumerator = (IEnumerator<KeyValuePair<TKey, TValue>>)state.Current.CollectionEnumerator;
25 }
26 JsonTypeInfo jsonTypeInfo = state.Current.JsonTypeInfo;
27 if (_keyConverter == null)
28 {
30 }
31 if (_valueConverter == null)
32 {
34 }
35 do
36 {
37 if (ShouldFlush(writer, ref state))
38 {
40 return false;
41 }
42 if ((int)state.Current.PropertyState < 2)
43 {
45 TKey key = enumerator.Current.Key;
46 _keyConverter.WriteAsPropertyNameCore(writer, key, options, state.Current.IsWritingExtensionDataProperty);
47 }
48 TValue value2 = enumerator.Current.Value;
50 {
52 return false;
53 }
54 state.Current.EndDictionaryElement();
55 }
56 while (enumerator.MoveNext());
57 enumerator.Dispose();
58 return true;
59 }
60}
override bool OnWriteResume(Utf8JsonWriter writer, TDictionary value, JsonSerializerOptions options, ref WriteStack state)
bool TryWrite(Utf8JsonWriter writer, in T value, JsonSerializerOptions options, ref WriteStack state)
virtual void WriteAsPropertyNameCore(Utf8JsonWriter writer, T value, JsonSerializerOptions options, bool isWritingExtensionDataProperty)