Skip to content

Commit

Permalink
Merge pull request #195 from spouliot/decompile-from-explorer
Browse files Browse the repository at this point in the history
  • Loading branch information
Rpinski authored May 19, 2023
2 parents 1a211ac + 8034201 commit 55dd7af
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 0 deletions.
12 changes: 12 additions & 0 deletions vscode-extension/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,11 @@
}
],
"commands": [
{
"command": "ilspy.decompileSelectedAssembly",
"title": "Decompile selected assembly",
"category": "ILSpy"
},
{
"command": "ilspy.decompileAssemblyInWorkspace",
"title": "Add assembly from workspace",
Expand Down Expand Up @@ -111,6 +116,13 @@
}
],
"menus": {
"explorer/context": [
{
"command": "ilspy.decompileSelectedAssembly",
"group": "navigation",
"when": "resourceExtname == .dll || resourceExtname == .exe || resourceExtname == .winmd || resourceExtname == .netmodule"
}
],
"view/title": [
{
"command": "ilspy.decompileAssemblyInWorkspace",
Expand Down
22 changes: 22 additions & 0 deletions vscode-extension/src/commands/decompileSelectedAssembly.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import * as vscode from "vscode";
import { DecompiledTreeProvider } from "../decompiler/DecompiledTreeProvider";
import { addAssemblyToTree } from "./utils";
import { MemberNode } from "../decompiler/MemberNode";

export function registerDecompileSelectedAssembly(
decompiledTreeProvider: DecompiledTreeProvider,
decompiledTreeView: vscode.TreeView<MemberNode>
) {
return vscode.commands.registerCommand(
"ilspy.decompileSelectedAssembly",
async (file) => {
if (file) {
await addAssemblyToTree(
file.path,
decompiledTreeProvider,
decompiledTreeView
);
}
}
);
}
4 changes: 4 additions & 0 deletions vscode-extension/src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import ILSpyBackend from "./decompiler/ILSpyBackend";
import { DecompiledTreeProvider } from "./decompiler/DecompiledTreeProvider";
import { registerDecompileAssemblyInWorkspace } from "./commands/decompileAssemblyInWorkspace";
import { registerDecompileAssemblyViaDialog } from "./commands/decompileAssemblyViaDialog";
import { registerDecompileSelectedAssembly } from "./commands/decompileSelectedAssembly";
import { registerReloadAssembly } from "./commands/reloadAssembly";
import { registerUnloadAssembly } from "./commands/unloadAssembly";
import { acquireDotnetRuntime } from "./dotnet-acquire/acquire";
Expand Down Expand Up @@ -108,6 +109,9 @@ export async function activate(context: ExtensionContext) {
disposables.push(
registerDecompileAssemblyViaDialog(decompileTreeProvider, decompileTreeView)
);
disposables.push(
registerDecompileSelectedAssembly(decompileTreeProvider, decompileTreeView)
);

const decompilerTextDocumentContentProvider =
new DecompilerTextDocumentContentProvider(ilspyBackend);
Expand Down

0 comments on commit 55dd7af

Please sign in to comment.