Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
XsdDataContractExporter.cs
Go to the documentation of this file.
5using System.Xml;
7
9
11{
13
15
17
19 {
20 get
21 {
22 return _options;
23 }
24 set
25 {
27 }
28 }
29
37
45
47 {
48 }
49
51 {
52 _schemas = schemas;
53 }
54
56 {
57 if (_schemas == null)
58 {
59 _schemas = new XmlSchemaSet();
61 }
62 return _schemas;
63 }
64
65 private void TraceExportBegin()
66 {
67 }
68
69 private void TraceExportEnd()
70 {
71 }
72
74 {
75 }
76
77 [RequiresUnreferencedCode("Data Contract Serialization and Deserialization might require types that cannot be statically analyzed. Make sure all of the required types are preserved.")]
79 {
80 if (assemblies == null)
81 {
83 }
86 try
87 {
88 foreach (Assembly assembly in assemblies)
89 {
90 if (assembly == null)
91 {
93 }
94 Type[] types = assembly.GetTypes();
95 for (int i = 0; i < types.Length; i++)
96 {
98 }
99 }
100 Export();
101 }
102 catch (Exception exception)
103 {
106 throw;
107 }
109 }
110
111 [RequiresUnreferencedCode("Data Contract Serialization and Deserialization might require types that cannot be statically analyzed. Make sure all of the required types are preserved.")]
113 {
114 if (types == null)
115 {
117 }
120 try
121 {
122 foreach (Type type in types)
123 {
124 if (type == null)
125 {
127 }
128 AddType(type);
129 }
130 Export();
131 }
132 catch (Exception exception)
133 {
136 throw;
137 }
139 }
140
141 [RequiresUnreferencedCode("Data Contract Serialization and Deserialization might require types that cannot be statically analyzed. Make sure all of the required types are preserved.")]
142 public void Export(Type type)
143 {
144 if (type == null)
145 {
147 }
150 try
151 {
152 AddType(type);
153 Export();
154 }
155 catch (Exception exception)
156 {
159 throw;
160 }
162 }
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.")]
180
181 [RequiresUnreferencedCode("Data Contract Serialization and Deserialization might require types that cannot be statically analyzed. Make sure all of the required types are preserved.")]
183 {
184 if (type == null)
185 {
187 }
191 if (dataContract is XmlDataContract { IsAnonymous: not false } xmlDataContract)
192 {
193 return xmlDataContract.XsdType;
194 }
195 return null;
196 }
197
198 [RequiresUnreferencedCode("Data Contract Serialization and Deserialization might require types that cannot be statically analyzed. Make sure all of the required types are preserved.")]
200 {
201 if (type == null)
202 {
204 }
208 if (dataContract.HasRoot)
209 {
210 return new XmlQualifiedName(dataContract.TopLevelElementName.Value, dataContract.TopLevelElementNamespace.Value);
211 }
212 return null;
213 }
214
216 {
217 return type;
218 }
219
220 [RequiresUnreferencedCode("Data Contract Serialization and Deserialization might require types that cannot be statically analyzed. Make sure all of the required types are preserved.")]
222 {
224 if (!type.ContainsGenericParameters && DataContract.IsTypeSerializable(type))
225 {
226 AddType(type);
227 }
228 }
229
230 [RequiresUnreferencedCode("Data Contract Serialization and Deserialization might require types that cannot be statically analyzed. Make sure all of the required types are preserved.")]
231 private void AddType(Type type)
232 {
234 }
235
236 [RequiresUnreferencedCode("Data Contract Serialization and Deserialization might require types that cannot be statically analyzed. Make sure all of the required types are preserved.")]
237 private void Export()
238 {
241 schemaExporter.Export();
242 }
243
244 [RequiresUnreferencedCode("Data Contract Serialization and Deserialization might require types that cannot be statically analyzed. Make sure all of the required types are preserved.")]
245 private void AddKnownTypes()
246 {
247 if (Options == null)
248 {
249 return;
250 }
252 if (knownTypes == null)
253 {
254 return;
255 }
256 for (int i = 0; i < knownTypes.Count; i++)
257 {
258 Type type = knownTypes[i];
259 if (type == null)
260 {
262 }
263 AddType(type);
264 }
265 }
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.")]
269 {
270 if (assemblies == null)
271 {
273 }
275 try
276 {
277 foreach (Assembly assembly in assemblies)
278 {
279 if (assembly == null)
280 {
282 }
283 Type[] types = assembly.GetTypes();
284 for (int i = 0; i < types.Length; i++)
285 {
287 }
288 }
290 return true;
291 }
293 {
295 return false;
296 }
297 catch (Exception exception)
298 {
301 throw;
302 }
303 }
304
305 [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 if (types == null)
309 {
311 }
313 try
314 {
315 foreach (Type type in types)
316 {
317 if (type == null)
318 {
320 }
321 AddType(type);
322 }
324 return true;
325 }
327 {
329 return false;
330 }
331 catch (Exception exception)
332 {
335 throw;
336 }
337 }
338
339 [RequiresUnreferencedCode("Data Contract Serialization and Deserialization might require types that cannot be statically analyzed. Make sure all of the required types are preserved.")]
340 public bool CanExport(Type type)
341 {
342 if (type == null)
343 {
345 }
347 try
348 {
349 AddType(type);
351 return true;
352 }
354 {
356 return false;
357 }
358 catch (Exception exception)
359 {
362 throw;
363 }
364 }
365}
static DataContract GetDataContract(Type type)
static string CannotExportNullAssembly
Definition SR.cs:646
static string CannotExportNullKnownType
Definition SR.cs:648
static string PlatformNotSupported_SchemaImporter
Definition SR.cs:692
static string Format(string resourceFormat, object p1)
Definition SR.cs:118
static string PlatformNotSupported_IDataContractSurrogate
Definition SR.cs:690
static string CannotExportNullType
Definition SR.cs:650
Definition SR.cs:7
static readonly XmlQualifiedName Empty