|
|
@ -6,7 +6,7 @@ platforms: |
|
|
|
- DotNetCore |
|
|
|
- DotNetCore |
|
|
|
packages: |
|
|
|
packages: |
|
|
|
- id: ICSharpCode.Decompiler |
|
|
|
- id: ICSharpCode.Decompiler |
|
|
|
version: 4.0.0.4319-beta2 |
|
|
|
version: 4.0.0.4443-beta3 |
|
|
|
--- |
|
|
|
--- |
|
|
|
|
|
|
|
|
|
|
|
Setup: load the references required to work with the decompiler |
|
|
|
Setup: load the references required to work with the decompiler |
|
|
@ -29,7 +29,7 @@ You must have compiled **frontends.sln** first (run “dotnet build” in ICShar |
|
|
|
|
|
|
|
|
|
|
|
```csharp |
|
|
|
```csharp |
|
|
|
string workbookBasePath = System.IO.Directory.GetCurrentDirectory(); |
|
|
|
string workbookBasePath = System.IO.Directory.GetCurrentDirectory(); |
|
|
|
string fileName = System.IO.Path.Combine(workbookBasePath, "ICSharpCode.Decompiler.PowerShell", "bin", "Debug", "netstandard2.0", "ICSharpCode.Decompiler.dll"); |
|
|
|
string fileName = System.IO.Path.Combine(workbookBasePath, "ICSharpCode.Decompiler.PowerShell", "bin", "Release", "netstandard2.0", "ICSharpCode.Decompiler.dll"); |
|
|
|
var decompiler = new CSharpDecompiler(fileName, new DecompilerSettings()); |
|
|
|
var decompiler = new CSharpDecompiler(fileName, new DecompilerSettings()); |
|
|
|
``` |
|
|
|
``` |
|
|
|
|
|
|
|
|
|
|
@ -48,12 +48,12 @@ var nameOfGenericType = new FullTypeName("ICSharpCode.Decompiler.Util.Empty`1"); |
|
|
|
Console.WriteLine(decompiler.DecompileTypeAsString(nameOfGenericType)); |
|
|
|
Console.WriteLine(decompiler.DecompileTypeAsString(nameOfGenericType)); |
|
|
|
``` |
|
|
|
``` |
|
|
|
|
|
|
|
|
|
|
|
If you want to decompile one single member (sample: first property) |
|
|
|
If you want to decompile one single member (sample: first method) |
|
|
|
|
|
|
|
|
|
|
|
```csharp |
|
|
|
```csharp |
|
|
|
var nameOfUniResolver = new FullTypeName("ICSharpCode.Decompiler.UniversalAssemblyResolver"); |
|
|
|
var nameOfUniResolver = new FullTypeName("ICSharpCode.Decompiler.Metadata.UniversalAssemblyResolver"); |
|
|
|
ITypeDefinition typeInfo = decompiler.TypeSystem.FindType(nameOfUniResolver).GetDefinition(); |
|
|
|
ITypeDefinition typeInfo = decompiler.TypeSystem.FindType(nameOfUniResolver).GetDefinition(); |
|
|
|
var tokenOfFirstProperty = typeInfo.Properties.First().MetadataToken; |
|
|
|
var tokenOfFirstProperty = typeInfo.Methods.First().MetadataToken; |
|
|
|
Console.WriteLine(decompiler.DecompileAsString(tokenOfFirstProperty)); |
|
|
|
Console.WriteLine(decompiler.DecompileAsString(tokenOfFirstProperty)); |
|
|
|
``` |
|
|
|
``` |
|
|
|
|
|
|
|
|
|
|
|