Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reduce nesting of namespaces #446

Open
Washi1337 opened this issue Jun 9, 2023 · 0 comments
Open

Reduce nesting of namespaces #446

Washi1337 opened this issue Jun 9, 2023 · 0 comments
Milestone

Comments

@Washi1337
Copy link
Owner

Washi1337 commented Jun 9, 2023

Problem Description

The structure of the AsmResolver project is hierarchical, where different concerns of functionality are split up into multiple directories and sub-directories.

While this improves the project structure, it results in a lot of namespaces. For a user this is cumbersome, as they would have to import many of these namespaces with using statements, while a lot of these components are used together quite frequently and could also be considered part of one bigger main component. For example, the TablesStream class is often used in conjunction with BlobStream and StringsStream, to resolve the raw indices in the tables to meaningful signatures and strings respectively, but right now these three streams all reside in different namespaces.

Proposal

Consolidate the following commonly used namespaces to reduce nesting and thus the amount of usings required in a typical C# program that uses AsmResolver:

  • AsmResolver.PE.File.Headers -> AsmResolver.PE.File
  • AsmResolver.PE.DotNet.Metadata.Tables.Rows -> AsmResolver.PE.DotNet.Metadata.Tables
    • We may even consider flattening the entirety of AsmResolver.PE.DotNet.Metadata.* to a single AsmResolver.PE.DotNet.Metadata, as different streams in the metadata directory are typically used together.
  • AsmResolver.DotNet.Signatures.Types -> AsmResolver.DotNet.Signatures
  • AsmResolver.DotNet.Signatures.Security -> AsmResolver.DotNet.Signatures
  • AsmResolver.DotNet.Signatures.Marshal -> AsmResolver.DotNet.Signatures
  • AsmResolver.DotNet.Builder.Metadata.Blob ->AsmResolver.DotNet.Builder.Metadata
  • AsmResolver.DotNet.Builder.Metadata.Guid ->AsmResolver.DotNet.Builder.Metadata
  • AsmResolver.DotNet.Builder.Metadata.Strings ->AsmResolver.DotNet.Builder.Metadata
  • AsmResolver.DotNet.Builder.Metadata.Tables ->AsmResolver.DotNet.Builder.Metadata
  • AsmResolver.DotNet.Builder.Metadata.UserStrings ->AsmResolver.DotNet.Builder.Metadata

Alternatives

Consumers could use global usings now in modern C#. However, this still means a good portion of these statements will be dedicated to just importing AsmResolver-related namespaces only. Furthermore, when using editors that do not have intelligent autocompletion (especially when working with languages such as Powershell), it is hard to remember in which namespace everything is put.

Additional Context

No response

@Washi1337 Washi1337 added this to the 6.0.0 milestone Jun 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant