Browse Source

Update frontends for rc1

pull/2350/head
Christoph Wille 4 years ago
parent
commit
5d92132aa5
  1. 2
      DecompilerNuGetDemos.workbook
  2. 4
      ICSharpCode.Decompiler.Console/ICSharpCode.Decompiler.Console.csproj
  3. 2
      ICSharpCode.Decompiler.PowerShell/ICSharpCode.Decompiler.PowerShell.csproj
  4. 160
      decompiler-nuget-demos.ipynb

2
DecompilerNuGetDemos.workbook

@ -6,7 +6,7 @@ platforms:
- DotNetCore - DotNetCore
packages: packages:
- id: ICSharpCode.Decompiler - id: ICSharpCode.Decompiler
version: 7.0.0.6372-preview3 version: 7.0.0.6472-rc1
--- ---
Setup: load the references required to work with the decompiler Setup: load the references required to work with the decompiler

4
ICSharpCode.Decompiler.Console/ICSharpCode.Decompiler.Console.csproj

@ -9,7 +9,7 @@
<PackAsTool>true</PackAsTool> <PackAsTool>true</PackAsTool>
<AssemblyName>ilspycmd</AssemblyName> <AssemblyName>ilspycmd</AssemblyName>
<ToolCommandName>ilspycmd</ToolCommandName> <ToolCommandName>ilspycmd</ToolCommandName>
<Version>7.0.0.6372-preview3</Version> <Version>7.0.0.6472-rc1</Version>
<Description>Command-line decompiler using the ILSpy decompilation engine</Description> <Description>Command-line decompiler using the ILSpy decompilation engine</Description>
<Copyright>Copyright 2011-2021 AlphaSierraPapa</Copyright> <Copyright>Copyright 2011-2021 AlphaSierraPapa</Copyright>
<PackageProjectUrl>https://github.com/icsharpcode/ILSpy/</PackageProjectUrl> <PackageProjectUrl>https://github.com/icsharpcode/ILSpy/</PackageProjectUrl>
@ -45,7 +45,7 @@
</ItemGroup> </ItemGroup>
<ItemGroup Condition="'$(Configuration)' == 'Release'"> <ItemGroup Condition="'$(Configuration)' == 'Release'">
<PackageReference Include="ICSharpCode.Decompiler" Version="7.0.0.6372-preview3" /> <PackageReference Include="ICSharpCode.Decompiler" Version="7.0.0.6472-rc1" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

2
ICSharpCode.Decompiler.PowerShell/ICSharpCode.Decompiler.PowerShell.csproj

@ -19,7 +19,7 @@
</ItemGroup> </ItemGroup>
<ItemGroup Condition="'$(Configuration)' == 'Release'"> <ItemGroup Condition="'$(Configuration)' == 'Release'">
<PackageReference Include="ICSharpCode.Decompiler" Version="7.0.0.6372-preview3" /> <PackageReference Include="ICSharpCode.Decompiler" Version="7.0.0.6472-rc1" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

160
decompiler-nuget-demos.ipynb

@ -9,14 +9,28 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 1, "execution_count": null,
"metadata": { "metadata": {
"dotnet_interactive": { "dotnet_interactive": {
"language": "csharp" "language": "csharp"
} }
}, },
"outputs": [
{
"data": {
"text/plain": "Installed package ICSharpCode.Decompiler version 7.0.0.6472-rc1"
},
"output_type": "unknown"
},
{
"data": {
"text/plain": "ICSharpCode.Decompiler, Version=7.0.0.6472, Culture=neutral, PublicKeyToken=d4bfe873e7598c49\r\n"
},
"output_type": "unknown"
}
],
"source": [ "source": [
"#r \"nuget: ICSharpCode.Decompiler, 7.0.0.6372-preview3\"\n", "#r \"nuget: ICSharpCode.Decompiler, 7.0.0.6472-rc1\"\n",
"\n", "\n",
"using System.Reflection.Metadata;\n", "using System.Reflection.Metadata;\n",
"using ICSharpCode.Decompiler;\n", "using ICSharpCode.Decompiler;\n",
@ -25,16 +39,6 @@
"using ICSharpCode.Decompiler.TypeSystem;\n", "using ICSharpCode.Decompiler.TypeSystem;\n",
"\n", "\n",
"Console.WriteLine(typeof(FullTypeName).Assembly.GetName());" "Console.WriteLine(typeof(FullTypeName).Assembly.GetName());"
],
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": "ICSharpCode.Decompiler, Version=7.0.0.6372, Culture=neutral, PublicKeyToken=d4bfe873e7598c49\r\n"
},
"execution_count": 1,
"metadata": {}
}
] ]
}, },
{ {
@ -46,19 +50,19 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 1, "execution_count": null,
"metadata": { "metadata": {
"dotnet_interactive": { "dotnet_interactive": {
"language": "csharp" "language": "csharp"
} }
}, },
"outputs": [],
"source": [ "source": [
"const string basePath = @\"D:\\GitWorkspace\\ILSpy\\\";\n", "const string basePath = @\"D:\\GitWorkspace\\ILSpy\\\";\n",
"string testAssemblyPath = basePath + @\"ICSharpCode.Decompiler.PowerShell\\bin\\Release\\netstandard2.0\\ICSharpCode.Decompiler.dll\";\n", "string testAssemblyPath = basePath + @\"ICSharpCode.Decompiler.PowerShell\\bin\\Release\\netstandard2.0\\ICSharpCode.Decompiler.dll\";\n",
"\n", "\n",
"var decompiler = new CSharpDecompiler(testAssemblyPath, new DecompilerSettings());" "var decompiler = new CSharpDecompiler(testAssemblyPath, new DecompilerSettings());"
], ]
"outputs": []
}, },
{ {
"cell_type": "markdown", "cell_type": "markdown",
@ -69,25 +73,23 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 1, "execution_count": null,
"metadata": { "metadata": {
"dotnet_interactive": { "dotnet_interactive": {
"language": "csharp" "language": "csharp"
} }
}, },
"source": [
"var types = decompiler.TypeSystem.MainModule.TypeDefinitions;\n",
"Console.WriteLine(types.Count());"
],
"outputs": [ "outputs": [
{ {
"output_type": "execute_result",
"data": { "data": {
"text/plain": "1459\r\n" "text/plain": "1461\r\n"
}, },
"execution_count": 1, "output_type": "unknown"
"metadata": {}
} }
],
"source": [
"var types = decompiler.TypeSystem.MainModule.TypeDefinitions;\n",
"Console.WriteLine(types.Count());"
] ]
}, },
{ {
@ -99,26 +101,24 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 1, "execution_count": null,
"metadata": { "metadata": {
"dotnet_interactive": { "dotnet_interactive": {
"language": "csharp" "language": "csharp"
} }
}, },
"source": [
"// ICSharpCode.Decompiler.Util.Empty<T> -> translates to `n, where n is the # of generic parameters\n",
"var nameOfGenericType = new FullTypeName(\"ICSharpCode.Decompiler.Util.Empty`1\");\n",
"Console.WriteLine(decompiler.DecompileTypeAsString(nameOfGenericType));"
],
"outputs": [ "outputs": [
{ {
"output_type": "execute_result",
"data": { "data": {
"text/plain": "using System;\r\n\r\nnamespace ICSharpCode.Decompiler.Util\r\n{\r\n\tpublic static class Empty<T>\r\n\t{\r\n\t\tpublic static readonly T[] Array = System.Array.Empty<T>();\r\n\t}\r\n}\r\n\r\n" "text/plain": "using System;\r\n\r\nnamespace ICSharpCode.Decompiler.Util\r\n{\r\n\tpublic static class Empty<T>\r\n\t{\r\n\t\tpublic static readonly T[] Array = System.Array.Empty<T>();\r\n\t}\r\n}\r\n\r\n"
}, },
"execution_count": 1, "output_type": "unknown"
"metadata": {}
} }
],
"source": [
"// ICSharpCode.Decompiler.Util.Empty<T> -> translates to `n, where n is the # of generic parameters\n",
"var nameOfGenericType = new FullTypeName(\"ICSharpCode.Decompiler.Util.Empty`1\");\n",
"Console.WriteLine(decompiler.DecompileTypeAsString(nameOfGenericType));"
] ]
}, },
{ {
@ -130,27 +130,25 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 1, "execution_count": null,
"metadata": { "metadata": {
"dotnet_interactive": { "dotnet_interactive": {
"language": "csharp" "language": "csharp"
} }
}, },
"source": [
"var nameOfUniResolver = new FullTypeName(\"ICSharpCode.Decompiler.Metadata.UniversalAssemblyResolver\");\n",
"ITypeDefinition typeInfo = decompiler.TypeSystem.FindType(nameOfUniResolver).GetDefinition();\n",
"var tokenOfFirstMethod = typeInfo.Methods.First().MetadataToken;\n",
"Console.WriteLine(decompiler.DecompileAsString(tokenOfFirstMethod));"
],
"outputs": [ "outputs": [
{ {
"output_type": "execute_result",
"data": { "data": {
"text/plain": "using System;\r\n\r\nstatic UniversalAssemblyResolver()\r\n{\r\n\tgac_paths = GetGacPaths();\r\n\tZeroVersion = new Version(0, 0, 0, 0);\r\n\tif (Type.GetType(\"Mono.Runtime\") != null)\r\n\t{\r\n\t\tdecompilerRuntime = DecompilerRuntime.Mono;\r\n\t}\r\n\telse if (typeof(object).Assembly.GetName().Name == \"System.Private.CoreLib\")\r\n\t{\r\n\t\tdecompilerRuntime = DecompilerRuntime.NETCoreApp;\r\n\t}\r\n\telse if (Environment.OSVersion.Platform == PlatformID.Unix)\r\n\t{\r\n\t\tdecompilerRuntime = DecompilerRuntime.Mono;\r\n\t}\r\n}\r\n\r\n" "text/plain": "using System;\r\n\r\nstatic UniversalAssemblyResolver()\r\n{\r\n\tgac_paths = GetGacPaths();\r\n\tZeroVersion = new Version(0, 0, 0, 0);\r\n\tif (Type.GetType(\"Mono.Runtime\") != null)\r\n\t{\r\n\t\tdecompilerRuntime = DecompilerRuntime.Mono;\r\n\t}\r\n\telse if (typeof(object).Assembly.GetName().Name == \"System.Private.CoreLib\")\r\n\t{\r\n\t\tdecompilerRuntime = DecompilerRuntime.NETCoreApp;\r\n\t}\r\n\telse if (Environment.OSVersion.Platform == PlatformID.Unix)\r\n\t{\r\n\t\tdecompilerRuntime = DecompilerRuntime.Mono;\r\n\t}\r\n}\r\n\r\n"
}, },
"execution_count": 1, "output_type": "unknown"
"metadata": {}
} }
],
"source": [
"var nameOfUniResolver = new FullTypeName(\"ICSharpCode.Decompiler.Metadata.UniversalAssemblyResolver\");\n",
"ITypeDefinition typeInfo = decompiler.TypeSystem.FindType(nameOfUniResolver).GetDefinition();\n",
"var tokenOfFirstMethod = typeInfo.Methods.First().MetadataToken;\n",
"Console.WriteLine(decompiler.DecompileAsString(tokenOfFirstMethod));"
] ]
}, },
{ {
@ -162,17 +160,17 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 1, "execution_count": null,
"metadata": { "metadata": {
"dotnet_interactive": { "dotnet_interactive": {
"language": "csharp" "language": "csharp"
} }
}, },
"outputs": [],
"source": [ "source": [
"ITypeDefinition type = decompiler.TypeSystem.FindType(nameOfUniResolver).GetDefinition();\n", "ITypeDefinition type = decompiler.TypeSystem.FindType(nameOfUniResolver).GetDefinition();\n",
"var module = type.ParentModule.PEFile;" "var module = type.ParentModule.PEFile;"
], ]
"outputs": []
}, },
{ {
"cell_type": "markdown", "cell_type": "markdown",
@ -183,89 +181,71 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 1, "execution_count": null,
"metadata": { "metadata": {
"dotnet_interactive": { "dotnet_interactive": {
"language": "csharp" "language": "csharp"
} }
}, },
"source": [
"var icsdns = decompiler.TypeSystem.RootNamespace;\n",
"foreach (var cn in icsdns.ChildNamespaces) Console.WriteLine(cn.FullName);"
],
"outputs": [ "outputs": [
{ {
"output_type": "execute_result",
"data": { "data": {
"text/plain": "Microsoft\r\n" "text/plain": "Microsoft\r\n"
}, },
"execution_count": 1, "output_type": "unknown"
"metadata": {}
}, },
{ {
"output_type": "execute_result",
"data": { "data": {
"text/plain": "System\r\n" "text/plain": "System\r\n"
}, },
"execution_count": 1, "output_type": "unknown"
"metadata": {}
}, },
{ {
"output_type": "execute_result",
"data": { "data": {
"text/plain": "LightJson\r\n" "text/plain": "LightJson\r\n"
}, },
"execution_count": 1, "output_type": "unknown"
"metadata": {}
}, },
{ {
"output_type": "execute_result",
"data": { "data": {
"text/plain": "Humanizer\r\n" "text/plain": "Humanizer\r\n"
}, },
"execution_count": 1, "output_type": "unknown"
"metadata": {}
}, },
{ {
"output_type": "execute_result",
"data": { "data": {
"text/plain": "ICSharpCode\r\n" "text/plain": "ICSharpCode\r\n"
}, },
"execution_count": 1, "output_type": "unknown"
"metadata": {}
}, },
{ {
"output_type": "execute_result",
"data": { "data": {
"text/plain": "FxResources\r\n" "text/plain": "FxResources\r\n"
}, },
"execution_count": 1, "output_type": "unknown"
"metadata": {}
}, },
{ {
"output_type": "execute_result",
"data": { "data": {
"text/plain": "Internal\r\n" "text/plain": "Internal\r\n"
}, },
"execution_count": 1, "output_type": "unknown"
"metadata": {}
}, },
{ {
"output_type": "execute_result",
"data": { "data": {
"text/plain": "Windows\r\n" "text/plain": "Windows\r\n"
}, },
"execution_count": 1, "output_type": "unknown"
"metadata": {}
}, },
{ {
"output_type": "execute_result",
"data": { "data": {
"text/plain": "MS\r\n" "text/plain": "MS\r\n"
}, },
"execution_count": 1, "output_type": "unknown"
"metadata": {}
} }
],
"source": [
"var icsdns = decompiler.TypeSystem.RootNamespace;\n",
"foreach (var cn in icsdns.ChildNamespaces) Console.WriteLine(cn.FullName);"
] ]
}, },
{ {
@ -277,39 +257,35 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 1, "execution_count": null,
"metadata": { "metadata": {
"dotnet_interactive": { "dotnet_interactive": {
"language": "csharp" "language": "csharp"
} }
}, },
"source": [
"var typesInNamespace = icsdns.ChildNamespaces.First(cn => cn.FullName == \"LightJson\").Types;\n",
"Console.WriteLine(typesInNamespace.First().FullTypeName);"
],
"outputs": [ "outputs": [
{ {
"output_type": "execute_result",
"data": { "data": {
"text/plain": "LightJson.JsonArray\r\n" "text/plain": "LightJson.JsonArray\r\n"
}, },
"execution_count": 1, "output_type": "unknown"
"metadata": {}
} }
],
"source": [
"var typesInNamespace = icsdns.ChildNamespaces.First(cn => cn.FullName == \"LightJson\").Types;\n",
"Console.WriteLine(typesInNamespace.First().FullTypeName);"
] ]
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 1, "execution_count": null,
"metadata": { "metadata": {
"dotnet_interactive": { "dotnet_interactive": {
"language": "csharp" "language": "csharp"
} }
}, },
"source": [ "outputs": [],
"" "source": []
],
"outputs": []
} }
], ],
"metadata": { "metadata": {
@ -321,7 +297,7 @@
"language_info": { "language_info": {
"file_extension": ".cs", "file_extension": ".cs",
"mimetype": "text/x-csharp", "mimetype": "text/x-csharp",
"name": "C#", "name": "csharp",
"pygments_lexer": "csharp", "pygments_lexer": "csharp",
"version": "8.0" "version": "8.0"
} }

Loading…
Cancel
Save