private void GenerateGetSerializer(Hashtable serializers, XmlMapping[] xmlMappings)
{
this.writer.Write("public override ");
this.writer.Write(typeof(XmlSerializer).FullName);
this.writer.Write(" GetSerializer(");
this.writer.Write(typeof(Type).FullName);
this.writer.WriteLine(" type) {");
this.writer.Indent++;
for (int i = 0; i < xmlMappings.Length; i++)
{
if (xmlMappings[i] is XmlTypeMapping)
{
Type type = xmlMappings[i].Accessor.Mapping.TypeDesc.Type;
if (((type != null) && (type.IsPublic || type.IsNestedPublic)) && ((!DynamicAssemblies.IsTypeDynamic(type) && !type.IsGenericType) && (!type.ContainsGenericParameters || !DynamicAssemblies.IsTypeDynamic(type.GetGenericArguments()))))
{
this.writer.Write("if (type == typeof(");
this.writer.Write(CodeIdentifier.GetCSharpName(type));
this.writer.Write(")) return new ");
this.writer.Write((string)serializers[xmlMappings[i].Key]);
this.writer.WriteLine("();");
}
}
}
this.writer.WriteLine("return null;");
this.writer.Indent--;
this.writer.WriteLine("}");
}