Mod Creation_C# Programming_Code Analysis - risk-of-thunder/R2Wiki GitHub Wiki
Code Analysis
SLIGHTLY OUT OF DATE, ILSPY IS LARGELY PREFERRED TO DNSPY DUE TO BETTER DECOMPILATION QUALITY
https://github.com/icsharpcode/ILSpy/releases/
For linux users, take the avalonia version : https://github.com/icsharpcode/AvaloniaILSpy/releases
Guide
dnSpy is a debugger and .NET assembly editor. You can use it to edit and debug assemblies even if you don't have any source code available.
Getting to grips with DnSpy
Extract & open DnSpy.exe from the downloaded archive and then hit File->Open->Select \Risk of Rain 2\Risk of Rain 2_Data\Managed\RoR2.dll. You should be presented with something like this:
You can explore the Namespace hierarchy in the left pane. For instance we can take a look through the RoR2.Run class by selecting it in the left pane.
You can search for specific variables, methods, and types by using the "Search Assemblies" function.
You can also search for references to a specific property/field by using the Analyse function.
It is possible to edit the method that you are viewing, which can be useful for generating the correct IL code within the current context
You can then view the corresponding IL code to your modified method
If you use ILSpy, you need to switch to IL view here
With only the functions listed above, it becomes relatively easy to start to understand the codebase that you are working with, and to decide upon a course of action how you intend to accomplish a certain task.