Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
DataContractSet.cs
Go to the documentation of this file.
3using System.Xml;
4
6
7internal sealed class DataContractSet
8{
10
12
14
16
18 {
19 get
20 {
21 if (_contracts == null)
22 {
24 }
25 return _contracts;
26 }
27 }
28
40
41 [RequiresUnreferencedCode("Data Contract Serialization and Deserialization might require types that cannot be statically analyzed. Make sure all of the required types are preserved.")]
43 {
44 if (dataContractSet == null)
45 {
47 }
48 _referencedTypes = dataContractSet._referencedTypes;
49 _referencedCollectionTypes = dataContractSet._referencedCollectionTypes;
51 {
52 Add(item.Key, item.Value);
53 }
54 if (dataContractSet._processedContracts == null)
55 {
56 return;
57 }
59 {
61 }
62 }
63
64 [RequiresUnreferencedCode("Data Contract Serialization and Deserialization might require types that cannot be statically analyzed. Make sure all of the required types are preserved.")]
71
72 internal static void EnsureTypeNotGeneric(Type type)
73 {
74 if (type.ContainsGenericParameters)
75 {
77 }
78 }
79
80 [RequiresUnreferencedCode("Data Contract Serialization and Deserialization might require types that cannot be statically analyzed. Make sure all of the required types are preserved.")]
82 {
83 Add(dataContract.StableName, dataContract);
84 }
85
86 [RequiresUnreferencedCode("Data Contract Serialization and Deserialization might require types that cannot be statically analyzed. Make sure all of the required types are preserved.")]
88 {
89 if (!dataContract.IsBuiltInDataContract)
90 {
92 }
93 }
94
95 [RequiresUnreferencedCode("Data Contract Serialization and Deserialization might require types that cannot be statically analyzed. Make sure all of the required types are preserved.")]
97 {
98 DataContract value = null;
99 if (Contracts.TryGetValue(name, out value))
100 {
101 if (!value.Equals(dataContract))
102 {
103 if (dataContract.UnderlyingType == null || value.UnderlyingType == null)
104 {
106 }
107 bool flag = DataContract.GetClrTypeFullName(dataContract.UnderlyingType) == DataContract.GetClrTypeFullName(value.UnderlyingType);
109 }
110 }
111 else
112 {
113 Contracts.Add(name, dataContract);
115 {
117 }
119 {
121 }
123 {
125 }
126 }
127 }
128
129 [RequiresUnreferencedCode("Data Contract Serialization and Deserialization might require types that cannot be statically analyzed. Make sure all of the required types are preserved.")]
131 {
132 if (classDataContract.BaseContract != null)
133 {
134 Add(classDataContract.BaseContract.StableName, classDataContract.BaseContract);
135 }
136 if (!classDataContract.IsISerializable && classDataContract.Members != null)
137 {
138 for (int i = 0; i < classDataContract.Members.Count; i++)
139 {
143 }
144 }
145 AddKnownDataContracts(classDataContract.KnownDataContracts);
146 }
147
148 [RequiresUnreferencedCode("Data Contract Serialization and Deserialization might require types that cannot be statically analyzed. Make sure all of the required types are preserved.")]
166
167 [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 [RequiresUnreferencedCode("Data Contract Serialization and Deserialization might require types that cannot be statically analyzed. Make sure all of the required types are preserved.")]
175 {
176 if (knownDataContracts == null)
177 {
178 return;
179 }
180 foreach (DataContract value in knownDataContracts.Values)
181 {
182 Add(value);
183 }
184 }
185
186 [RequiresUnreferencedCode("Data Contract Serialization and Deserialization might require types that cannot be statically analyzed. Make sure all of the required types are preserved.")]
196
197 [RequiresUnreferencedCode("Data Contract Serialization and Deserialization might require types that cannot be statically analyzed. Make sure all of the required types are preserved.")]
199 {
200 Type memberType = dataMember.MemberType;
201 if (dataMember.IsGetOnlyCollection)
202 {
204 }
206 }
207
208 [RequiresUnreferencedCode("Data Contract Serialization and Deserialization might require types that cannot be statically analyzed. Make sure all of the required types are preserved.")]
210 {
211 if (collectionContract.ItemType != null)
212 {
213 return GetDataContract(collectionContract.ItemType);
214 }
215 return collectionContract.ItemContract;
216 }
217
222
227
232}
void Add(TKey key, TValue value)
void Add(XmlQualifiedName name, DataContract dataContract)
void SetContractProcessed(DataContract dataContract)
readonly ICollection< Type > _referencedCollectionTypes
readonly ICollection< Type > _referencedTypes
IEnumerator< KeyValuePair< XmlQualifiedName, DataContract > > GetEnumerator()
Dictionary< XmlQualifiedName, DataContract > _contracts
DataContractSet(DataContractSet dataContractSet)
void AddXmlDataContract(XmlDataContract xmlDataContract)
DataContract GetMemberTypeDataContract(DataMember dataMember)
void AddKnownDataContracts(Dictionary< XmlQualifiedName, DataContract > knownDataContracts)
void AddCollectionDataContract(CollectionDataContract collectionDataContract)
void Add(DataContract dataContract)
void InternalAdd(XmlQualifiedName name, DataContract dataContract)
DataContract GetItemTypeDataContract(CollectionDataContract collectionContract)
Dictionary< DataContract, object > ProcessedContracts
Dictionary< DataContract, object > _processedContracts
bool IsContractProcessed(DataContract dataContract)
void AddClassDataContract(ClassDataContract classDataContract)
static DataContract GetBuiltInDataContract(Type type)
static int GetId(RuntimeTypeHandle typeHandle)
static string GetClrTypeFullName(Type type)
static DataContract GetDataContract(Type type)
static DataContract GetGetOnlyCollectionDataContract(int id, RuntimeTypeHandle typeHandle, Type type, SerializationMode mode)
static string GenericTypeNotExportable
Definition SR.cs:644
static string DupTypeContractInDataContractSet
Definition SR.cs:642
static string Format(string resourceFormat, object p1)
Definition SR.cs:118
static string DupContractInDataContractSet
Definition SR.cs:640
Definition SR.cs:7