private CodeTypeDeclaration ExportStruct(StructMapping mapping)
{
if (mapping.TypeDesc.IsRoot)
{
base.ExportRoot(mapping, typeof(SoapIncludeAttribute));
return(null);
}
if (!mapping.IncludeInSchema)
{
return(null);
}
string name = mapping.TypeDesc.Name;
string str2 = (mapping.TypeDesc.BaseTypeDesc == null) ? string.Empty : mapping.TypeDesc.BaseTypeDesc.Name;
CodeTypeDeclaration declaration = new CodeTypeDeclaration(name)
{
IsPartial = base.CodeProvider.Supports(GeneratorSupport.PartialTypes)
};
declaration.Comments.Add(new CodeCommentStatement(Res.GetString("XmlRemarks"), true));
base.CodeNamespace.Types.Add(declaration);
if ((str2 != null) && (str2.Length > 0))
{
declaration.BaseTypes.Add(str2);
}
else
{
base.AddPropertyChangedNotifier(declaration);
}
declaration.TypeAttributes |= TypeAttributes.Public;
if (mapping.TypeDesc.IsAbstract)
{
declaration.TypeAttributes |= TypeAttributes.Abstract;
}
CodeExporter.AddIncludeMetadata(declaration.CustomAttributes, mapping, typeof(SoapIncludeAttribute));
if (base.GenerateProperties)
{
for (int j = 0; j < mapping.Members.Length; j++)
{
this.ExportProperty(declaration, mapping.Members[j], mapping.Scope);
}
}
else
{
for (int k = 0; k < mapping.Members.Length; k++)
{
this.ExportMember(declaration, mapping.Members[k]);
}
}
for (int i = 0; i < mapping.Members.Length; i++)
{
this.EnsureTypesExported(mapping.Members[i].Elements, null);
}
if (mapping.BaseMapping != null)
{
this.ExportType(mapping.BaseMapping);
}
this.ExportDerivedStructs(mapping);
CodeGenerator.ValidateIdentifiers(declaration);
return(declaration);
}