The number one request currently on the JustDecompile UserVoice is to “add an API for plugins,” and we take user demands seriously! If you have the new version of JustDecompile, you may have noticed a rather interesting main menu item (if you need to update, check out the brand new Telerik Control Panel).
You may find that your menu only has the Plugins Manager, which means you need to install a plugin! You can do this by going to the Plugins Manager. At this time, the manager displays a list of installed plugins and gives you a button to obtain new one. Manual intervention is required for this; look for the plugin installation story to be improved in upcoming releases.
Clicking the Get Plugins button in the Plugins Manager will take you to our extensions page where you can download plugins we have published. At this time, there is only one available, but more are coming. To install a plugin, click the download button on the page.
This will download a zip file containing the plugin. It also contains a readme with instructions on installing the plugins.
The plugin is contained in a folder with the zip file. Simply extract the entire folders (not just the contents) to the Plugins folder under your JustDecompile installation folder. Mine is located at c:\Program Files (x86)\Telerik\JustDecompile\Libraries\Plugins. If you have a different Program Files folder, or you changed the installation path of JustDecompile, it may be in a different location.
After you’re finished extracting the folder to the appropriate location, start JustDecompile and you will find your new plugin listed in the Plugins menu or Plugins Manager depending on the type of plugin installed.
The first plugin we ported to JustDecompile is Reflexil, a well-known assembly editor by Sébastien LEBRETON. It enhances JustDecompile by providing IL manipulation, c# code injection, a resource editor, and the ability to remove strong naming. This package also includes the De4Dot deobfuscator, so you’re really getting two plugins in one package!
To get started, simply click the Reflexil menu option under Plugins. A new panel will open beneath the code viewer, providing you with an easy to use interface to modify assemblies.
With an assembly selected in the JustDecompile assembly browser, you can use Reflexil to change which method is the entry point (not that you’d need one in a class library):
You can change the definition of the assembly name including the culture, version, and public key. You can also remove a strong name from a signed assembly:
And you can modify the assembly’s custom attributes:
Selecting a type in the assembly browser provides even more details that you can modify.
Have you ever had a type in a 3rd party assembly that you wish was marked with as Serializable? Make the change yourself:
And we’ve all experienced this: a type implicitly has an interface, but it isn’t explicitly declared. You can now easily apply the interface:
Selecting a method will enable you to modify the IL instructions, add or remove variables and parameters,and much more.
And the coolest option of all is Replace all with code… clicking this will open a code editor with IntelliSense support. Make sure you click the Compile button when you’re finished making your changes.
You can also inject new types, references, or resources through the context menu in the assembly explorer.
The most important thing on this menu is Save as. To be safe, Reflexil doesn’t modify your assemblies on the disk. You will need to save a new copy and deploy it yourself. I recommend testing it for correctness beforehand.
The plugin feature is brand new for JustDecompile Q2 2012, and we will be making many improvements. The API currently exists, and you can create your own plugins by looking at how we did it in the Reflexil source code. Since Reflexil is licensed under the GPL, you may wish to look at the assembly using JustDecompile if you want to use a non-compatible license for your plugin. We are currently making changes to the API for general public consumption, and when we’re finished we will release documentation and samples to get you started.
If you’re interested in seeing specific plugins, please leave a comment! And remember: with great power comes great responsibility. Use JustDecompile responsibly.
Chris Eargle is a Microsoft C# MVP with over a decade of experience designing and developing enterprise applications, and he runs the local .NET User Group: the Columbia Enterprise Developers Guild. He is a frequent guest of conferences and community events promoting best practices and new technologies. Chris is a native Carolinian; his family settled the Dutch Form region of South Carolina in 1752. He currently resides in Columbia with his wife, Binyue, his dog, Laika, and his three cats: Meeko, Tigger, and Sookie. Amazingly, they all get along... except for Meeko, who is by no means meek.