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

◆ GenerateGetSerializer()

void System.Xml.Serialization.XmlSerializationILGen.GenerateGetSerializer ( Dictionary< string, string > serializers,
XmlMapping[] xmlMappings,
TypeBuilder serializerContractTypeBuilder )
inlineprivateinherited

Definition at line 374 of file XmlSerializationILGen.cs.

375 {
376 ilg = new CodeGenerator(serializerContractTypeBuilder);
377 ilg.BeginMethod(typeof(XmlSerializer), "GetSerializer", new Type[1] { typeof(Type) }, new string[1] { "type" }, MethodAttributes.Public | MethodAttributes.Virtual | MethodAttributes.HideBySig);
378 for (int i = 0; i < xmlMappings.Length; i++)
379 {
380 if (xmlMappings[i] is XmlTypeMapping)
381 {
382 Type type = xmlMappings[i].Accessor.Mapping.TypeDesc.Type;
383 if (!(type == null) && (type.IsPublic || type.IsNestedPublic) && !type.IsGenericType && !type.ContainsGenericParameters)
384 {
385 ilg.Ldarg("type");
386 ilg.Ldc(type);
387 ilg.If(Cmp.EqualTo);
388 ConstructorInfo constructor = CreatedTypes[serializers[xmlMappings[i].Key]].GetConstructor(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic, Type.EmptyTypes);
392 ilg.EndIf();
393 }
394 }
395 }
396 ilg.Load(null);
401 ilg.EndMethod();
402 }
void New(ConstructorInfo constructorInfo)
void BeginMethod(Type returnType, string methodName, Type[] argTypes, string[] argNames, MethodAttributes methodAttributes)
void Stloc(Type type, string name)
void Ldloc(LocalBuilder localBuilder)

References System.Xml.Serialization.CodeGenerator.BeginMethod(), System.Xml.Serialization.CodeGenerator.Br(), System.Xml.Dictionary, System.Type.EmptyTypes, System.Xml.Serialization.CodeGenerator.EndIf(), System.Xml.Serialization.CodeGenerator.EndMethod(), System.Text.RegularExpressions.i, System.Xml.Serialization.CodeGenerator.If(), System.Xml.Serialization.CodeGenerator.Ldarg(), System.Xml.Serialization.CodeGenerator.Ldc(), System.Xml.Serialization.CodeGenerator.Ldloc(), System.Xml.Serialization.CodeGenerator.Load(), System.Xml.Serialization.CodeGenerator.MarkLabel(), System.Xml.Serialization.CodeGenerator.New(), System.Xml.Serialization.CodeGenerator.ReturnLabel, System.Xml.Serialization.CodeGenerator.ReturnLocal, System.Xml.Serialization.CodeGenerator.Stloc(), and System.type.