Changed attribute builder to derive from correct class, also added method to pass base class parameters using string refs. Regenerated the files

This commit is contained in:
Samuele Lorefice
2025-03-06 17:37:55 +01:00
parent a784eed61d
commit 02aa7db319
6 changed files with 46 additions and 18 deletions

View File

@@ -300,10 +300,10 @@ namespace CodeGenerator {
private static CodeTypeDeclaration[] GenerateTypeDeclarations() {
var attributeBuilder = new AttributeBuilder();
var typeDeclarations = new CodeTypeDeclaration[] {
var typeDeclarations = new[] {
attributeBuilder.New().SetName("DNAAttribute")
.SetAttributeUsage(new (new CodeSnippetExpression("AttributeTargets.All")))
.DeriveFromClass("System.Attribute")
.DeriveFromClass()
.AddAutoProperty(typeof(int), "OriginalIndex")
.AddAutoProperty(typeof(string), "OriginalName")
.AddPropertiesConstructor()
@@ -319,6 +319,7 @@ namespace CodeGenerator {
.AddAutoProperty(typeof(bool), "IsPointer")
.AddAutoProperty(typeof(int), "MemoryOffset")
.AddPropertiesConstructor()
.AddBaseConstructorParams(["OriginalIndex", "OriginalName"])
.Build(),
attributeBuilder.New().SetName("DNAClassAttribute")
.SetAttributeUsage(new (new CodeSnippetExpression("AttributeTargets.Class | AttributeTargets.Struct")))
@@ -327,6 +328,7 @@ namespace CodeGenerator {
.AddAutoProperty(typeof(string), "OriginalName")
.AddAutoProperty(typeof(int), "Size")
.AddPropertiesConstructor()
.AddBaseConstructorParams(["OriginalIndex", "OriginalName"])
.Build(),
attributeBuilder.New().SetName("DNAListAttribute")
.SetAttributeUsage(new (new CodeSnippetExpression("AttributeTargets.Property | AttributeTargets.Field")))
@@ -340,6 +342,7 @@ namespace CodeGenerator {
.AddAutoProperty(typeof(int), "CountFieldIndex")
.AddAutoProperty(typeof(int), "MemoryOffset")
.AddPropertiesConstructor()
.AddBaseConstructorParams(["OriginalIndex", "OriginalName"])
.Build()
};
return typeDeclarations;