-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathDotNetInspectorPluginExt.cs
More file actions
46 lines (37 loc) · 983 Bytes
/
DotNetInspectorPluginExt.cs
File metadata and controls
46 lines (37 loc) · 983 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
using System;
using System.Drawing;
using System.Linq;
using System.Windows.Forms;
using ReClassNET.Plugins;
namespace DotNetInspectorPlugin
{
public class DotNetInspectorPluginExt : Plugin
{
private IPluginHost host;
public override Image Icon => Properties.Resources.logo;
public override bool Initialize(IPluginHost pluginHost)
{
System.Diagnostics.Debugger.Launch();
if (host != null)
{
Terminate();
}
host = pluginHost ?? throw new ArgumentNullException(nameof(pluginHost));
var menuItem = host.MainWindow.MainMenu.Items.OfType<ToolStripMenuItem>().FirstOrDefault(i => i.Text == "Process");
if (menuItem != null)
{
var showInspectorItem = new ToolStripMenuItem
{
Text = ".NET Inspector"
};
showInspectorItem.Click += (s, e) => new InspectorForm(host.Process).Show();
menuItem.DropDownItems.Add(showInspectorItem);
}
return true;
}
public override void Terminate()
{
host = null;
}
}
}