Browse Source

Make ICSharpCode.Decompiler.Console a dotnet tool.

pull/1420/head
Siegfried Pammer 7 years ago
parent
commit
bd829882fb
  1. 10
      ICSharpCode.Decompiler.Console/ICSharpCode.Decompiler.Console.csproj
  2. 7
      ICSharpCode.Decompiler.Console/Program.cs

10
ICSharpCode.Decompiler.Console/ICSharpCode.Decompiler.Console.csproj

@ -1,10 +1,12 @@ @@ -1,10 +1,12 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp2.0</TargetFramework>
<RuntimeIdentifiers>win10-x64;osx-x64;linux-x64</RuntimeIdentifiers>
<TargetFramework>netcoreapp2.1</TargetFramework>
<IsPackable>true</IsPackable>
<PackAsTool>true</PackAsTool>
<AssemblyName>ilspycmd</AssemblyName>
<ToolCommandName>ilspycmd</ToolCommandName>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
@ -14,7 +16,7 @@ @@ -14,7 +16,7 @@
<ItemGroup>
<PackageReference Include="McMaster.Extensions.CommandLineUtils" Version="2.2.0" />
<PackageReference Include="ICSharpCode.Decompiler" Version="3.1.0.3652" />
<PackageReference Include="ICSharpCode.Decompiler" Version="4.0.0.4201-alpha1" />
<PackageReference Include="System.IO.FileSystem.Primitives" Version="4.3.0" />
<PackageReference Include="System.Runtime.Handles" Version="4.3.0" />

7
ICSharpCode.Decompiler.Console/Program.cs

@ -5,7 +5,7 @@ using System.Linq; @@ -5,7 +5,7 @@ using System.Linq;
using McMaster.Extensions.CommandLineUtils;
using ICSharpCode.Decompiler.CSharp;
using ICSharpCode.Decompiler.TypeSystem;
using Mono.Cecil;
using ICSharpCode.Decompiler.Metadata;
namespace ICSharpCode.Decompiler.Console
{
@ -84,7 +84,7 @@ namespace ICSharpCode.Decompiler.Console @@ -84,7 +84,7 @@ namespace ICSharpCode.Decompiler.Console
{
CSharpDecompiler decompiler = GetDecompiler(assemblyFileName);
foreach (var type in decompiler.TypeSystem.Compilation.MainAssembly.GetAllTypeDefinitions()) {
foreach (var type in decompiler.TypeSystem.MainModule.TypeDefinitions) {
if (!kinds.Contains(type.Kind))
continue;
output.WriteLine($"{type.Kind} {type.FullName}");
@ -93,9 +93,8 @@ namespace ICSharpCode.Decompiler.Console @@ -93,9 +93,8 @@ namespace ICSharpCode.Decompiler.Console
static void DecompileAsProject(string assemblyFileName, string outputDirectory)
{
ModuleDefinition module = UniversalAssemblyResolver.LoadMainModule(assemblyFileName);
WholeProjectDecompiler decompiler = new WholeProjectDecompiler();
decompiler.DecompileProject(module, outputDirectory);
decompiler.DecompileProject(new PEFile(assemblyFileName), outputDirectory);
}
static void Decompile(string assemblyFileName, TextWriter output, string typeName = null)

Loading…
Cancel
Save