Decompiled code can be useful for things like:
Game assemblies are located at /Dinkum/Dinkum_Data/Managed/ folder.
Most of the core code is located at
Assembly-CSharp
Before you start, make sure to do steps from here.
Most of the time you will need to use Unity or game classes in your code, to do that, you'll need to reference assemblies you need in .csproj
.
<Project Sdk="Microsoft.NET.Sdk">
<!-- other item groups -->
<ItemGroup>
<!-- File name -->
<Reference Include="Assembly-CSharp-nstrip">
<!-- Relative path to the dll -->
<HintPath>../lib/strip/Assembly-CSharp-nstrip.dll</HintPath>
</Reference>
<Reference Include="Mirror-nstrip">
<HintPath>../lib/dinkum/strip/Mirror-nstrip.dll</HintPath>
</Reference>
<!-- Other assembly references -->
</ItemGroup>
</Project>
Now when you want to use something from the game or Unity, you can just write the name of a class or a method and your IDE should automaticaly import the right thing.
Assemblies
tabOpen
or Explore Folder
Managed
Open
, just select a singe .dll
fileExplore Folder
, select Managed
folderBetter do this instead of using
Managed
folder:
1. Make alib
folder in the base of your project(same folder as.sln
file)
2. Copy all assemblies you need into/lib/not_stripped/
3. Use something like NStrip to publicize and strip them, move publicized DLLs into/lib/strip/
folder
4. Do the same steps as above, except you chooseExplore Folder
and selectlib
folder you created.
To open an assembly, simply press an arrow button that will open a list of namespaces(<Root Namespace>, Aevus, Mirror, etc.). For base assembly you will need to open a <Root Namespace>
to see its classes and their respective methods, fields. Now you can open classes and see where each class/method is used, like you would with your code(Alt + F7 if you use intellij idea keybind)
need someone using VS for this part
For this guide dnSpy will be used.
Most of the time external decompiler is used to view IL code of a method when writing a transpiler
File, Edit, View, Debug, Window, Help
, locate a drop down menu saying C#
and choose IL