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

Suggestion for extending the WholeProjectDecompiler API #3216

Open
aldelaro5 opened this issue Jun 1, 2024 · 0 comments
Open

Suggestion for extending the WholeProjectDecompiler API #3216

aldelaro5 opened this issue Jun 1, 2024 · 0 comments
Labels
Enhancement Areas for improvement

Comments

@aldelaro5
Copy link

Is your feature request related to a problem? Please describe.

I would like to be able to use the WholeProjectDecompiler in a way that doesn't seem supported with the current API without some intrusive measures. Specifically, I would like to be able to output the C# code, but in a manner that is similar to what I would get if I were to have the C# code with its associated IL commented out next to it on each lines.

The GUI frontend has the option to have IL with C# which is close, but it's not possible to export it in such a way that I have a csproj with many .cs files that are outputed this way. In other words, I HAVE to use the UI to have this view which isn't suitable for my needs, I am more looking an an actual project export with the IL commented out.

The problem is while this could be technically possible (I can compare the sequence point of a ReflectionDisassembler vs a CSharpDecompiler), the current api are too restrictive for me to be able to do this easily. Sepcifically, while I can inherit from WholeProjectDecompiler, it doesn't allow me to override what happens when it tries to write to a file. The API are done in such a way that I cannot have any logic there: I have to let it decompile all .cs files with its own internal logic. It's also not possible to insert the commented IL after the fact because I would need to have the sequence points of each lines, but because I cannot have logic when it writes the code, I cannot know this informations.

Essentially, the current API is too restrictive to do this.

Describe the solution you'd like

Something more modular regarding how the files are decompiled. A couple ideas that comes in my mind (but I am open for discussions):

Additional context

I am relatively open for discussions on this. Even if my implementation may involve duplicating SOME code of the library, my goal is I wouldn't have to duplicate everything or to intrusively modify it to do what I want and I could see other usecases for this where one might want to add comments over lines of interests, but for me specifically, I am looking to add the IL as comments. Currently, the GUI application only allows me to export all the code in one file which isn't practical if I could leverage the project exporter feature.

My one requirement is it should be possible to do with the nuget package as I find it the most modular way to use ILSpy which I need for other reasons.

@aldelaro5 aldelaro5 added the Enhancement Areas for improvement label Jun 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement Areas for improvement
Projects
None yet
Development

No branches or pull requests

1 participant