Compare commits

...

2 Commits

3 changed files with 13 additions and 2 deletions

View File

@@ -3,6 +3,7 @@
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AArray_002ECoreCLR_002Ecs_002Fl_003AC_0021_003FUsers_003Fairon_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FSourcesCache_003Fee3c9d264411441f56a12bac52a58ad25b495ef52e59b4a86f8478158f7d_003FArray_002ECoreCLR_002Ecs/@EntryIndexedValue">ForceIncluded</s:String> <s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AArray_002ECoreCLR_002Ecs_002Fl_003AC_0021_003FUsers_003Fairon_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FSourcesCache_003Fee3c9d264411441f56a12bac52a58ad25b495ef52e59b4a86f8478158f7d_003FArray_002ECoreCLR_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AArray_002ECoreCLR_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002Econfig_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FSourcesCache_003F51b332f64116ca1bf68931ca13adc3cd38b6dd2da04af6aef46bd08d218e58b5_003FArray_002ECoreCLR_002Ecs/@EntryIndexedValue">ForceIncluded</s:String> <s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AArray_002ECoreCLR_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002Econfig_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FSourcesCache_003F51b332f64116ca1bf68931ca13adc3cd38b6dd2da04af6aef46bd08d218e58b5_003FArray_002ECoreCLR_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ACodeDomProvider_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002Econfig_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FSourcesCache_003F4333c036d67eaa64623a27221cb821b663bc08410ac68797b1c10376d8379fe_003FCodeDomProvider_002Ecs/@EntryIndexedValue">ForceIncluded</s:String> <s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ACodeDomProvider_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002Econfig_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FSourcesCache_003F4333c036d67eaa64623a27221cb821b663bc08410ac68797b1c10376d8379fe_003FCodeDomProvider_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ACollectionBase_002Ecs_002Fl_003AC_0021_003FUsers_003Fairon_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FSourcesCache_003Fa6227be3686afd1e7a497da15c9371b4dc2c39126852fbc263d51ab206739b_003FCollectionBase_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ACSharpCodeGenerator_002Ecs_002Fl_003AC_0021_003FUsers_003Fairon_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FSourcesCache_003F4aa9136c27fa69d6c91e9d8679c1a1d4b7aabee06e20d4405ee3d91ee05048f0_003FCSharpCodeGenerator_002Ecs/@EntryIndexedValue">ForceIncluded</s:String> <s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ACSharpCodeGenerator_002Ecs_002Fl_003AC_0021_003FUsers_003Fairon_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FSourcesCache_003F4aa9136c27fa69d6c91e9d8679c1a1d4b7aabee06e20d4405ee3d91ee05048f0_003FCSharpCodeGenerator_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ACSharpCodeGenerator_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002Econfig_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FSourcesCache_003F4aa9136c27fa69d6c91e9d8679c1a1d4b7aabee06e20d4405ee3d91ee05048f0_003FCSharpCodeGenerator_002Ecs/@EntryIndexedValue">ForceIncluded</s:String> <s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ACSharpCodeGenerator_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002Econfig_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FSourcesCache_003F4aa9136c27fa69d6c91e9d8679c1a1d4b7aabee06e20d4405ee3d91ee05048f0_003FCSharpCodeGenerator_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AList_002Ecs_002Fl_003AC_0021_003FUsers_003Fairon_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FSourcesCache_003Fb7208b3f72528d22781d25fde9a55271bdf2b5aade4f03b1324579a25493cd8_003FList_002Ecs/@EntryIndexedValue">ForceIncluded</s:String> <s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AList_002Ecs_002Fl_003AC_0021_003FUsers_003Fairon_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FSourcesCache_003Fb7208b3f72528d22781d25fde9a55271bdf2b5aade4f03b1324579a25493cd8_003FList_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>

View File

@@ -58,6 +58,9 @@ namespace CodeGenerator {
/// </summary> /// </summary>
/// <param name="baseType">Fully qualified name from which this is going to be derived</param> /// <param name="baseType">Fully qualified name from which this is going to be derived</param>
public AttributeBuilder DeriveFromClass(string baseType) { public AttributeBuilder DeriveFromClass(string baseType) {
if (_attrDecl.BaseTypes.Count == 0)
_attrDecl.BaseTypes.Add(typeof(Attribute));
else
_attrDecl.BaseTypes[0] = new(baseType); _attrDecl.BaseTypes[0] = new(baseType);
return this; return this;
} }

View File

@@ -22,7 +22,10 @@ namespace CodeGenerator {
private const string Namespace = "BlendFile"; private const string Namespace = "BlendFile";
private static HashSet<string> _customTypes; private static HashSet<string> _customTypes;
private static readonly string[] ListLenghtStr = {"count", "length", "size"}; private static readonly string[] ListMarkerStr = {"list", "array"};
private static readonly string[] ListLenghtStr = {"num", "len", "size"};
private static void Log(string message) { private static void Log(string message) {
Sb.AppendLine(message); Sb.AppendLine(message);
@@ -145,12 +148,14 @@ namespace CodeGenerator {
var typeDeclarations = new CodeTypeDeclaration[] { var typeDeclarations = new CodeTypeDeclaration[] {
attributeBuilder.New().SetName("DNAAttribute") attributeBuilder.New().SetName("DNAAttribute")
.SetAttributeUsage(new (new CodeSnippetExpression("AttributeTargets.All"))) .SetAttributeUsage(new (new CodeSnippetExpression("AttributeTargets.All")))
.DeriveFromClass("System.Attribute")
.AddAutoProperty(typeof(int), "OriginalIndex") .AddAutoProperty(typeof(int), "OriginalIndex")
.AddAutoProperty(typeof(string), "OriginalName") .AddAutoProperty(typeof(string), "OriginalName")
.AddPropertiesConstructor() .AddPropertiesConstructor()
.Build(), .Build(),
attributeBuilder.New().SetName("DNAFieldAttribute") attributeBuilder.New().SetName("DNAFieldAttribute")
.SetAttributeUsage(new (new CodeSnippetExpression("AttributeTargets.Field"))) .SetAttributeUsage(new (new CodeSnippetExpression("AttributeTargets.Field")))
.DeriveFromClass($"{Namespace}.DNAAttribute")
.AddAutoProperty(typeof(int), "Size") .AddAutoProperty(typeof(int), "Size")
.AddAutoProperty(typeof(string), "OriginalType") .AddAutoProperty(typeof(string), "OriginalType")
.AddAutoProperty(typeof(int), "OriginalIndex") .AddAutoProperty(typeof(int), "OriginalIndex")
@@ -162,6 +167,7 @@ namespace CodeGenerator {
.Build(), .Build(),
attributeBuilder.New().SetName("DNAClassAttribute") attributeBuilder.New().SetName("DNAClassAttribute")
.SetAttributeUsage(new (new CodeSnippetExpression("AttributeTargets.Class | AttributeTargets.Struct"))) .SetAttributeUsage(new (new CodeSnippetExpression("AttributeTargets.Class | AttributeTargets.Struct")))
.DeriveFromClass($"{Namespace}.DNAAttribute")
.AddAutoProperty(typeof(int), "Size") .AddAutoProperty(typeof(int), "Size")
.AddAutoProperty(typeof(int), "OriginalIndex") .AddAutoProperty(typeof(int), "OriginalIndex")
.AddAutoProperty(typeof(string), "OriginalName") .AddAutoProperty(typeof(string), "OriginalName")
@@ -169,6 +175,7 @@ namespace CodeGenerator {
.Build(), .Build(),
attributeBuilder.New().SetName("DNAListAttribute") attributeBuilder.New().SetName("DNAListAttribute")
.SetAttributeUsage(new (new CodeSnippetExpression("AttributeTargets.Property | AttributeTargets.Field"))) .SetAttributeUsage(new (new CodeSnippetExpression("AttributeTargets.Property | AttributeTargets.Field")))
.DeriveFromClass($"{Namespace}.DNAAttribute")
.AddAutoProperty(typeof(int), "Size") .AddAutoProperty(typeof(int), "Size")
.AddAutoProperty(typeof(string), "OriginalType") .AddAutoProperty(typeof(string), "OriginalType")
.AddAutoProperty(typeof(string), "OriginalName") .AddAutoProperty(typeof(string), "OriginalName")