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

◆ ReflectionWriteMembers()

override int System.Runtime.Serialization.Json.ReflectionJsonClassWriter.ReflectionWriteMembers ( XmlWriterDelegator xmlWriter,
object obj,
XmlObjectSerializerWriteContext context,
ClassDataContract classContract,
ClassDataContract derivedMostClassContract,
int childElementIndex,
XmlDictionaryString[] memberNames )
inlineprotected

Definition at line 9 of file ReflectionJsonClassWriter.cs.

10 {
11 int num = ((classContract.BaseContract != null) ? ReflectionWriteMembers(xmlWriter, obj, context, classContract.BaseContract, derivedMostClassContract, childElementIndex, memberNames) : 0);
12 childElementIndex += num;
13 context.IncrementItemCount(classContract.Members.Count);
14 int num2 = 0;
15 while (num2 < classContract.Members.Count)
16 {
17 DataMember dataMember = classContract.Members[num2];
18 Type memberType = dataMember.MemberType;
19 if (dataMember.IsGetOnlyCollection)
20 {
21 context.StoreIsGetOnlyCollection();
22 }
23 else
24 {
25 context.ResetIsGetOnlyCollection();
26 }
27 bool flag = true;
28 object obj2 = null;
29 if (!dataMember.EmitDefaultValue)
30 {
32 object defaultValue = XmlFormatGeneratorStatics.GetDefaultValue(memberType);
33 if ((obj2 == null && defaultValue == null) || (obj2 != null && obj2.Equals(defaultValue)))
34 {
35 flag = false;
36 if (dataMember.IsRequired)
37 {
38 XmlObjectSerializerWriteContext.ThrowRequiredMemberMustBeEmitted(dataMember.Name, classContract.UnderlyingType);
39 }
40 }
41 }
42 if (flag)
43 {
44 if (obj2 == null)
45 {
47 }
48 bool flag2 = DataContractJsonSerializer.CheckIfXmlNameRequiresMapping(classContract.MemberNames[num2]);
49 PrimitiveDataContract memberPrimitiveContract = dataMember.MemberPrimitiveContract;
51 {
52 if (flag2)
53 {
54 XmlObjectSerializerWriteContextComplexJson.WriteJsonNameWithMapping(xmlWriter, memberNames, num2 + childElementIndex);
55 }
56 else
57 {
59 }
62 }
63 if (classContract.HasExtensionData)
64 {
65 context.WriteExtensionData(xmlWriter, ((IExtensibleDataObject)obj).ExtensionData, num);
66 }
67 }
68 num2++;
69 num++;
70 }
71 return num;
72 }
override int ReflectionWriteMembers(XmlWriterDelegator xmlWriter, object obj, XmlObjectSerializerWriteContext context, ClassDataContract classContract, ClassDataContract derivedMostClassContract, int childElementIndex, XmlDictionaryString[] memberNames)
void ReflectionWriteStartElement(XmlWriterDelegator xmlWriter, XmlDictionaryString name)
void ReflectionWriteValue(XmlWriterDelegator xmlWriter, XmlObjectSerializerWriteContext context, Type type, object value, bool writeXsiType, PrimitiveDataContract primitiveContractForParamType)
bool ReflectionTryWritePrimitive(XmlWriterDelegator xmlWriter, XmlObjectSerializerWriteContext context, Type type, object value, XmlDictionaryString name, XmlDictionaryString ns, PrimitiveDataContract primitiveContract)
object ReflectionGetMemberValue(object obj, DataMember dataMember)

References System.Runtime.Serialization.Json.DataContractJsonSerializer.CheckIfXmlNameRequiresMapping(), System.Runtime.Serialization.Dictionary, System.Runtime.Serialization.XmlFormatGeneratorStatics.GetDefaultValue(), System.Runtime.Serialization.XmlObjectSerializerContext.IncrementItemCount(), System.Type.MemberType, System.obj, System.Runtime.Serialization.ReflectionClassWriter.ReflectionGetMemberValue(), System.Runtime.Serialization.ReflectionClassWriter.ReflectionTryWritePrimitive(), System.Runtime.Serialization.Json.ReflectionJsonClassWriter.ReflectionWriteEndElement(), System.Runtime.Serialization.Json.ReflectionJsonClassWriter.ReflectionWriteMembers(), System.Runtime.Serialization.Json.ReflectionJsonClassWriter.ReflectionWriteStartElement(), System.Runtime.Serialization.ReflectionClassWriter.ReflectionWriteValue(), System.Runtime.Serialization.XmlObjectSerializerWriteContext.ResetIsGetOnlyCollection(), System.Runtime.Serialization.XmlObjectSerializerWriteContext.StoreIsGetOnlyCollection(), System.Runtime.Serialization.XmlObjectSerializerWriteContext.ThrowRequiredMemberMustBeEmitted(), System.Runtime.Serialization.XmlObjectSerializerWriteContext.WriteExtensionData(), and System.Runtime.Serialization.Json.XmlObjectSerializerWriteContextComplexJson.WriteJsonNameWithMapping().

Referenced by System.Runtime.Serialization.Json.ReflectionJsonClassWriter.ReflectionWriteMembers().