Skip to content

Mod Creation_C# Programming_Code Analysis

Quentin E. / iDeath edited this page Jul 1, 2022 · 2 revisions

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

Latest Release

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: Opened DLL

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. Namespace hierarchy

You can search for specific variables, methods, and types by using the "Search Assemblies" function. Search Assemblies

You can also search for references to a specific property/field by using the Analyse function. Reference property Reference propert2

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 Edit method

You can then view the corresponding IL code to your modified method IL viewer If you use ILSpy, you need to switch to IL view here ILSpy IL View

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.

Clone this wiki locally