Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
PrimitiveDataContract.cs
Go to the documentation of this file.
3using System.Xml;
4
6
7internal abstract class PrimitiveDataContract : DataContract
8{
59
61
63
64 internal abstract string WriteMethodName { get; }
65
66 internal abstract string ReadMethodName { get; }
67
69 {
70 get
71 {
73 }
74 set
75 {
76 }
77 }
78
79 internal override bool CanContainReferences => false;
80
81 internal override bool IsPrimitive => true;
82
83 public override bool IsBuiltInDataContract => true;
84
86 {
87 [RequiresUnreferencedCode("Data Contract Serialization and Deserialization might require types that cannot be statically analyzed. Make sure all of the required types are preserved.")]
88 get
89 {
91 {
92 if (base.UnderlyingType.IsValueType)
93 {
95 {
96 base.UnderlyingType,
97 typeof(XmlDictionaryString),
98 typeof(XmlDictionaryString)
99 });
100 }
101 else
102 {
104 {
105 typeof(XmlWriterDelegator),
106 base.UnderlyingType,
107 typeof(XmlDictionaryString),
108 typeof(XmlDictionaryString)
109 });
110 }
111 }
113 }
114 }
115
117 {
118 [RequiresUnreferencedCode("Data Contract Serialization and Deserialization might require types that cannot be statically analyzed. Make sure all of the required types are preserved.")]
119 get
120 {
122 {
123 if (base.UnderlyingType.IsValueType)
124 {
125 _helper.XmlFormatContentWriterMethod = typeof(XmlWriterDelegator).GetMethod(WriteMethodName, BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic, new Type[1] { base.UnderlyingType });
126 }
127 else
128 {
130 {
131 typeof(XmlWriterDelegator),
132 base.UnderlyingType
133 });
134 }
135 }
137 }
138 }
139
141 {
142 get
143 {
144 if (_helper.XmlFormatReaderMethod == null)
145 {
147 }
149 }
150 }
151
157
158 [RequiresUnreferencedCode("Data Contract Serialization and Deserialization might require types that cannot be statically analyzed. Make sure all of the required types are preserved.")]
163
164 [RequiresUnreferencedCode("Data Contract Serialization and Deserialization might require types that cannot be statically analyzed. Make sure all of the required types are preserved.")]
165 internal static PrimitiveDataContract GetPrimitiveDataContract(string name, string ns)
166 {
168 }
169
170 [RequiresUnreferencedCode("Data Contract Serialization and Deserialization might require types that cannot be statically analyzed. Make sure all of the required types are preserved.")]
172 {
173 xmlWriter.WriteAnyType(obj);
174 }
175
176 protected object HandleReadValue(object obj, XmlObjectSerializerReadContext context)
177 {
178 context.AddNewObject(obj);
179 return obj;
180 }
181
183 {
184 Attributes attributes = new Attributes();
185 attributes.Read(reader);
186 if (attributes.Ref != Globals.NewObjectId)
187 {
189 }
190 if (attributes.XsiNil)
191 {
192 reader.Skip();
193 return true;
194 }
195 return false;
196 }
197}
void Read(XmlReaderDelegator reader)
Definition Attributes.cs:49
static DataContract GetBuiltInDataContract(Type type)
static readonly XmlDictionaryString SerializationNamespace
static readonly string NewObjectId
Definition Globals.cs:172
PrimitiveDataContractCriticalHelper([DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors|DynamicallyAccessedMemberTypes.NonPublicConstructors|DynamicallyAccessedMemberTypes.PublicMethods|DynamicallyAccessedMemberTypes.NonPublicMethods|DynamicallyAccessedMemberTypes.PublicFields|DynamicallyAccessedMemberTypes.PublicProperties)] Type type, XmlDictionaryString name, XmlDictionaryString ns)
object HandleReadValue(object obj, XmlObjectSerializerReadContext context)
PrimitiveDataContract([DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors|DynamicallyAccessedMemberTypes.NonPublicConstructors|DynamicallyAccessedMemberTypes.PublicMethods|DynamicallyAccessedMemberTypes.NonPublicMethods|DynamicallyAccessedMemberTypes.PublicFields|DynamicallyAccessedMemberTypes.PublicProperties)] Type type, XmlDictionaryString name, XmlDictionaryString ns)
static PrimitiveDataContract GetPrimitiveDataContract(string name, string ns)
readonly PrimitiveDataContractCriticalHelper _helper
static PrimitiveDataContract GetPrimitiveDataContract(Type type)
override void WriteXmlValue(XmlWriterDelegator xmlWriter, object obj, XmlObjectSerializerWriteContext context)
static readonly PrimitiveDataContract NullContract
static SerializationException CreateSerializationException(string errorMessage)
static string CannotDeserializeRefAtTopLevel
Definition SR.cs:20
static string Format(string resourceFormat, object p1)
Definition SR.cs:118
Definition SR.cs:7