Browse Source

fix #528: Open Build Output in ILSpy

fix #504: Collapse group in Visual Studio context menu
pull/550/head
Siegfried Pammer 11 years ago
parent
commit
2fc8bf7003
  1. 45
      ILSpy.AddIn/ILSpyAddIn.vsct
  2. 30
      ILSpy.AddIn/ILSpyAddInPackage.cs
  3. 4
      ILSpy.AddIn/PkgCmdID.cs
  4. BIN
      ILSpy.AddIn/Resources/Images.png

45
ILSpy.AddIn/ILSpyAddIn.vsct

@ -40,13 +40,13 @@ @@ -40,13 +40,13 @@
group as the part of a menu contained between two lines. The parent of a group
must be a menu. -->
<Groups>
<Group guid="guidILSpyAddInCmdSet" id="ILSpyAddInGroup" priority="0x0200">
<Parent guid="guidSHLMainMenu" id="IDM_VS_CTXT_REFERENCE"/>
</Group>
<Group guid="guidILSpyAddInCmdSet" id="OpenILSpyGroup" priority="0x0200">
<Parent guid="guidSHLMainMenu" id="IDM_VS_MENU_TOOLS"/>
</Group>
<Group guid="guidILSpyAddInCmdSet" id="OpenILSpyProjGroup" priority="0x0200">
<Parent guid="guidSHLMainMenu" id="IDM_VS_CTXT_PROJNODE"/>
</Group>
</Groups>
<!--Buttons section. -->
@ -61,16 +61,25 @@ @@ -61,16 +61,25 @@
<CommandFlag>DynamicVisibility</CommandFlag>
If you do not want an image next to your command, remove the Icon node /> -->
<Button guid="guidILSpyAddInCmdSet" id="cmdidOpenInILSpy" priority="0x0600" type="Button">
<Parent guid="guidILSpyAddInCmdSet" id="ILSpyAddInGroup" />
<Icon guid="guidImages" id="bmpPicSearch" />
<Button guid="guidILSpyAddInCmdSet" id="cmdidOpenReferenceInILSpy" priority="0x0600" type="Button">
<Parent guid="guidILSpyAddInCmdSet" id="OpenILSpyRefGroup" />
<Icon guid="guidImages" id="bmpLogo" />
<Strings>
<ButtonText>Open in ILSpy</ButtonText>
</Strings>
</Button>
<Button guid="guidILSpyAddInCmdSet" id="cmdidOpenProjectOutputInILSpy" priority="0x0600" type="Button">
<Parent guid="guidILSpyAddInCmdSet" id="OpenILSpyProjGroup" />
<Icon guid="guidImages" id="bmpLogo" />
<Strings>
<ButtonText>Open output in ILSpy</ButtonText>
</Strings>
</Button>
<Button guid="guidILSpyAddInCmdSet" id="cmdidOpenILSpy" priority="0x0600" type="Button">
<Parent guid="guidILSpyAddInCmdSet" id="OpenILSpyGroup" />
<Icon guid="guidImages" id="bmpLogo" />
<Strings>
<ButtonText>ILSpy</ButtonText>
</Strings>
@ -85,10 +94,16 @@ @@ -85,10 +94,16 @@
bitmap strip containing the bitmaps and then there are the numeric ids of the elements used
inside a button definition. An important aspect of this declaration is that the element id
must be the actual index (1-based) of the bitmap inside the bitmap strip. -->
<Bitmap guid="guidImages" href="Resources\Images.png" usedList="bmpPic1, bmpPic2, bmpPicSearch, bmpPicX, bmpPicArrows"/>
<Bitmap guid="guidImages" href="Resources\Images.png" usedList="bmpLogo, bmpPic1, bmpPic2, bmpPicX, bmpPicArrows"/>
</Bitmaps>
</Commands>
<CommandPlacements>
<CommandPlacement guid="guidILSpyAddInCmdSet" id="cmdidOpenReferenceInILSpy" priority="0x0600">
<Parent guid="guidSHLMainMenu" id="IDG_VS_CTXT_REFERENCE"/>
</CommandPlacement>
</CommandPlacements>
<Symbols>
<!-- This is the package guid. -->
<GuidSymbol name="guidILSpyAddInPkg" value="{a9120dbe-164a-4891-842f-fb7829273838}" />
@ -96,16 +111,18 @@ @@ -96,16 +111,18 @@
<!-- This is the guid used to group the menu commands together -->
<GuidSymbol name="guidILSpyAddInCmdSet" value="{85ddb8ca-a842-4b1c-ba1a-94141fdf19d0}">
<IDSymbol name="ILSpyAddInGroup" value="0x1020" />
<IDSymbol name="OpenILSpyGroup" value="0x1030" />
<IDSymbol name="OpenILSpyGroup" value="0x1010" />
<IDSymbol name="OpenILSpyRefGroup" value="0x1020" />
<IDSymbol name="OpenILSpyProjGroup" value="0x1030" />
<IDSymbol name="cmdidOpenILSpy" value="0x0100" />
<IDSymbol name="cmdidOpenInILSpy" value="0x0200" />
<IDSymbol name="cmdidOpenReferenceInILSpy" value="0x0200" />
<IDSymbol name="cmdidOpenProjectOutputInILSpy" value="0x0300" />
</GuidSymbol>
<GuidSymbol name="guidImages" value="{2f654db9-4641-4638-9937-27c6202b2a6a}" >
<IDSymbol name="bmpPic1" value="1" />
<IDSymbol name="bmpPic2" value="2" />
<IDSymbol name="bmpPicSearch" value="3" />
<IDSymbol name="bmpLogo" value="1" />
<IDSymbol name="bmpPic1" value="2" />
<IDSymbol name="bmpPic2" value="3" />
<IDSymbol name="bmpPicX" value="4" />
<IDSymbol name="bmpPicArrows" value="5" />
<IDSymbol name="bmpPicStrikethrough" value="6" />

30
ILSpy.AddIn/ILSpyAddInPackage.cs

@ -67,14 +67,19 @@ namespace ICSharpCode.ILSpy.AddIn @@ -67,14 +67,19 @@ namespace ICSharpCode.ILSpy.AddIn
OleMenuCommandService mcs = GetService(typeof(IMenuCommandService)) as OleMenuCommandService;
if (null != mcs) {
// Create the command for the menu item.
CommandID menuCommandID = new CommandID(GuidList.guidILSpyAddInCmdSet, (int)PkgCmdIDList.cmdidOpenInILSpy);
MenuCommand menuItem = new MenuCommand(OpenInILSpyCallback, menuCommandID);
CommandID menuCommandID = new CommandID(GuidList.guidILSpyAddInCmdSet, (int)PkgCmdIDList.cmdidOpenReferenceInILSpy);
MenuCommand menuItem = new MenuCommand(OpenReferenceInILSpyCallback, menuCommandID);
mcs.AddCommand(menuItem);
// Create the command for the menu item.
CommandID menuCommandID2 = new CommandID(GuidList.guidILSpyAddInCmdSet, (int)PkgCmdIDList.cmdidOpenILSpy);
MenuCommand menuItem2 = new MenuCommand(OpenILSpyCallback, menuCommandID2);
CommandID menuCommandID2 = new CommandID(GuidList.guidILSpyAddInCmdSet, (int)PkgCmdIDList.cmdidOpenProjectOutputInILSpy);
MenuCommand menuItem2 = new MenuCommand(OpenProjectOutputInILSpyCallback, menuCommandID2);
mcs.AddCommand(menuItem2);
// Create the command for the menu item.
CommandID menuCommandID3 = new CommandID(GuidList.guidILSpyAddInCmdSet, (int)PkgCmdIDList.cmdidOpenILSpy);
MenuCommand menuItem3 = new MenuCommand(OpenILSpyCallback, menuCommandID3);
mcs.AddCommand(menuItem3);
}
}
#endregion
@ -84,7 +89,7 @@ namespace ICSharpCode.ILSpy.AddIn @@ -84,7 +89,7 @@ namespace ICSharpCode.ILSpy.AddIn
/// See the Initialize method to see how the menu item is associated to this function using
/// the OleMenuCommandService service and the MenuCommand class.
/// </summary>
private void OpenInILSpyCallback(object sender, EventArgs e)
private void OpenReferenceInILSpyCallback(object sender, EventArgs e)
{
var explorer = ((EnvDTE80.DTE2)GetGlobalService(typeof(EnvDTE.DTE))).ToolWindows.SolutionExplorer;
var items =(object[]) explorer.SelectedItems;
@ -102,6 +107,21 @@ namespace ICSharpCode.ILSpy.AddIn @@ -102,6 +107,21 @@ namespace ICSharpCode.ILSpy.AddIn
}
}
private void OpenProjectOutputInILSpyCallback(object sender, EventArgs e)
{
var explorer = ((EnvDTE80.DTE2)GetGlobalService(typeof(EnvDTE.DTE))).ToolWindows.SolutionExplorer;
var items = (object[])explorer.SelectedItems;
foreach (EnvDTE.UIHierarchyItem item in items) {
EnvDTE.Project project = (EnvDTE.Project)item.Object;
EnvDTE.Configuration config = project.ConfigurationManager.ActiveConfiguration;
string projectPath = Path.GetDirectoryName(project.FileName);
string outputPath = config.Properties.Item("OutputPath").Value.ToString();
string assemblyFileName = project.Properties.Item("OutputFileName").Value.ToString();
OpenAssemblyInILSpy(Path.Combine(projectPath, outputPath, assemblyFileName));
}
}
private void OpenILSpyCallback(object sender, EventArgs e)
{
Process.Start(GetILSpyPath());

4
ILSpy.AddIn/PkgCmdID.cs

@ -7,7 +7,7 @@ namespace ICSharpCode.ILSpy.AddIn @@ -7,7 +7,7 @@ namespace ICSharpCode.ILSpy.AddIn
static class PkgCmdIDList
{
public const uint cmdidOpenILSpy = 0x100;
public const uint cmdidOpenInILSpy = 0x200;
public const uint cmdidOpenDefinitionInILSpy = 0x300;
public const uint cmdidOpenReferenceInILSpy = 0x200;
public const uint cmdidOpenProjectOutputInILSpy = 0x300;
};
}

BIN
ILSpy.AddIn/Resources/Images.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 994 B

After

Width:  |  Height:  |  Size: 1.7 KiB

Loading…
Cancel
Save