Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ InternalWriteObjectContent()

override void System.Runtime.Serialization.Json.DataContractJsonSerializer.InternalWriteObjectContent ( XmlWriterDelegator writer,
object graph )
inlinepackagevirtual

Reimplemented from System.Runtime.Serialization.XmlObjectSerializer.

Definition at line 407 of file DataContractJsonSerializer.cs.

408 {
409 if (MaxItemsInObjectGraph == 0)
410 {
411 throw XmlObjectSerializer.CreateSerializationException(System.SR.Format(System.SR.ExceededMaxItemsQuota, MaxItemsInObjectGraph));
412 }
413 DataContract rootContract = RootContract;
414 Type underlyingType = rootContract.UnderlyingType;
415 Type type = ((graph == null) ? underlyingType : graph.GetType());
416 if (graph == null)
417 {
419 return;
420 }
421 if (underlyingType == type)
422 {
423 if (rootContract.CanContainReferences)
424 {
425 XmlObjectSerializerWriteContextComplexJson xmlObjectSerializerWriteContextComplexJson = XmlObjectSerializerWriteContextComplexJson.CreateContext(this, rootContract);
428 }
429 else
430 {
431 WriteJsonValue(JsonDataContract.GetJsonDataContract(rootContract), writer, graph, null, underlyingType.TypeHandle);
432 }
433 return;
434 }
435 XmlObjectSerializerWriteContextComplexJson xmlObjectSerializerWriteContextComplexJson2 = XmlObjectSerializerWriteContextComplexJson.CreateContext(this, RootContract);
437 if (rootContract.CanContainReferences)
438 {
440 xmlObjectSerializerWriteContextComplexJson2.SerializeWithXsiTypeAtTopLevel(rootContract, writer, graph, underlyingType.TypeHandle, type);
441 }
442 else
443 {
445 }
446 }
static void WriteJsonValue(JsonDataContract contract, XmlWriterDelegator writer, object graph, XmlObjectSerializerWriteContextComplexJson context, RuntimeTypeHandle declaredTypeHandle)
static DataContract GetDataContract(DataContract declaredTypeContract, Type declaredType, Type objectType)
static string Format(string resourceFormat, object p1)
Definition SR.cs:118
static string ExceededMaxItemsQuota
Definition SR.cs:102
Definition SR.cs:7

References System.Runtime.Serialization.Json.XmlObjectSerializerWriteContextComplexJson.CreateContext(), System.Runtime.Serialization.XmlObjectSerializer.CreateSerializationException(), System.SR.ExceededMaxItemsQuota, System.SR.Format(), System.Runtime.Serialization.Json.DataContractJsonSerializer.GetDataContract(), System.Runtime.Serialization.Json.JsonDataContract.GetJsonDataContract(), System.Runtime.Serialization.Json.DataContractJsonSerializer.MaxItemsInObjectGraph, System.Runtime.Serialization.Json.DataContractJsonSerializer.RootContract, System.type, System.Runtime.Serialization.Json.DataContractJsonSerializer.WriteJsonNull(), System.Runtime.Serialization.Json.DataContractJsonSerializer.WriteJsonValue(), and System.writer.

Referenced by System.Runtime.Serialization.Json.DataContractJsonSerializer.InternalWriteObject().