diff --git a/Daybreak.API/Interop/GWCA.cs b/Daybreak.API/Interop/GWCA.cs index 966a4fb4..2f46c541 100644 --- a/Daybreak.API/Interop/GWCA.cs +++ b/Daybreak.API/Interop/GWCA.cs @@ -8089,7 +8089,7 @@ public static unsafe partial class GWCA public static partial class Urgoz { internal const int HoppingVampire = 3796; - internal const int Urgoz = 3805; + internal const int Urgoz_ = 3805; public static partial class Deep { @@ -8223,7 +8223,7 @@ public static unsafe partial class GWCA internal const int LockedChest = 8192; // this is actually ->ExtraType internal const int MiniatureLegionnaire = 8035; - public static partial class Minipet + public static partial class Minipet_ { internal const int MiniatureConfessorDorian = 8344; internal const int MiniatureConfessorIsaiah = 8352; diff --git a/Daybreak.Core/Services/TarGz/TarGzExtractor.cs b/Daybreak.Core/Services/TarGz/TarGzExtractor.cs index 013bd7eb..b4a6be7d 100644 --- a/Daybreak.Core/Services/TarGz/TarGzExtractor.cs +++ b/Daybreak.Core/Services/TarGz/TarGzExtractor.cs @@ -44,7 +44,8 @@ internal sealed class TarGzExtractor( // Use ReaderFactory which properly handles nested archives like .tar.gz using var stream = File.OpenRead(sourceFile); - using var reader = ReaderFactory.OpenReader(stream, new ReaderOptions { ExtractFullPath = true, Overwrite = true }); + using var reader = ReaderFactory.OpenReader(stream); + var extractionOptions = new ExtractionOptions { ExtractFullPath = true, Overwrite = true }; var processedEntries = 0; @@ -68,7 +69,7 @@ internal sealed class TarGzExtractor( progressTracker(0.5, entryKey); // Extract the entry - reader.WriteEntryToDirectory(destinationDirectory); + reader.WriteEntryToDirectory(destinationDirectory, extractionOptions); processedEntries++; } diff --git a/Daybreak.Generators/GenerateGWCABindings.cs b/Daybreak.Generators/GenerateGWCABindings.cs index 8e58f38e..c910b037 100644 --- a/Daybreak.Generators/GenerateGWCABindings.cs +++ b/Daybreak.Generators/GenerateGWCABindings.cs @@ -500,7 +500,8 @@ public sealed class GenerateGWCABindings : IIncrementalGenerator ConstantsNode node, Dictionary typeMap, HashSet namespaceClassNames, - int indent) + int indent, + string? emitNameOverride = null) { var pad = new string(' ', indent); @@ -508,11 +509,13 @@ public sealed class GenerateGWCABindings : IIncrementalGenerator if (!HasAnyContent(node)) return; + var emitName = emitNameOverride ?? SanitizeIdentifier(node.Name); + // Always emit a partial class wrapper — C# allows multiple partial // declarations for the same nested class, so this merges cleanly // with any class already emitted by the export tree. sb.AppendLine(); - sb.AppendLine($"{pad}public static partial class {SanitizeIdentifier(node.Name)}"); + sb.AppendLine($"{pad}public static partial class {emitName}"); sb.AppendLine($"{pad}{{"); var innerIndent = indent + 4; @@ -543,8 +546,12 @@ public sealed class GenerateGWCABindings : IIncrementalGenerator foreach (var member in enumDef.Members) { var csType = MapCppTypeToCs(enumDef.UnderlyingType); + var memberName = SanitizeIdentifier(member.Name); + // CS0542: member names cannot be the same as their enclosing type + if (memberName == emitName) + memberName += "_"; var comment = member.Comment is not null ? $" // {member.Comment}" : ""; - sb.AppendLine($"{innerPad}internal const {csType} {SanitizeIdentifier(member.Name)} = {member.Value};{comment}"); + sb.AppendLine($"{innerPad}internal const {csType} {memberName} = {member.Value};{comment}"); } } } @@ -554,8 +561,12 @@ public sealed class GenerateGWCABindings : IIncrementalGenerator { var csType = MapCppTypeToCs(field.CppType); var value = field.Value; + var fieldName = SanitizeIdentifier(field.Name); + // CS0542: member names cannot be the same as their enclosing type + if (fieldName == emitName) + fieldName += "_"; var comment = field.Comment is not null ? $" // {field.Comment}" : ""; - sb.AppendLine($"{innerPad}internal const {csType} {SanitizeIdentifier(field.Name)} = {value};{comment}"); + sb.AppendLine($"{innerPad}internal const {csType} {fieldName} = {value};{comment}"); } // Type aliases are now emitted to GuildWars namespace, not nested GWCA classes @@ -567,7 +578,11 @@ public sealed class GenerateGWCABindings : IIncrementalGenerator // Emit children foreach (var child in node.Children.Values.OrderBy(c => c.Name, StringComparer.Ordinal)) { - EmitConstantsNode(sb, child, typeMap, namespaceClassNames, innerIndent); + // CS0542: nested class name cannot be the same as enclosing type + string? childNameOverride = null; + if (SanitizeIdentifier(child.Name) == emitName) + childNameOverride = SanitizeIdentifier(child.Name) + "_"; + EmitConstantsNode(sb, child, typeMap, namespaceClassNames, innerIndent, childNameOverride); } sb.AppendLine($"{pad}}}"); diff --git a/Directory.Packages.props b/Directory.Packages.props index 7f700bae..74800603 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -4,10 +4,10 @@ - + - + @@ -15,29 +15,29 @@ - - + + - - - - - + + + + + - - + + - - + + - - + + @@ -53,17 +53,17 @@ - + - - - - + + + + - - - + + + @@ -73,6 +73,6 @@ - + \ No newline at end of file