/// <summary>
        /// Create the template output
        /// </summary>
        public virtual string TransformText()
        {
            this.Write(@"
using System;
using System.Collections.Generic;
using System.Reflection;
using SiliconStudio.Core.Serialization;
using SiliconStudio.Core.Reflection;
using SiliconStudio.Core.Serialization.Serializers;
using SiliconStudio.DataSerializers;

[assembly: AssemblyVersion(""");
            
            #line 17 "C:\DEV\paradox\sources\common\core\SiliconStudio.AssemblyProcessor.Common\ComplexSerializerCodeGenerator.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(assembly.Name.Version.ToString()));
            
            #line default
            #line hidden
            this.Write("\")]\r\n");
            
            #line 18 "C:\DEV\paradox\sources\common\core\SiliconStudio.AssemblyProcessor.Common\ComplexSerializerCodeGenerator.tt"
 if (targetFramework != null) { 
            
            #line default
            #line hidden
            this.Write("[assembly: System.Runtime.Versioning.TargetFramework(");
            
            #line 19 "C:\DEV\paradox\sources\common\core\SiliconStudio.AssemblyProcessor.Common\ComplexSerializerCodeGenerator.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(targetFramework));
            
            #line default
            #line hidden
            this.Write(")]\r\n");
            
            #line 20 "C:\DEV\paradox\sources\common\core\SiliconStudio.AssemblyProcessor.Common\ComplexSerializerCodeGenerator.tt"
 } 
            
            #line default
            #line hidden
            this.Write("\r\n[assembly: SiliconStudio.Core.Serialization.Serializers.AssemblySerializerFacto" +
                    "ry(Type = typeof(SiliconStudio.DataSerializers.");
            
            #line 22 "C:\DEV\paradox\sources\common\core\SiliconStudio.AssemblyProcessor.Common\ComplexSerializerCodeGenerator.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(assemblySerializerFactoryClassName));
            
            #line default
            #line hidden
            this.Write(@"))]

namespace SiliconStudio.Core.Serialization.Serializers
{
	class AssemblySerializerFactoryAttribute : Attribute
	{
		public Type Type;
	}
}

namespace SiliconStudio.DataSerializers
{
    // Assembly attributes that defines supported serializer (only generics one so that other assemblies can do generic instantiations by themselves)
");
            
            #line 35 "C:\DEV\paradox\sources\common\core\SiliconStudio.AssemblyProcessor.Common\ComplexSerializerCodeGenerator.tt"
 foreach (var profile in cecilSerializerContext.SerializableTypesProfiles) {
       foreach (var type in profile.Value.SerializableTypes.Where(x => x.Value.Local && x.Value.SerializerType != null)) { 
            
            #line default
            #line hidden
            this.Write("    [DataSerializerGlobalAttribute(typeof(");
            
            #line 37 "C:\DEV\paradox\sources\common\core\SiliconStudio.AssemblyProcessor.Common\ComplexSerializerCodeGenerator.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(type.Value.SerializerType.ConvertCSharp(false)));
            
            #line default
            #line hidden
            this.Write("), typeof(");
            
            #line 37 "C:\DEV\paradox\sources\common\core\SiliconStudio.AssemblyProcessor.Common\ComplexSerializerCodeGenerator.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(type.Key.ConvertCSharp(false)));
            
            #line default
            #line hidden
            this.Write("), DataSerializerGenericMode.");
            
            #line 37 "C:\DEV\paradox\sources\common\core\SiliconStudio.AssemblyProcessor.Common\ComplexSerializerCodeGenerator.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(type.Value.Mode.ToString()));
            
            #line default
            #line hidden
            this.Write(", ");
            
            #line 37 "C:\DEV\paradox\sources\common\core\SiliconStudio.AssemblyProcessor.Common\ComplexSerializerCodeGenerator.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(type.Value.Inherited ? "true" : "false"));
            
            #line default
            #line hidden
            this.Write(", ");
            
            #line 37 "C:\DEV\paradox\sources\common\core\SiliconStudio.AssemblyProcessor.Common\ComplexSerializerCodeGenerator.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(type.Value.ComplexSerializer ? "true" : "false"));
            
            #line default
            #line hidden
            this.Write(", Profile = \"");
            
            #line 37 "C:\DEV\paradox\sources\common\core\SiliconStudio.AssemblyProcessor.Common\ComplexSerializerCodeGenerator.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(profile.Key));
            
            #line default
            #line hidden
            this.Write("\")]\r\n");
            
            #line 38 "C:\DEV\paradox\sources\common\core\SiliconStudio.AssemblyProcessor.Common\ComplexSerializerCodeGenerator.tt"
     }
       foreach (var type in profile.Value.GenericSerializableTypes.Where(x => x.Value.Local && x.Value.SerializerType != null)) {
            
            #line default
            #line hidden
            this.Write("    [DataSerializerGlobalAttribute(typeof(");
            
            #line 40 "C:\DEV\paradox\sources\common\core\SiliconStudio.AssemblyProcessor.Common\ComplexSerializerCodeGenerator.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(type.Value.SerializerType.ConvertCSharp(true)));
            
            #line default
            #line hidden
            this.Write("), typeof(");
            
            #line 40 "C:\DEV\paradox\sources\common\core\SiliconStudio.AssemblyProcessor.Common\ComplexSerializerCodeGenerator.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(type.Key.ConvertCSharp(true)));
            
            #line default
            #line hidden
            this.Write("), DataSerializerGenericMode.");
            
            #line 40 "C:\DEV\paradox\sources\common\core\SiliconStudio.AssemblyProcessor.Common\ComplexSerializerCodeGenerator.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(type.Value.Mode.ToString()));
            
            #line default
            #line hidden
            this.Write(", ");
            
            #line 40 "C:\DEV\paradox\sources\common\core\SiliconStudio.AssemblyProcessor.Common\ComplexSerializerCodeGenerator.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(type.Value.Inherited ? "true" : "false"));
            
            #line default
            #line hidden
            this.Write(", ");
            
            #line 40 "C:\DEV\paradox\sources\common\core\SiliconStudio.AssemblyProcessor.Common\ComplexSerializerCodeGenerator.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(type.Value.ComplexSerializer ? "true" : "false"));
            
            #line default
            #line hidden
            this.Write(", Profile = \"");
            
            #line 40 "C:\DEV\paradox\sources\common\core\SiliconStudio.AssemblyProcessor.Common\ComplexSerializerCodeGenerator.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(profile.Key));
            
            #line default
            #line hidden
            this.Write("\")]\r\n");
            
            #line 41 "C:\DEV\paradox\sources\common\core\SiliconStudio.AssemblyProcessor.Common\ComplexSerializerCodeGenerator.tt"
     }
   } 
            
            #line default
            #line hidden
            this.Write("   \tpublic static class ");
            
            #line 43 "C:\DEV\paradox\sources\common\core\SiliconStudio.AssemblyProcessor.Common\ComplexSerializerCodeGenerator.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(assemblySerializerFactoryClassName));
            
            #line default
            #line hidden
            this.Write("\r\n\t{\r\n\t    [SiliconStudio.Core.ModuleInitializer]\r\n        internal static void I" +
                    "nitialize()\r\n        {\r\n");
            
            #line 48 "C:\DEV\paradox\sources\common\core\SiliconStudio.AssemblyProcessor.Common\ComplexSerializerCodeGenerator.tt"
 foreach (var profile in cecilSerializerContext.SerializableTypesProfiles) { 
            
            #line default
            #line hidden
            this.Write("\t\t\tDataSerializerFactory.RegisterSerializationProfile(\"");
            
            #line 49 "C:\DEV\paradox\sources\common\core\SiliconStudio.AssemblyProcessor.Common\ComplexSerializerCodeGenerator.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(profile.Key));
            
            #line default
            #line hidden
            this.Write("\", Register");
            
            #line 49 "C:\DEV\paradox\sources\common\core\SiliconStudio.AssemblyProcessor.Common\ComplexSerializerCodeGenerator.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(profile.Key));
            
            #line default
            #line hidden
            this.Write(");\r\n");
            
            #line 50 "C:\DEV\paradox\sources\common\core\SiliconStudio.AssemblyProcessor.Common\ComplexSerializerCodeGenerator.tt"
 } 
            
            #line default
            #line hidden
            this.Write("        }\r\n\r\n");
            
            #line 53 "C:\DEV\paradox\sources\common\core\SiliconStudio.AssemblyProcessor.Common\ComplexSerializerCodeGenerator.tt"
 foreach (var profile in cecilSerializerContext.SerializableTypesProfiles) { 
            
            #line default
            #line hidden
            this.Write("\t\tpublic static void Register");
            
            #line 54 "C:\DEV\paradox\sources\common\core\SiliconStudio.AssemblyProcessor.Common\ComplexSerializerCodeGenerator.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(profile.Key));
            
            #line default
            #line hidden
            this.Write("(DataSerializerFactory serializerFactory)\r\n\t\t{\r\n\t\t\t// Force module .ctor of refer" +
                    "enced assemblies to be initialized as well\r\n");
            
            #line 57 "C:\DEV\paradox\sources\common\core\SiliconStudio.AssemblyProcessor.Common\ComplexSerializerCodeGenerator.tt"
 foreach (var referencedAssemblySerializerFactoryType in referencedAssemblySerializerFactoryTypes) { 
            
            #line default
            #line hidden
            this.Write("\t\t\tModuleRuntimeHelpers.RunModuleConstructor(typeof(");
            
            #line 58 "C:\DEV\paradox\sources\common\core\SiliconStudio.AssemblyProcessor.Common\ComplexSerializerCodeGenerator.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(referencedAssemblySerializerFactoryType.ConvertCSharp()));
            
            #line default
            #line hidden
            this.Write(").GetTypeInfo().Module);\r\n");
            
            #line 59 "C:\DEV\paradox\sources\common\core\SiliconStudio.AssemblyProcessor.Common\ComplexSerializerCodeGenerator.tt"
 } 
            
            #line default
            #line hidden
            this.Write("\r\n\t\t\t// Register types used by this assembly\r\n");
            
            #line 62 "C:\DEV\paradox\sources\common\core\SiliconStudio.AssemblyProcessor.Common\ComplexSerializerCodeGenerator.tt"
 foreach (var type in profile.Value.SerializableTypes.Where(x => x.Value.Local)) { 
            
            #line default
            #line hidden
            this.Write("\t\t\tif (!serializerFactory.CanSerialize(typeof(");
            
            #line 63 "C:\DEV\paradox\sources\common\core\SiliconStudio.AssemblyProcessor.Common\ComplexSerializerCodeGenerator.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(type.Key.ConvertCSharp()));
            
            #line default
            #line hidden
            this.Write(")))\r\n\t\t\t{\r\n");
            
            #line 65 "C:\DEV\paradox\sources\common\core\SiliconStudio.AssemblyProcessor.Common\ComplexSerializerCodeGenerator.tt"
   if (type.Value.SerializerType != null) { 
            
            #line default
            #line hidden
            this.Write("\t\t\t\tserializerFactory.RegisterSerializer(");
            
            #line 66 "C:\DEV\paradox\sources\common\core\SiliconStudio.AssemblyProcessor.Common\ComplexSerializerCodeGenerator.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(type.Key.ConvertTypeId()));
            
            #line default
            #line hidden
            this.Write(", new ");
            
            #line 66 "C:\DEV\paradox\sources\common\core\SiliconStudio.AssemblyProcessor.Common\ComplexSerializerCodeGenerator.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(type.Value.SerializerType.ConvertCSharp()));
            
            #line default
            #line hidden
            this.Write("());\r\n");
            
            #line 67 "C:\DEV\paradox\sources\common\core\SiliconStudio.AssemblyProcessor.Common\ComplexSerializerCodeGenerator.tt"
   } else { 
            
            #line default
            #line hidden
            this.Write("\t\t\t\tserializerFactory.RegisterNullSerializer(");
            
            #line 68 "C:\DEV\paradox\sources\common\core\SiliconStudio.AssemblyProcessor.Common\ComplexSerializerCodeGenerator.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(type.Key.ConvertTypeId()));
            
            #line default
            #line hidden
            this.Write(", typeof(");
            
            #line 68 "C:\DEV\paradox\sources\common\core\SiliconStudio.AssemblyProcessor.Common\ComplexSerializerCodeGenerator.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(type.Key.ConvertCSharp()));
            
            #line default
            #line hidden
            this.Write("));\r\n");
            
            #line 69 "C:\DEV\paradox\sources\common\core\SiliconStudio.AssemblyProcessor.Common\ComplexSerializerCodeGenerator.tt"
   } 
            
            #line default
            #line hidden
            this.Write("\t\t\t}\r\n");
            
            #line 71 "C:\DEV\paradox\sources\common\core\SiliconStudio.AssemblyProcessor.Common\ComplexSerializerCodeGenerator.tt"
 } 
            
            #line default
            #line hidden
            this.Write("\t\t}\r\n\r\n");
            
            #line 74 "C:\DEV\paradox\sources\common\core\SiliconStudio.AssemblyProcessor.Common\ComplexSerializerCodeGenerator.tt"
 } // foreach (profile) 
            
            #line default
            #line hidden
            this.Write("\t}\r\n}\r\n\r\n");
            
            #line 78 "C:\DEV\paradox\sources\common\core\SiliconStudio.AssemblyProcessor.Common\ComplexSerializerCodeGenerator.tt"

// Generate complex serializers
foreach (var complexType in cecilSerializerContext.ComplexTypes)
{
	var complexClassSerializerGenerator = new ComplexClassSerializerGenerator(complexType.Key, complexType.Value.ComplexSerializerProcessParentType);
	Write(complexClassSerializerGenerator.TransformText());
} 
            
            #line default
            #line hidden
            return this.GenerationEnvironment.ToString();
        }
        /// <summary>
        /// Create the template output
        /// </summary>
        public virtual string TransformText()
        {
            this.Write(@"
using System;
using System.Collections.Generic;
using System.Reflection;
using SiliconStudio.Core.Serialization;
using SiliconStudio.Core.Reflection;
using SiliconStudio.Core.Serialization.Serializers;
using SiliconStudio.DataSerializers;

[assembly: AssemblyVersion(""");
            
            #line 17 "D:\Dev\Xenko\Xenko2\sources\common\core\SiliconStudio.AssemblyProcessor\ComplexSerializerCodeGenerator.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(assembly.Name.Version.ToString()));
            
            #line default
            #line hidden
            this.Write("\")]\r\n");
            
            #line 18 "D:\Dev\Xenko\Xenko2\sources\common\core\SiliconStudio.AssemblyProcessor\ComplexSerializerCodeGenerator.tt"
 if (targetFramework != null) { 
            
            #line default
            #line hidden
            this.Write("[assembly: System.Runtime.Versioning.TargetFramework(");
            
            #line 19 "D:\Dev\Xenko\Xenko2\sources\common\core\SiliconStudio.AssemblyProcessor\ComplexSerializerCodeGenerator.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(targetFramework));
            
            #line default
            #line hidden
            this.Write(")]\r\n");
            
            #line 20 "D:\Dev\Xenko\Xenko2\sources\common\core\SiliconStudio.AssemblyProcessor\ComplexSerializerCodeGenerator.tt"
 } 
            
            #line default
            #line hidden
            this.Write("\r\n[assembly: SiliconStudio.Core.Serialization.Serializers.AssemblySerializerFacto" +
                    "ry(Type = typeof(SiliconStudio.DataSerializers.");
            
            #line 22 "D:\Dev\Xenko\Xenko2\sources\common\core\SiliconStudio.AssemblyProcessor\ComplexSerializerCodeGenerator.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(assemblySerializerFactoryClassName));
            
            #line default
            #line hidden
            this.Write(@"))]

namespace SiliconStudio.Core.Serialization.Serializers
{
	class AssemblySerializerFactoryAttribute : Attribute
	{
		public Type Type;
	}
}

namespace SiliconStudio.DataSerializers
{
    // Assembly attributes that defines supported serializer (only generics one so that other assemblies can do generic instantiations by themselves)
");
            
            #line 35 "D:\Dev\Xenko\Xenko2\sources\common\core\SiliconStudio.AssemblyProcessor\ComplexSerializerCodeGenerator.tt"
 foreach (var profile in cecilSerializerContext.SerializableTypesProfiles) {
       foreach (var type in profile.Value.SerializableTypes.Where(x => x.Value.Local)) { 
            
            #line default
            #line hidden
            this.Write("    [DataSerializerGlobalAttribute(");
            
            #line 37 "D:\Dev\Xenko\Xenko2\sources\common\core\SiliconStudio.AssemblyProcessor\ComplexSerializerCodeGenerator.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(type.Value.SerializerType != null ? $"typeof({type.Value.SerializerType.ConvertCSharp(false)})" : "null"));
            
            #line default
            #line hidden
            this.Write(", typeof(");
            
            #line 37 "D:\Dev\Xenko\Xenko2\sources\common\core\SiliconStudio.AssemblyProcessor\ComplexSerializerCodeGenerator.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(type.Key.ConvertCSharp(false)));
            
            #line default
            #line hidden
            this.Write("), DataSerializerGenericMode.");
            
            #line 37 "D:\Dev\Xenko\Xenko2\sources\common\core\SiliconStudio.AssemblyProcessor\ComplexSerializerCodeGenerator.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(type.Value.Mode.ToString()));
            
            #line default
            #line hidden
            this.Write(", ");
            
            #line 37 "D:\Dev\Xenko\Xenko2\sources\common\core\SiliconStudio.AssemblyProcessor\ComplexSerializerCodeGenerator.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(type.Value.Inherited ? "true" : "false"));
            
            #line default
            #line hidden
            this.Write(", ");
            
            #line 37 "D:\Dev\Xenko\Xenko2\sources\common\core\SiliconStudio.AssemblyProcessor\ComplexSerializerCodeGenerator.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(type.Value.ComplexSerializer ? "true" : "false"));
            
            #line default
            #line hidden
            this.Write(", Profile = \"");
            
            #line 37 "D:\Dev\Xenko\Xenko2\sources\common\core\SiliconStudio.AssemblyProcessor\ComplexSerializerCodeGenerator.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(profile.Key));
            
            #line default
            #line hidden
            this.Write("\")]\r\n");
            
            #line 38 "D:\Dev\Xenko\Xenko2\sources\common\core\SiliconStudio.AssemblyProcessor\ComplexSerializerCodeGenerator.tt"
     }
       foreach (var type in profile.Value.GenericSerializableTypes.Where(x => x.Value.Local)) {
            
            #line default
            #line hidden
            this.Write("    [DataSerializerGlobalAttribute(");
            
            #line 40 "D:\Dev\Xenko\Xenko2\sources\common\core\SiliconStudio.AssemblyProcessor\ComplexSerializerCodeGenerator.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(type.Value.SerializerType != null ? $"typeof({type.Value.SerializerType.ConvertCSharp(true)})" : "null"));
            
            #line default
            #line hidden
            this.Write(", typeof(");
            
            #line 40 "D:\Dev\Xenko\Xenko2\sources\common\core\SiliconStudio.AssemblyProcessor\ComplexSerializerCodeGenerator.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(type.Key.ConvertCSharp(true)));
            
            #line default
            #line hidden
            this.Write("), DataSerializerGenericMode.");
            
            #line 40 "D:\Dev\Xenko\Xenko2\sources\common\core\SiliconStudio.AssemblyProcessor\ComplexSerializerCodeGenerator.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(type.Value.Mode.ToString()));
            
            #line default
            #line hidden
            this.Write(", ");
            
            #line 40 "D:\Dev\Xenko\Xenko2\sources\common\core\SiliconStudio.AssemblyProcessor\ComplexSerializerCodeGenerator.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(type.Value.Inherited ? "true" : "false"));
            
            #line default
            #line hidden
            this.Write(", ");
            
            #line 40 "D:\Dev\Xenko\Xenko2\sources\common\core\SiliconStudio.AssemblyProcessor\ComplexSerializerCodeGenerator.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(type.Value.ComplexSerializer ? "true" : "false"));
            
            #line default
            #line hidden
            this.Write(", Profile = \"");
            
            #line 40 "D:\Dev\Xenko\Xenko2\sources\common\core\SiliconStudio.AssemblyProcessor\ComplexSerializerCodeGenerator.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(profile.Key));
            
            #line default
            #line hidden
            this.Write("\")]\r\n");
            
            #line 41 "D:\Dev\Xenko\Xenko2\sources\common\core\SiliconStudio.AssemblyProcessor\ComplexSerializerCodeGenerator.tt"
     }
   } 
            
            #line default
            #line hidden
            this.Write("   \tpublic static class ");
            
            #line 43 "D:\Dev\Xenko\Xenko2\sources\common\core\SiliconStudio.AssemblyProcessor\ComplexSerializerCodeGenerator.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(assemblySerializerFactoryClassName));
            
            #line default
            #line hidden
            this.Write("\r\n\t{\r\n\t    [SiliconStudio.Core.ModuleInitializer]\r\n        internal static void I" +
                    "nitialize()\r\n        {\r\n\t\t\tvar assemblySerializers = new AssemblySerializers(typ" +
                    "eof(");
            
            #line 48 "D:\Dev\Xenko\Xenko2\sources\common\core\SiliconStudio.AssemblyProcessor\ComplexSerializerCodeGenerator.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(assemblySerializerFactoryClassName));
            
            #line default
            #line hidden
            this.Write(").GetTypeInfo().Assembly);\r\n\r\n\t\t\t// Register data contract aliases\r\n");
            
            #line 51 "D:\Dev\Xenko\Xenko2\sources\common\core\SiliconStudio.AssemblyProcessor\ComplexSerializerCodeGenerator.tt"
 foreach (var alias in cecilSerializerContext.DataContractAliases) { 
            
            #line default
            #line hidden
            this.Write("\t\t\tassemblySerializers.DataContractAliases.Add(new KeyValuePair<string, Type>(@\"");
            
            #line 52 "D:\Dev\Xenko\Xenko2\sources\common\core\SiliconStudio.AssemblyProcessor\ComplexSerializerCodeGenerator.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(alias.Key));
            
            #line default
            #line hidden
            this.Write("\", typeof(");
            
            #line 52 "D:\Dev\Xenko\Xenko2\sources\common\core\SiliconStudio.AssemblyProcessor\ComplexSerializerCodeGenerator.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(alias.Value.ConvertCSharp(true)));
            
            #line default
            #line hidden
            this.Write(")));\r\n");
            
            #line 53 "D:\Dev\Xenko\Xenko2\sources\common\core\SiliconStudio.AssemblyProcessor\ComplexSerializerCodeGenerator.tt"
 } 
            
            #line default
            #line hidden
            this.Write("\r\n");
            
            #line 55 "D:\Dev\Xenko\Xenko2\sources\common\core\SiliconStudio.AssemblyProcessor\ComplexSerializerCodeGenerator.tt"
 foreach (var referencedAssemblySerializerFactoryType in referencedAssemblySerializerFactoryTypes) { 
            
            #line default
            #line hidden
            this.Write("\t\t\tassemblySerializers.Modules.Add(typeof(");
            
            #line 56 "D:\Dev\Xenko\Xenko2\sources\common\core\SiliconStudio.AssemblyProcessor\ComplexSerializerCodeGenerator.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(referencedAssemblySerializerFactoryType.ConvertCSharp()));
            
            #line default
            #line hidden
            this.Write(").GetTypeInfo().Module);\r\n");
            
            #line 57 "D:\Dev\Xenko\Xenko2\sources\common\core\SiliconStudio.AssemblyProcessor\ComplexSerializerCodeGenerator.tt"
 } 
            
            #line default
            #line hidden
            this.Write("\r\n");
            
            #line 59 "D:\Dev\Xenko\Xenko2\sources\common\core\SiliconStudio.AssemblyProcessor\ComplexSerializerCodeGenerator.tt"
 foreach (var profile in cecilSerializerContext.SerializableTypesProfiles) { 
            
            #line default
            #line hidden
            this.Write("\t\t\t{\r\n\t\t\t\tvar assemblySerializersProfile = new AssemblySerializersPerProfile();\r\n" +
                    "\t\t\t\tassemblySerializers.Profiles[\"");
            
            #line 62 "D:\Dev\Xenko\Xenko2\sources\common\core\SiliconStudio.AssemblyProcessor\ComplexSerializerCodeGenerator.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(profile.Key));
            
            #line default
            #line hidden
            this.Write("\"] = assemblySerializersProfile;\r\n\r\n");
            
            #line 64 "D:\Dev\Xenko\Xenko2\sources\common\core\SiliconStudio.AssemblyProcessor\ComplexSerializerCodeGenerator.tt"
   foreach (var type in profile.Value.SerializableTypes.Where(x => x.Value.Local)) { 
            
            #line default
            #line hidden
            this.Write("\t\t\t\tassemblySerializersProfile.Add(new AssemblySerializerEntry(");
            
            #line 65 "D:\Dev\Xenko\Xenko2\sources\common\core\SiliconStudio.AssemblyProcessor\ComplexSerializerCodeGenerator.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(type.Key.ConvertTypeId()));
            
            #line default
            #line hidden
            this.Write(", typeof(");
            
            #line 65 "D:\Dev\Xenko\Xenko2\sources\common\core\SiliconStudio.AssemblyProcessor\ComplexSerializerCodeGenerator.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(type.Key.ConvertCSharp()));
            
            #line default
            #line hidden
            this.Write("), ");
            
            #line 65 "D:\Dev\Xenko\Xenko2\sources\common\core\SiliconStudio.AssemblyProcessor\ComplexSerializerCodeGenerator.tt"
 if (type.Value.SerializerType != null) { 
            
            #line default
            #line hidden
            this.Write("typeof(");
            
            #line 65 "D:\Dev\Xenko\Xenko2\sources\common\core\SiliconStudio.AssemblyProcessor\ComplexSerializerCodeGenerator.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(type.Value.SerializerType.ConvertCSharp()));
            
            #line default
            #line hidden
            this.Write(")");
            
            #line 65 "D:\Dev\Xenko\Xenko2\sources\common\core\SiliconStudio.AssemblyProcessor\ComplexSerializerCodeGenerator.tt"
 } else { 
            
            #line default
            #line hidden
            this.Write("null");
            
            #line 65 "D:\Dev\Xenko\Xenko2\sources\common\core\SiliconStudio.AssemblyProcessor\ComplexSerializerCodeGenerator.tt"
 } 
            
            #line default
            #line hidden
            this.Write("));\r\n");
            
            #line 66 "D:\Dev\Xenko\Xenko2\sources\common\core\SiliconStudio.AssemblyProcessor\ComplexSerializerCodeGenerator.tt"
       if (type.Value.SerializerType?.Resolve()?.Methods.Any(x => x.IsConstructor && x.IsStatic) == true) {
			// Some data serializer have static constructor, force them to run
			// TODO: It is currently used for update engine registration, but we could also make a specific method to not mix it with static ctor. 
            
            #line default
            #line hidden
            this.Write("\t\t\t\tSystem.Runtime.CompilerServices.RuntimeHelpers.RunClassConstructor(typeof(");
            
            #line 69 "D:\Dev\Xenko\Xenko2\sources\common\core\SiliconStudio.AssemblyProcessor\ComplexSerializerCodeGenerator.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(type.Value.SerializerType.ConvertCSharp()));
            
            #line default
            #line hidden
            this.Write(").TypeHandle);\r\n");
            
            #line 70 "D:\Dev\Xenko\Xenko2\sources\common\core\SiliconStudio.AssemblyProcessor\ComplexSerializerCodeGenerator.tt"
       } 
            
            #line default
            #line hidden
            
            #line 71 "D:\Dev\Xenko\Xenko2\sources\common\core\SiliconStudio.AssemblyProcessor\ComplexSerializerCodeGenerator.tt"
   } 
            
            #line default
            #line hidden
            this.Write("\t\t\t}\r\n");
            
            #line 73 "D:\Dev\Xenko\Xenko2\sources\common\core\SiliconStudio.AssemblyProcessor\ComplexSerializerCodeGenerator.tt"
 } 
            
            #line default
            #line hidden
            this.Write("\r\n\t\t\tDataSerializerFactory.RegisterSerializationAssembly(assemblySerializers);\r\n " +
                    "           AssemblyRegistry.Register(typeof(");
            
            #line 76 "D:\Dev\Xenko\Xenko2\sources\common\core\SiliconStudio.AssemblyProcessor\ComplexSerializerCodeGenerator.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(assemblySerializerFactoryClassName));
            
            #line default
            #line hidden
            this.Write(").GetTypeInfo().Assembly, AssemblyCommonCategories.Engine);\r\n        }\r\n\t}\r\n}\r\n\r\n" +
                    "");
            
            #line 81 "D:\Dev\Xenko\Xenko2\sources\common\core\SiliconStudio.AssemblyProcessor\ComplexSerializerCodeGenerator.tt"

// Generate complex serializers
foreach (var complexType in cecilSerializerContext.ComplexTypes)
{
	var complexClassSerializerGenerator = new ComplexClassSerializerGenerator(complexType.Key, complexType.Value.ComplexSerializerProcessParentType);
	Write(complexClassSerializerGenerator.TransformText());
} 
            
            #line default
            #line hidden
            return this.GenerationEnvironment.ToString();
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Create the template output
        /// </summary>
        public virtual string TransformText()
        {
            this.Write(@"
using System;
using System.Collections.Generic;
using System.Reflection;
using SiliconStudio.Core.Serialization;
using SiliconStudio.Core.Reflection;
using SiliconStudio.Core.Serialization.Serializers;
using SiliconStudio.DataSerializers;

[assembly: AssemblyVersion(""");

            #line 17 "C:\DEV\xenko\sources\common\core\SiliconStudio.AssemblyProcessor.Common\ComplexSerializerCodeGenerator.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(assembly.Name.Version.ToString()));

            #line default
            #line hidden
            this.Write("\")]\r\n");

            #line 18 "C:\DEV\xenko\sources\common\core\SiliconStudio.AssemblyProcessor.Common\ComplexSerializerCodeGenerator.tt"
            if (targetFramework != null)
            {
            #line default
            #line hidden
                this.Write("[assembly: System.Runtime.Versioning.TargetFramework(");

            #line 19 "C:\DEV\xenko\sources\common\core\SiliconStudio.AssemblyProcessor.Common\ComplexSerializerCodeGenerator.tt"
                this.Write(this.ToStringHelper.ToStringWithCulture(targetFramework));

            #line default
            #line hidden
                this.Write(")]\r\n");

            #line 20 "C:\DEV\xenko\sources\common\core\SiliconStudio.AssemblyProcessor.Common\ComplexSerializerCodeGenerator.tt"
            }

            #line default
            #line hidden
            this.Write("\r\n[assembly: SiliconStudio.Core.Serialization.Serializers.AssemblySerializerFacto" +
                       "ry(Type = typeof(SiliconStudio.DataSerializers.");

            #line 22 "C:\DEV\xenko\sources\common\core\SiliconStudio.AssemblyProcessor.Common\ComplexSerializerCodeGenerator.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(assemblySerializerFactoryClassName));

            #line default
            #line hidden
            this.Write(@"))]

namespace SiliconStudio.Core.Serialization.Serializers
{
	class AssemblySerializerFactoryAttribute : Attribute
	{
		public Type Type;
	}
}

namespace SiliconStudio.DataSerializers
{
    // Assembly attributes that defines supported serializer (only generics one so that other assemblies can do generic instantiations by themselves)
");

            #line 35 "C:\DEV\xenko\sources\common\core\SiliconStudio.AssemblyProcessor.Common\ComplexSerializerCodeGenerator.tt"
            foreach (var profile in cecilSerializerContext.SerializableTypesProfiles)
            {
                foreach (var type in profile.Value.SerializableTypes.Where(x => x.Value.Local))
                {
            #line default
            #line hidden
                    this.Write("    [DataSerializerGlobalAttribute(");

            #line 37 "C:\DEV\xenko\sources\common\core\SiliconStudio.AssemblyProcessor.Common\ComplexSerializerCodeGenerator.tt"
                    this.Write(this.ToStringHelper.ToStringWithCulture(type.Value.SerializerType != null ? $"typeof({type.Value.SerializerType.ConvertCSharp(false)})" : "null"));

            #line default
            #line hidden
                    this.Write(", typeof(");

            #line 37 "C:\DEV\xenko\sources\common\core\SiliconStudio.AssemblyProcessor.Common\ComplexSerializerCodeGenerator.tt"
                    this.Write(this.ToStringHelper.ToStringWithCulture(type.Key.ConvertCSharp(false)));

            #line default
            #line hidden
                    this.Write("), DataSerializerGenericMode.");

            #line 37 "C:\DEV\xenko\sources\common\core\SiliconStudio.AssemblyProcessor.Common\ComplexSerializerCodeGenerator.tt"
                    this.Write(this.ToStringHelper.ToStringWithCulture(type.Value.Mode.ToString()));

            #line default
            #line hidden
                    this.Write(", ");

            #line 37 "C:\DEV\xenko\sources\common\core\SiliconStudio.AssemblyProcessor.Common\ComplexSerializerCodeGenerator.tt"
                    this.Write(this.ToStringHelper.ToStringWithCulture(type.Value.Inherited ? "true" : "false"));

            #line default
            #line hidden
                    this.Write(", ");

            #line 37 "C:\DEV\xenko\sources\common\core\SiliconStudio.AssemblyProcessor.Common\ComplexSerializerCodeGenerator.tt"
                    this.Write(this.ToStringHelper.ToStringWithCulture(type.Value.ComplexSerializer ? "true" : "false"));

            #line default
            #line hidden
                    this.Write(", Profile = \"");

            #line 37 "C:\DEV\xenko\sources\common\core\SiliconStudio.AssemblyProcessor.Common\ComplexSerializerCodeGenerator.tt"
                    this.Write(this.ToStringHelper.ToStringWithCulture(profile.Key));

            #line default
            #line hidden
                    this.Write("\")]\r\n");

            #line 38 "C:\DEV\xenko\sources\common\core\SiliconStudio.AssemblyProcessor.Common\ComplexSerializerCodeGenerator.tt"
                }
                foreach (var type in profile.Value.GenericSerializableTypes.Where(x => x.Value.Local))
                {
            #line default
            #line hidden
                    this.Write("    [DataSerializerGlobalAttribute(");

            #line 40 "C:\DEV\xenko\sources\common\core\SiliconStudio.AssemblyProcessor.Common\ComplexSerializerCodeGenerator.tt"
                    this.Write(this.ToStringHelper.ToStringWithCulture(type.Value.SerializerType != null ? $"typeof({type.Value.SerializerType.ConvertCSharp(true)})" : "null"));

            #line default
            #line hidden
                    this.Write(", typeof(");

            #line 40 "C:\DEV\xenko\sources\common\core\SiliconStudio.AssemblyProcessor.Common\ComplexSerializerCodeGenerator.tt"
                    this.Write(this.ToStringHelper.ToStringWithCulture(type.Key.ConvertCSharp(true)));

            #line default
            #line hidden
                    this.Write("), DataSerializerGenericMode.");

            #line 40 "C:\DEV\xenko\sources\common\core\SiliconStudio.AssemblyProcessor.Common\ComplexSerializerCodeGenerator.tt"
                    this.Write(this.ToStringHelper.ToStringWithCulture(type.Value.Mode.ToString()));

            #line default
            #line hidden
                    this.Write(", ");

            #line 40 "C:\DEV\xenko\sources\common\core\SiliconStudio.AssemblyProcessor.Common\ComplexSerializerCodeGenerator.tt"
                    this.Write(this.ToStringHelper.ToStringWithCulture(type.Value.Inherited ? "true" : "false"));

            #line default
            #line hidden
                    this.Write(", ");

            #line 40 "C:\DEV\xenko\sources\common\core\SiliconStudio.AssemblyProcessor.Common\ComplexSerializerCodeGenerator.tt"
                    this.Write(this.ToStringHelper.ToStringWithCulture(type.Value.ComplexSerializer ? "true" : "false"));

            #line default
            #line hidden
                    this.Write(", Profile = \"");

            #line 40 "C:\DEV\xenko\sources\common\core\SiliconStudio.AssemblyProcessor.Common\ComplexSerializerCodeGenerator.tt"
                    this.Write(this.ToStringHelper.ToStringWithCulture(profile.Key));

            #line default
            #line hidden
                    this.Write("\")]\r\n");

            #line 41 "C:\DEV\xenko\sources\common\core\SiliconStudio.AssemblyProcessor.Common\ComplexSerializerCodeGenerator.tt"
                }
            }

            #line default
            #line hidden
            this.Write("   \tpublic static class ");

            #line 43 "C:\DEV\xenko\sources\common\core\SiliconStudio.AssemblyProcessor.Common\ComplexSerializerCodeGenerator.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(assemblySerializerFactoryClassName));

            #line default
            #line hidden
            this.Write("\r\n\t{\r\n\t    [SiliconStudio.Core.ModuleInitializer]\r\n        internal static void I" +
                       "nitialize()\r\n        {\r\n\t\t\tvar assemblySerializers = new AssemblySerializers(typ" +
                       "eof(");

            #line 48 "C:\DEV\xenko\sources\common\core\SiliconStudio.AssemblyProcessor.Common\ComplexSerializerCodeGenerator.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(assemblySerializerFactoryClassName));

            #line default
            #line hidden
            this.Write(").GetTypeInfo().Assembly);\r\n\r\n\t\t\t// Register data contract aliases\r\n");

            #line 51 "C:\DEV\xenko\sources\common\core\SiliconStudio.AssemblyProcessor.Common\ComplexSerializerCodeGenerator.tt"
            foreach (var alias in cecilSerializerContext.DataContractAliases)
            {
            #line default
            #line hidden
                this.Write("\t\t\tassemblySerializers.DataContractAliases.Add(new KeyValuePair<string, Type>(@\"");

            #line 52 "C:\DEV\xenko\sources\common\core\SiliconStudio.AssemblyProcessor.Common\ComplexSerializerCodeGenerator.tt"
                this.Write(this.ToStringHelper.ToStringWithCulture(alias.Key));

            #line default
            #line hidden
                this.Write("\", typeof(");

            #line 52 "C:\DEV\xenko\sources\common\core\SiliconStudio.AssemblyProcessor.Common\ComplexSerializerCodeGenerator.tt"
                this.Write(this.ToStringHelper.ToStringWithCulture(alias.Value.ConvertCSharp(true)));

            #line default
            #line hidden
                this.Write(")));\r\n");

            #line 53 "C:\DEV\xenko\sources\common\core\SiliconStudio.AssemblyProcessor.Common\ComplexSerializerCodeGenerator.tt"
            }

            #line default
            #line hidden
            this.Write("\r\n");

            #line 55 "C:\DEV\xenko\sources\common\core\SiliconStudio.AssemblyProcessor.Common\ComplexSerializerCodeGenerator.tt"
            foreach (var referencedAssemblySerializerFactoryType in referencedAssemblySerializerFactoryTypes)
            {
            #line default
            #line hidden
                this.Write("\t\t\tassemblySerializers.Modules.Add(typeof(");

            #line 56 "C:\DEV\xenko\sources\common\core\SiliconStudio.AssemblyProcessor.Common\ComplexSerializerCodeGenerator.tt"
                this.Write(this.ToStringHelper.ToStringWithCulture(referencedAssemblySerializerFactoryType.ConvertCSharp()));

            #line default
            #line hidden
                this.Write(").GetTypeInfo().Module);\r\n");

            #line 57 "C:\DEV\xenko\sources\common\core\SiliconStudio.AssemblyProcessor.Common\ComplexSerializerCodeGenerator.tt"
            }

            #line default
            #line hidden
            this.Write("\r\n");

            #line 59 "C:\DEV\xenko\sources\common\core\SiliconStudio.AssemblyProcessor.Common\ComplexSerializerCodeGenerator.tt"
            foreach (var profile in cecilSerializerContext.SerializableTypesProfiles)
            {
            #line default
            #line hidden
                this.Write("\t\t\t{\r\n\t\t\t\tvar assemblySerializersProfile = new AssemblySerializersPerProfile();\r\n" +
                           "\t\t\t\tassemblySerializers.Profiles[\"");

            #line 62 "C:\DEV\xenko\sources\common\core\SiliconStudio.AssemblyProcessor.Common\ComplexSerializerCodeGenerator.tt"
                this.Write(this.ToStringHelper.ToStringWithCulture(profile.Key));

            #line default
            #line hidden
                this.Write("\"] = assemblySerializersProfile;\r\n\r\n");

            #line 64 "C:\DEV\xenko\sources\common\core\SiliconStudio.AssemblyProcessor.Common\ComplexSerializerCodeGenerator.tt"
                foreach (var type in profile.Value.SerializableTypes.Where(x => x.Value.Local))
                {
            #line default
            #line hidden
                    this.Write("\t\t\t\tassemblySerializersProfile.Add(new AssemblySerializerEntry(");

            #line 65 "C:\DEV\xenko\sources\common\core\SiliconStudio.AssemblyProcessor.Common\ComplexSerializerCodeGenerator.tt"
                    this.Write(this.ToStringHelper.ToStringWithCulture(type.Key.ConvertTypeId()));

            #line default
            #line hidden
                    this.Write(", typeof(");

            #line 65 "C:\DEV\xenko\sources\common\core\SiliconStudio.AssemblyProcessor.Common\ComplexSerializerCodeGenerator.tt"
                    this.Write(this.ToStringHelper.ToStringWithCulture(type.Key.ConvertCSharp()));

            #line default
            #line hidden
                    this.Write("), ");

            #line 65 "C:\DEV\xenko\sources\common\core\SiliconStudio.AssemblyProcessor.Common\ComplexSerializerCodeGenerator.tt"
                    if (type.Value.SerializerType != null)
                    {
            #line default
            #line hidden
                        this.Write("typeof(");

            #line 65 "C:\DEV\xenko\sources\common\core\SiliconStudio.AssemblyProcessor.Common\ComplexSerializerCodeGenerator.tt"
                        this.Write(this.ToStringHelper.ToStringWithCulture(type.Value.SerializerType.ConvertCSharp()));

            #line default
            #line hidden
                        this.Write(")");

            #line 65 "C:\DEV\xenko\sources\common\core\SiliconStudio.AssemblyProcessor.Common\ComplexSerializerCodeGenerator.tt"
                    }
                    else
                    {
            #line default
            #line hidden
                        this.Write("null");

            #line 65 "C:\DEV\xenko\sources\common\core\SiliconStudio.AssemblyProcessor.Common\ComplexSerializerCodeGenerator.tt"
                    }

            #line default
            #line hidden
                    this.Write("));\r\n");

            #line 66 "C:\DEV\xenko\sources\common\core\SiliconStudio.AssemblyProcessor.Common\ComplexSerializerCodeGenerator.tt"
                    if (type.Value.SerializerType?.Resolve()?.Methods.Any(x => x.IsConstructor && x.IsStatic) == true)
                    {
                        // Some data serializer have static constructor, force them to run
                        // TODO: It is currently used for update engine registration, but we could also make a specific method to not mix it with static ctor.

            #line default
            #line hidden
                        this.Write("\t\t\t\tSystem.Runtime.CompilerServices.RuntimeHelpers.RunClassConstructor(typeof(");

            #line 69 "C:\DEV\xenko\sources\common\core\SiliconStudio.AssemblyProcessor.Common\ComplexSerializerCodeGenerator.tt"
                        this.Write(this.ToStringHelper.ToStringWithCulture(type.Value.SerializerType.ConvertCSharp()));

            #line default
            #line hidden
                        this.Write(").TypeHandle);\r\n");

            #line 70 "C:\DEV\xenko\sources\common\core\SiliconStudio.AssemblyProcessor.Common\ComplexSerializerCodeGenerator.tt"
                    }

            #line default
            #line hidden

            #line 71 "C:\DEV\xenko\sources\common\core\SiliconStudio.AssemblyProcessor.Common\ComplexSerializerCodeGenerator.tt"
                }

            #line default
            #line hidden
                this.Write("\t\t\t}\r\n");

            #line 73 "C:\DEV\xenko\sources\common\core\SiliconStudio.AssemblyProcessor.Common\ComplexSerializerCodeGenerator.tt"
            }

            #line default
            #line hidden
            this.Write("\r\n\t\t\tDataSerializerFactory.RegisterSerializationAssembly(assemblySerializers);\r\n " +
                       "       }\r\n\t}\r\n}\r\n\r\n");

            #line 80 "C:\DEV\xenko\sources\common\core\SiliconStudio.AssemblyProcessor.Common\ComplexSerializerCodeGenerator.tt"

// Generate complex serializers
            foreach (var complexType in cecilSerializerContext.ComplexTypes)
            {
                var complexClassSerializerGenerator = new ComplexClassSerializerGenerator(complexType.Key, complexType.Value.ComplexSerializerProcessParentType);
                Write(complexClassSerializerGenerator.TransformText());
            }

            #line default
            #line hidden
            return(this.GenerationEnvironment.ToString());
        }
        /// <summary>
        /// Create the template output
        /// </summary>
        public virtual string TransformText()
        {
            this.Write(@"
using System;
using System.Collections.Generic;
using System.Reflection;
using SiliconStudio.Core.Serialization;
using SiliconStudio.Core.Reflection;
using SiliconStudio.Core.Serialization.Serializers;
using SiliconStudio.DataSerializers;

[assembly: AssemblyVersion(""");

            #line 17 "C:\DEV\paradox\sources\common\core\SiliconStudio.AssemblyProcessor.Common\ComplexSerializerCodeGenerator.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(assembly.Name.Version.ToString()));

            #line default
            #line hidden
            this.Write("\")]\r\n");

            #line 18 "C:\DEV\paradox\sources\common\core\SiliconStudio.AssemblyProcessor.Common\ComplexSerializerCodeGenerator.tt"
            if (targetFramework != null)
            {
            #line default
            #line hidden
                this.Write("[assembly: System.Runtime.Versioning.TargetFramework(");

            #line 19 "C:\DEV\paradox\sources\common\core\SiliconStudio.AssemblyProcessor.Common\ComplexSerializerCodeGenerator.tt"
                this.Write(this.ToStringHelper.ToStringWithCulture(targetFramework));

            #line default
            #line hidden
                this.Write(")]\r\n");

            #line 20 "C:\DEV\paradox\sources\common\core\SiliconStudio.AssemblyProcessor.Common\ComplexSerializerCodeGenerator.tt"
            }

            #line default
            #line hidden
            this.Write("\r\n[assembly: SiliconStudio.Core.Serialization.Serializers.AssemblySerializerFacto" +
                       "ry(Type = typeof(SiliconStudio.DataSerializers.");

            #line 22 "C:\DEV\paradox\sources\common\core\SiliconStudio.AssemblyProcessor.Common\ComplexSerializerCodeGenerator.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(assemblySerializerFactoryClassName));

            #line default
            #line hidden
            this.Write(@"))]

namespace SiliconStudio.Core.Serialization.Serializers
{
	class AssemblySerializerFactoryAttribute : Attribute
	{
		public Type Type;
	}
}

namespace SiliconStudio.DataSerializers
{
    // Assembly attributes that defines supported serializer (only generics one so that other assemblies can do generic instantiations by themselves)
");

            #line 35 "C:\DEV\paradox\sources\common\core\SiliconStudio.AssemblyProcessor.Common\ComplexSerializerCodeGenerator.tt"
            foreach (var profile in cecilSerializerContext.SerializableTypesProfiles)
            {
                foreach (var type in profile.Value.SerializableTypes.Where(x => x.Value.Local && x.Value.SerializerType != null))
                {
            #line default
            #line hidden
                    this.Write("    [DataSerializerGlobalAttribute(typeof(");

            #line 37 "C:\DEV\paradox\sources\common\core\SiliconStudio.AssemblyProcessor.Common\ComplexSerializerCodeGenerator.tt"
                    this.Write(this.ToStringHelper.ToStringWithCulture(type.Value.SerializerType.ConvertCSharp(false)));

            #line default
            #line hidden
                    this.Write("), typeof(");

            #line 37 "C:\DEV\paradox\sources\common\core\SiliconStudio.AssemblyProcessor.Common\ComplexSerializerCodeGenerator.tt"
                    this.Write(this.ToStringHelper.ToStringWithCulture(type.Key.ConvertCSharp(false)));

            #line default
            #line hidden
                    this.Write("), DataSerializerGenericMode.");

            #line 37 "C:\DEV\paradox\sources\common\core\SiliconStudio.AssemblyProcessor.Common\ComplexSerializerCodeGenerator.tt"
                    this.Write(this.ToStringHelper.ToStringWithCulture(type.Value.Mode.ToString()));

            #line default
            #line hidden
                    this.Write(", ");

            #line 37 "C:\DEV\paradox\sources\common\core\SiliconStudio.AssemblyProcessor.Common\ComplexSerializerCodeGenerator.tt"
                    this.Write(this.ToStringHelper.ToStringWithCulture(type.Value.Inherited ? "true" : "false"));

            #line default
            #line hidden
                    this.Write(", ");

            #line 37 "C:\DEV\paradox\sources\common\core\SiliconStudio.AssemblyProcessor.Common\ComplexSerializerCodeGenerator.tt"
                    this.Write(this.ToStringHelper.ToStringWithCulture(type.Value.ComplexSerializer ? "true" : "false"));

            #line default
            #line hidden
                    this.Write(", Profile = \"");

            #line 37 "C:\DEV\paradox\sources\common\core\SiliconStudio.AssemblyProcessor.Common\ComplexSerializerCodeGenerator.tt"
                    this.Write(this.ToStringHelper.ToStringWithCulture(profile.Key));

            #line default
            #line hidden
                    this.Write("\")]\r\n");

            #line 38 "C:\DEV\paradox\sources\common\core\SiliconStudio.AssemblyProcessor.Common\ComplexSerializerCodeGenerator.tt"
                }
                foreach (var type in profile.Value.GenericSerializableTypes.Where(x => x.Value.Local && x.Value.SerializerType != null))
                {
            #line default
            #line hidden
                    this.Write("    [DataSerializerGlobalAttribute(typeof(");

            #line 40 "C:\DEV\paradox\sources\common\core\SiliconStudio.AssemblyProcessor.Common\ComplexSerializerCodeGenerator.tt"
                    this.Write(this.ToStringHelper.ToStringWithCulture(type.Value.SerializerType.ConvertCSharp(true)));

            #line default
            #line hidden
                    this.Write("), typeof(");

            #line 40 "C:\DEV\paradox\sources\common\core\SiliconStudio.AssemblyProcessor.Common\ComplexSerializerCodeGenerator.tt"
                    this.Write(this.ToStringHelper.ToStringWithCulture(type.Key.ConvertCSharp(true)));

            #line default
            #line hidden
                    this.Write("), DataSerializerGenericMode.");

            #line 40 "C:\DEV\paradox\sources\common\core\SiliconStudio.AssemblyProcessor.Common\ComplexSerializerCodeGenerator.tt"
                    this.Write(this.ToStringHelper.ToStringWithCulture(type.Value.Mode.ToString()));

            #line default
            #line hidden
                    this.Write(", ");

            #line 40 "C:\DEV\paradox\sources\common\core\SiliconStudio.AssemblyProcessor.Common\ComplexSerializerCodeGenerator.tt"
                    this.Write(this.ToStringHelper.ToStringWithCulture(type.Value.Inherited ? "true" : "false"));

            #line default
            #line hidden
                    this.Write(", ");

            #line 40 "C:\DEV\paradox\sources\common\core\SiliconStudio.AssemblyProcessor.Common\ComplexSerializerCodeGenerator.tt"
                    this.Write(this.ToStringHelper.ToStringWithCulture(type.Value.ComplexSerializer ? "true" : "false"));

            #line default
            #line hidden
                    this.Write(", Profile = \"");

            #line 40 "C:\DEV\paradox\sources\common\core\SiliconStudio.AssemblyProcessor.Common\ComplexSerializerCodeGenerator.tt"
                    this.Write(this.ToStringHelper.ToStringWithCulture(profile.Key));

            #line default
            #line hidden
                    this.Write("\")]\r\n");

            #line 41 "C:\DEV\paradox\sources\common\core\SiliconStudio.AssemblyProcessor.Common\ComplexSerializerCodeGenerator.tt"
                }
            }

            #line default
            #line hidden
            this.Write("   \tpublic static class ");

            #line 43 "C:\DEV\paradox\sources\common\core\SiliconStudio.AssemblyProcessor.Common\ComplexSerializerCodeGenerator.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(assemblySerializerFactoryClassName));

            #line default
            #line hidden
            this.Write("\r\n\t{\r\n\t    [SiliconStudio.Core.ModuleInitializer]\r\n        internal static void I" +
                       "nitialize()\r\n        {\r\n");

            #line 48 "C:\DEV\paradox\sources\common\core\SiliconStudio.AssemblyProcessor.Common\ComplexSerializerCodeGenerator.tt"
            foreach (var profile in cecilSerializerContext.SerializableTypesProfiles)
            {
            #line default
            #line hidden
                this.Write("\t\t\tDataSerializerFactory.RegisterSerializationProfile(\"");

            #line 49 "C:\DEV\paradox\sources\common\core\SiliconStudio.AssemblyProcessor.Common\ComplexSerializerCodeGenerator.tt"
                this.Write(this.ToStringHelper.ToStringWithCulture(profile.Key));

            #line default
            #line hidden
                this.Write("\", Register");

            #line 49 "C:\DEV\paradox\sources\common\core\SiliconStudio.AssemblyProcessor.Common\ComplexSerializerCodeGenerator.tt"
                this.Write(this.ToStringHelper.ToStringWithCulture(profile.Key));

            #line default
            #line hidden
                this.Write(");\r\n");

            #line 50 "C:\DEV\paradox\sources\common\core\SiliconStudio.AssemblyProcessor.Common\ComplexSerializerCodeGenerator.tt"
            }

            #line default
            #line hidden
            this.Write("        }\r\n\r\n");

            #line 53 "C:\DEV\paradox\sources\common\core\SiliconStudio.AssemblyProcessor.Common\ComplexSerializerCodeGenerator.tt"
            foreach (var profile in cecilSerializerContext.SerializableTypesProfiles)
            {
            #line default
            #line hidden
                this.Write("\t\tpublic static void Register");

            #line 54 "C:\DEV\paradox\sources\common\core\SiliconStudio.AssemblyProcessor.Common\ComplexSerializerCodeGenerator.tt"
                this.Write(this.ToStringHelper.ToStringWithCulture(profile.Key));

            #line default
            #line hidden
                this.Write("(DataSerializerFactory serializerFactory)\r\n\t\t{\r\n\t\t\t// Force module .ctor of refer" +
                           "enced assemblies to be initialized as well\r\n");

            #line 57 "C:\DEV\paradox\sources\common\core\SiliconStudio.AssemblyProcessor.Common\ComplexSerializerCodeGenerator.tt"
                foreach (var referencedAssemblySerializerFactoryType in referencedAssemblySerializerFactoryTypes)
                {
            #line default
            #line hidden
                    this.Write("\t\t\tModuleRuntimeHelpers.RunModuleConstructor(typeof(");

            #line 58 "C:\DEV\paradox\sources\common\core\SiliconStudio.AssemblyProcessor.Common\ComplexSerializerCodeGenerator.tt"
                    this.Write(this.ToStringHelper.ToStringWithCulture(referencedAssemblySerializerFactoryType.ConvertCSharp()));

            #line default
            #line hidden
                    this.Write(").GetTypeInfo().Module);\r\n");

            #line 59 "C:\DEV\paradox\sources\common\core\SiliconStudio.AssemblyProcessor.Common\ComplexSerializerCodeGenerator.tt"
                }

            #line default
            #line hidden
                this.Write("\r\n\t\t\t// Register types used by this assembly\r\n");

            #line 62 "C:\DEV\paradox\sources\common\core\SiliconStudio.AssemblyProcessor.Common\ComplexSerializerCodeGenerator.tt"
                foreach (var type in profile.Value.SerializableTypes.Where(x => x.Value.Local))
                {
            #line default
            #line hidden
                    this.Write("\t\t\tif (!serializerFactory.CanSerialize(typeof(");

            #line 63 "C:\DEV\paradox\sources\common\core\SiliconStudio.AssemblyProcessor.Common\ComplexSerializerCodeGenerator.tt"
                    this.Write(this.ToStringHelper.ToStringWithCulture(type.Key.ConvertCSharp()));

            #line default
            #line hidden
                    this.Write(")))\r\n\t\t\t{\r\n");

            #line 65 "C:\DEV\paradox\sources\common\core\SiliconStudio.AssemblyProcessor.Common\ComplexSerializerCodeGenerator.tt"
                    if (type.Value.SerializerType != null)
                    {
            #line default
            #line hidden
                        this.Write("\t\t\t\tserializerFactory.RegisterSerializer(");

            #line 66 "C:\DEV\paradox\sources\common\core\SiliconStudio.AssemblyProcessor.Common\ComplexSerializerCodeGenerator.tt"
                        this.Write(this.ToStringHelper.ToStringWithCulture(type.Key.ConvertTypeId()));

            #line default
            #line hidden
                        this.Write(", new ");

            #line 66 "C:\DEV\paradox\sources\common\core\SiliconStudio.AssemblyProcessor.Common\ComplexSerializerCodeGenerator.tt"
                        this.Write(this.ToStringHelper.ToStringWithCulture(type.Value.SerializerType.ConvertCSharp()));

            #line default
            #line hidden
                        this.Write("());\r\n");

            #line 67 "C:\DEV\paradox\sources\common\core\SiliconStudio.AssemblyProcessor.Common\ComplexSerializerCodeGenerator.tt"
                    }
                    else
                    {
            #line default
            #line hidden
                        this.Write("\t\t\t\tserializerFactory.RegisterNullSerializer(");

            #line 68 "C:\DEV\paradox\sources\common\core\SiliconStudio.AssemblyProcessor.Common\ComplexSerializerCodeGenerator.tt"
                        this.Write(this.ToStringHelper.ToStringWithCulture(type.Key.ConvertTypeId()));

            #line default
            #line hidden
                        this.Write(", typeof(");

            #line 68 "C:\DEV\paradox\sources\common\core\SiliconStudio.AssemblyProcessor.Common\ComplexSerializerCodeGenerator.tt"
                        this.Write(this.ToStringHelper.ToStringWithCulture(type.Key.ConvertCSharp()));

            #line default
            #line hidden
                        this.Write("));\r\n");

            #line 69 "C:\DEV\paradox\sources\common\core\SiliconStudio.AssemblyProcessor.Common\ComplexSerializerCodeGenerator.tt"
                    }

            #line default
            #line hidden
                    this.Write("\t\t\t}\r\n");

            #line 71 "C:\DEV\paradox\sources\common\core\SiliconStudio.AssemblyProcessor.Common\ComplexSerializerCodeGenerator.tt"
                }

            #line default
            #line hidden
                this.Write("\t\t}\r\n\r\n");

            #line 74 "C:\DEV\paradox\sources\common\core\SiliconStudio.AssemblyProcessor.Common\ComplexSerializerCodeGenerator.tt"
            } // foreach (profile)

            #line default
            #line hidden
            this.Write("\t}\r\n}\r\n\r\n");

            #line 78 "C:\DEV\paradox\sources\common\core\SiliconStudio.AssemblyProcessor.Common\ComplexSerializerCodeGenerator.tt"

// Generate complex serializers
            foreach (var complexType in cecilSerializerContext.ComplexTypes)
            {
                var complexClassSerializerGenerator = new ComplexClassSerializerGenerator(complexType.Key, complexType.Value.ComplexSerializerProcessParentType);
                Write(complexClassSerializerGenerator.TransformText());
            }

            #line default
            #line hidden
            return(this.GenerationEnvironment.ToString());
        }