Exemple #1
0
        public CodeGenType(TypeDefinition typeDefinition, CodeGenService.GhostComponent config = null)
        {
            _overrideConfig = config;

            // 模板参数
            templateArgs = new CommonT4Info
            {
                TypeName     = typeDefinition.Name,
                CurNamespace = typeDefinition.Namespace,
                ToNamespace  = GetNamespace(typeDefinition.Module.Assembly.Name.Name),
                Fields       = new List <FieldT4Info>()
            };

            outFileName = $"{templateArgs.TypeName}Serializer.cs";
        }
Exemple #2
0
        public GhostCollectionSerializerSystemCodeGenType(AssemblyDefinition assemblyDefinition,
                                                          CodeGenAssembly assemblies)
        {
            templateFilePath = CodeGenServiceEditor.GhostComponentSerializerSystemPath;

            templateArgs = new CommonT4Info
            {
                ToNamespace = GetNamespace(assemblyDefinition.Name.Name),
                Fields      = new List <FieldT4Info>()
            };

            foreach (var codeGenBaseType in assemblies)
            {
                if (codeGenBaseType is GhostComponentGenType type)
                {
                    templateArgs.Fields.Add(new FieldT4Info
                    {
                        Name = type.Name
                    });
                }
            }

            outFileName = $"GhostCollectionSerializerSystem.cs";
        }