Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
JsonXmlDataContract.cs
Go to the documentation of this file.
3using System.IO;
4using System.Text;
5using System.Xml;
6
8
9internal sealed class JsonXmlDataContract : JsonDataContract
10{
11 [RequiresUnreferencedCode("Data Contract Serialization and Deserialization might require types that cannot be statically analyzed. Make sure all of the required types are preserved.")]
16
17 [RequiresUnreferencedCode("Data Contract Serialization and Deserialization might require types that cannot be statically analyzed. Make sure all of the required types are preserved.")]
19 {
20 string s = jsonReader.ReadElementContentAsString();
21 DataContractSerializer dataContractSerializer = new DataContractSerializer(base.TraditionalDataContract.UnderlyingType, GetKnownTypesFromContext(context, context?.SerializerKnownTypeList), 1, ignoreExtensionDataObject: false, preserveObjectReferences: false);
25 context?.AddNewObject(obj);
26 return obj;
27 }
28
29 [RequiresUnreferencedCode("Data Contract Serialization and Deserialization might require types that cannot be statically analyzed. Make sure all of the required types are preserved.")]
39
41 {
43 if (context != null)
44 {
47 if (dataContractDictionaries != null)
48 {
49 foreach (Dictionary<XmlQualifiedName, DataContract> dictionary in dataContractDictionaries)
50 {
51 if (dictionary == null)
52 {
53 continue;
54 }
56 {
57 if (!list2.Contains(item.Key))
58 {
59 list2.Add(item.Key);
60 list.Add(item.Value.UnderlyingType);
61 }
62 }
63 }
64 }
65 if (serializerKnownTypeList != null)
66 {
67 list.AddRange(serializerKnownTypeList);
68 }
69 }
70 return list;
71 }
72}
bool ICollection< KeyValuePair< TKey, TValue > >. Contains(KeyValuePair< TKey, TValue > keyValuePair)
void AddRange(IEnumerable< KeyValuePair< TKey, TValue > > collection)
void Add(TKey key, TValue value)
override string ReadToEnd()
override object ReadJsonValueCore(XmlReaderDelegator jsonReader, XmlObjectSerializerReadContextComplexJson context)
JsonXmlDataContract(XmlDataContract traditionalXmlDataContract)
override void WriteJsonValueCore(XmlWriterDelegator jsonWriter, object obj, XmlObjectSerializerWriteContextComplexJson context, RuntimeTypeHandle declaredTypeHandle)
List< Type > GetKnownTypesFromContext(XmlObjectSerializerContext context, IList< Type > serializerKnownTypeList)
static Encoding UTF8
Definition Encoding.cs:526
static Type GetTypeFromHandle(RuntimeTypeHandle handle)
static XmlDictionaryReader CreateTextReader(byte[] buffer, XmlDictionaryReaderQuotas quotas)
Dictionary< XmlQualifiedName, DataContract >[] dataContractDictionaries