Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
XmlObjectSerializerWriteContextComplexJson.cs
Go to the documentation of this file.
4using System.Xml;
5
7
9{
11
13
14 private readonly bool _useSimpleDictionaryFormat;
15
17
19
21
26
36
37 internal override void WriteArraySize(XmlWriterDelegator xmlWriter, int size)
38 {
39 }
40
42 {
44 {
45 if (string.IsNullOrEmpty(dataContractNamespace))
46 {
48 }
49 else
50 {
52 }
53 }
54 }
55
57 {
58 if (!string.IsNullOrEmpty(dataContractNamespace))
59 {
60 if (dataContractNamespace[0] == '#')
61 {
62 return "\\" + dataContractNamespace;
63 }
64 if (dataContractNamespace[0] == '\\')
65 {
66 return "\\" + dataContractNamespace;
67 }
68 if (dataContractNamespace.StartsWith("http://schemas.datacontract.org/2004/07/", StringComparison.Ordinal))
69 {
71 }
72 }
74 }
75
76 [RequiresUnreferencedCode("Data Contract Serialization and Deserialization might require types that cannot be statically analyzed. Make sure all of the required types are preserved.")]
78 {
79 if ((contract.Name != declaredContract.Name || contract.Namespace != declaredContract.Namespace) && (!(contract.Name.Value == declaredContract.Name.Value) || !(contract.Namespace.Value == declaredContract.Namespace.Value)) && contract.UnderlyingType != Globals.TypeOfObjectArray && _emitXsiType != EmitTypeInformation.Never)
80 {
82 {
84 WriteTypeInfo(writer, contract.Name.Value, contract.Namespace.Value);
85 }
86 else if (declaredContract.UnderlyingType == typeof(Enum))
87 {
89 }
90 return true;
91 }
92 return false;
93 }
94
96 {
98 }
99
101 {
102 writer.WriteAttributeString(null, "__type", null, typeInformation);
103 }
104
105 [RequiresUnreferencedCode("Data Contract Serialization and Deserialization might require types that cannot be statically analyzed. Make sure all of the required types are preserved.")]
116
121
122 [RequiresUnreferencedCode("Data Contract Serialization and Deserialization might require types that cannot be statically analyzed. Make sure all of the required types are preserved.")]
149
150 [RequiresUnreferencedCode("Data Contract Serialization and Deserialization might require types that cannot be statically analyzed. Make sure all of the required types are preserved.")]
174
175 [RequiresUnreferencedCode("Data Contract Serialization and Deserialization might require types that cannot be statically analyzed. Make sure all of the required types are preserved.")]
192
193 [RequiresUnreferencedCode("Data Contract Serialization and Deserialization might require types that cannot be statically analyzed. Make sure all of the required types are preserved.")]
195 {
196 bool flag = false;
197 if (dataContract.KnownDataContracts != null)
198 {
199 scopedKnownTypes.Push(dataContract.KnownDataContracts);
200 flag = true;
201 }
203 {
205 }
206 if (flag)
207 {
209 }
210 }
211
213 {
214 xmlWriter.WriteStartElement("a", "item", "item");
215 xmlWriter.WriteAttributeString(null, "item", null, memberNames[index].Value);
216 }
217
218 [RequiresUnreferencedCode("Data Contract Serialization and Deserialization might require types that cannot be statically analyzed. Make sure all of the required types are preserved.")]
220 {
221 Type dataType = dataNode.DataType;
222 if (dataType == Globals.TypeOfClassDataNode || dataType == Globals.TypeOfISerializableDataNode)
223 {
224 xmlWriter.WriteAttributeString(null, "type", null, "object");
225 base.WriteExtensionDataTypeInfo(xmlWriter, dataNode);
226 }
227 else if (dataType == Globals.TypeOfCollectionDataNode)
228 {
229 xmlWriter.WriteAttributeString(null, "type", null, "array");
230 }
231 else if (!(dataType == Globals.TypeOfXmlDataNode) && dataType == Globals.TypeOfObject && dataNode.Value != null)
232 {
233 DataContract dataContract = GetDataContract(dataNode.Value.GetType());
235 {
236 base.WriteExtensionDataTypeInfo(xmlWriter, dataNode);
237 }
238 }
239 }
240
253
254 [RequiresUnreferencedCode("Data Contract Serialization and Deserialization might require types that cannot be statically analyzed. Make sure all of the required types are preserved.")]
266
267 [RequiresUnreferencedCode("Data Contract Serialization and Deserialization might require types that cannot be statically analyzed. Make sure all of the required types are preserved.")]
268 [return: NotNullIfNotNull("oldItemContract")]
270 {
271 if (oldItemContract != null && oldItemContract.UnderlyingType.IsGenericType && oldItemContract.UnderlyingType.GetGenericTypeDefinition() == Globals.TypeOfKeyValue)
272 {
273 return DataContract.GetDataContract(oldItemContract.UnderlyingType);
274 }
275 return oldItemContract;
276 }
277
278 [RequiresUnreferencedCode("Data Contract Serialization and Deserialization might require types that cannot be statically analyzed. Make sure all of the required types are preserved.")]
285
286 [RequiresUnreferencedCode("Data Contract Serialization and Deserialization might require types that cannot be statically analyzed. Make sure all of the required types are preserved.")]
293
294 [RequiresUnreferencedCode("Data Contract Serialization and Deserialization might require types that cannot be statically analyzed. Make sure all of the required types are preserved.")]
301
302 [RequiresUnreferencedCode("Data Contract Serialization and Deserialization might require types that cannot be statically analyzed. Make sure all of the required types are preserved.")]
307
308 [RequiresUnreferencedCode("Data Contract Serialization and Deserialization might require types that cannot be statically analyzed. Make sure all of the required types are preserved.")]
327}
void Add(TKey key, TValue value)
static string GetClrTypeFullName(Type type)
static DataContract GetDataContract(Type type)
static void WriteJsonValue(JsonDataContract contract, XmlWriterDelegator writer, object graph, XmlObjectSerializerWriteContextComplexJson context, RuntimeTypeHandle declaredTypeHandle)
static JsonDataContract GetJsonDataContract(DataContract traditionalDataContract)
static readonly XmlDictionaryString itemDictionaryString
static readonly int DataContractXsdBaseNamespaceLength
override void SerializeWithXsiType(XmlWriterDelegator xmlWriter, object obj, RuntimeTypeHandle objectTypeHandle, Type objectType, int declaredTypeID, RuntimeTypeHandle declaredTypeHandle, Type declaredType)
static void VerifyObjectCompatibilityWithInterface(DataContract contract, object graph, Type declaredType)
override DataContract GetDataContractSkipValidation(int typeId, RuntimeTypeHandle typeHandle, Type type)
static XmlObjectSerializerWriteContextComplexJson CreateContext(DataContractJsonSerializer serializer, DataContract rootTypeDataContract)
override bool WriteTypeInfo(XmlWriterDelegator writer, DataContract contract, DataContract declaredContract)
override void WriteDataContractValue(DataContract dataContract, XmlWriterDelegator xmlWriter, object obj, RuntimeTypeHandle declaredTypeHandle)
void HandleCollectionAssignedToObject(Type declaredType, ref DataContract dataContract, ref object obj, ref bool verifyKnownType)
static DataContract ResolveJsonDataContractFromRootDataContract(XmlObjectSerializerContext context, XmlQualifiedName typeQName, DataContract rootTypeDataContract)
override void WriteTypeInfo(XmlWriterDelegator writer, string dataContractName, string dataContractNamespace)
static void WriteJsonNameWithMapping(XmlWriterDelegator xmlWriter, XmlDictionaryString[] memberNames, int index)
override void SerializeWithXsiTypeAtTopLevel(DataContract dataContract, XmlWriterDelegator xmlWriter, object obj, RuntimeTypeHandle originalDeclaredTypeHandle, Type graphType)
XmlObjectSerializerWriteContextComplexJson(DataContractJsonSerializer serializer, DataContract rootTypeDataContract)
bool IsKnownType(DataContract dataContract, Dictionary< XmlQualifiedName, DataContract > knownDataContracts, Type declaredType)
void WriteSerializationInfo(XmlWriterDelegator xmlWriter, Type objType, SerializationInfo serInfo)
void SerializeAndVerifyType(DataContract dataContract, XmlWriterDelegator xmlWriter, object obj, bool verifyKnownType, RuntimeTypeHandle declaredTypeHandle, Type declaredType)
void GetObjectData(ISerializable obj, SerializationInfo serInfo, StreamingContext context)
static SerializationException CreateSerializationException(string errorMessage)
static string XmlObjectAssignedToIncompatibleInterface
Definition SR.cs:514
static string CollectionAssignedToIncompatibleInterface
Definition SR.cs:516
static string Format(string resourceFormat, object p1)
Definition SR.cs:118
static string EnumTypeNotSupportedByDataContractJsonSerializer
Definition SR.cs:628
static string ChangingFullTypeNameNotSupported
Definition SR.cs:664
static string DcTypeNotFoundOnSerialize
Definition SR.cs:66
Definition SR.cs:7
static ? Type GetType(string typeName, bool throwOnError, bool ignoreCase)
Definition Type.cs:408
void Push(Dictionary< XmlQualifiedName, DataContract > dataContractDictionary)