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

Modify and reassemble BAML files #324

Open
adryd325 opened this issue May 9, 2024 · 3 comments
Open

Modify and reassemble BAML files #324

adryd325 opened this issue May 9, 2024 · 3 comments
Labels
enhancement New feature or request

Comments

@adryd325
Copy link

adryd325 commented May 9, 2024

Problem Description

It's very difficult to modify BAML files. At the moment I export the raw BAML, edit in a hex editor, and then re-add to the resource bundle.

Proposal

A built in way to modify or re-assemble the BAML assembly generated by dnSpy would solve this problem and make editing BAML much more accessible

Alternatives

No response

Additional Context

To clarify, this is not to hoping to compile the decompiled XAML output, this is to reassemble the disassembled BAML dnSpy offers. I figure compiling the decompiled XAML output might not be possible

Additionally, if anyone has any other suggestions on editing compiled BAML, those suggestions would be much appreciated

@adryd325 adryd325 added the enhancement New feature or request label May 9, 2024
@adryd325
Copy link
Author

adryd325 commented May 9, 2024

Another note: I've found some super basic tools taking advantage of ConfuserEx's BAML implementation

@ElektroKill
Copy link
Member

Hello,

Editing the BAML record structure is definitely a feature I will consider. The major roadblock here would be designing an appropriate UX for this. If you have any suggestions for this, feel free to share! The actual part of writing BAML is already incorporated in the BAML decompiler component.

Another note: I've found some super basic tools taking advantage of ConfuserEx's BAML implementation

dnSpy's BAML reader/writer implementation is a modified version of the ConfuserEx implementation. It can be found here: https://github.com/dnSpyEx/dnSpy/tree/master/Extensions/dnSpy.BamlDecompiler/Baml

I figure compiling the decompiled XAML output might not be possible

Yep, this is not something that can be done in a 100% reliable way.

@adryd325
Copy link
Author

The way I had gone about doing my edits was adding a toJson and fromJson method to each of the record types, and exporting to an intermediary file. It's definitely not optimal but it did the trick for one of the things I wanted to do.

Something that would resolve references would be nice. Also incrementing values that need to be incremented when adding elements automatically would be nice.

Otherwise I'm not super familiar with BAML/XAML and wouldn't be able to give that many pointers

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants