Browse Source

Fix #2446: Allow to open ILSpy on package references under "Dependencies"

pull/2454/head
Andreas Weizel 4 years ago
parent
commit
db81fb17e2
  1. 6
      ILSpy.AddIn/Commands/NuGetReferenceForILSpy.cs
  2. 8
      ILSpy.AddIn/Commands/OpenReferenceCommand.cs
  3. 6
      ILSpy.AddIn/ILSpy.AddIn.csproj
  4. 15
      ILSpy.AddIn/ILSpyAddIn.en-US.vsct
  5. 10
      ILSpy.AddIn/ILSpyAddIn.vsct
  6. 16
      ILSpy.AddIn/ILSpyAddIn.zh-Hans.vsct
  7. 3
      ILSpy.AddIn/ILSpyAddInPackage.cs
  8. 1
      ILSpy.AddIn/PkgCmdID.cs

6
ILSpy.AddIn/Commands/NuGetReferenceForILSpy.cs

@ -8,6 +8,8 @@ using EnvDTE;
using Microsoft.VisualStudio.Shell; using Microsoft.VisualStudio.Shell;
using VSLangProj;
namespace ICSharpCode.ILSpy.AddIn.Commands namespace ICSharpCode.ILSpy.AddIn.Commands
{ {
/// <summary> /// <summary>
@ -33,8 +35,8 @@ namespace ICSharpCode.ILSpy.AddIn.Commands
if (itemData is ProjectItem projectItem) if (itemData is ProjectItem projectItem)
{ {
var properties = Utils.GetProperties(projectItem.Properties, "Type"); var properties = Utils.GetProperties(projectItem.Properties, "Type", "ExtenderCATID");
if ((properties[0] as string) == "Package") if (((properties[0] as string) == "Package") || ((properties[1] as string) == PrjBrowseObjectCATID.prjCATIDCSharpReferenceBrowseObject))
{ {
return new NuGetReferenceForILSpy(projectItem); return new NuGetReferenceForILSpy(projectItem);
} }

8
ILSpy.AddIn/Commands/OpenReferenceCommand.cs

@ -13,8 +13,8 @@ namespace ICSharpCode.ILSpy.AddIn.Commands
{ {
static OpenReferenceCommand instance; static OpenReferenceCommand instance;
public OpenReferenceCommand(ILSpyAddInPackage owner) public OpenReferenceCommand(ILSpyAddInPackage owner, uint id)
: base(owner, PkgCmdIDList.cmdidOpenReferenceInILSpy) : base(owner, id)
{ {
ThreadHelper.ThrowIfNotOnUIThread(); ThreadHelper.ThrowIfNotOnUIThread();
} }
@ -98,11 +98,11 @@ namespace ICSharpCode.ILSpy.AddIn.Commands
} }
} }
internal static void Register(ILSpyAddInPackage owner) internal static void Register(ILSpyAddInPackage owner, uint id)
{ {
ThreadHelper.ThrowIfNotOnUIThread(); ThreadHelper.ThrowIfNotOnUIThread();
instance = new OpenReferenceCommand(owner); instance = new OpenReferenceCommand(owner, id);
} }
} }

6
ILSpy.AddIn/ILSpy.AddIn.csproj

@ -165,6 +165,12 @@
<None Include="ILSpyAddIn.vsct"> <None Include="ILSpyAddIn.vsct">
<SubType>Designer</SubType> <SubType>Designer</SubType>
</None> </None>
<None Include="ILSpyAddIn.en-US.vsct">
<SubType>Designer</SubType>
</None>
<None Include="ILSpyAddIn.zh-Hans.vsct">
<SubType>Designer</SubType>
</None>
<Content Include="zh-Hans\extension.vsixlangpack"> <Content Include="zh-Hans\extension.vsixlangpack">
<IncludeInVSIX>true</IncludeInVSIX> <IncludeInVSIX>true</IncludeInVSIX>
<CopyToOutputDirectory>Always</CopyToOutputDirectory> <CopyToOutputDirectory>Always</CopyToOutputDirectory>

15
ILSpy.AddIn/ILSpyAddIn.en-US.vsct

@ -56,6 +56,16 @@
<ButtonText>Open in ILSpy</ButtonText> <ButtonText>Open in ILSpy</ButtonText>
</Strings> </Strings>
</Button> </Button>
<Button guid="guidILSpyAddInCmdSet" id="cmdidOpenPackageReferenceInILSpy" priority="0x0600" type="Button">
<Parent guid="guidILSpyAddInCmdSet" id="OpenILSpyPackageRefGroup" />
<Icon guid="guidImages" id="bmpLogo" />
<CommandFlag>DynamicVisibility</CommandFlag>
<CommandFlag>DefaultInvisible</CommandFlag>
<Strings>
<ButtonText>Open in ILSpy</ButtonText>
</Strings>
</Button>
<Button guid="guidILSpyAddInCmdSet" id="cmdidOpenProjectOutputInILSpy" priority="0x0600" type="Button"> <Button guid="guidILSpyAddInCmdSet" id="cmdidOpenProjectOutputInILSpy" priority="0x0600" type="Button">
<Parent guid="guidILSpyAddInCmdSet" id="OpenILSpyProjGroup" /> <Parent guid="guidILSpyAddInCmdSet" id="OpenILSpyProjGroup" />
@ -84,11 +94,6 @@
<ButtonText>ILSpy</ButtonText> <ButtonText>ILSpy</ButtonText>
</Strings> </Strings>
</Button> </Button>
</Buttons> </Buttons>
</Commands> </Commands>
</CommandTable> </CommandTable>

10
ILSpy.AddIn/ILSpyAddIn.vsct

@ -52,6 +52,10 @@
<Group guid="guidILSpyAddInCmdSet" id="OpenILSpyRefGroup" priority="0x0200"> <Group guid="guidILSpyAddInCmdSet" id="OpenILSpyRefGroup" priority="0x0200">
<Parent guid="guidSHLMainMenu" id="IDM_VS_CTXT_REFERENCE"/> <Parent guid="guidSHLMainMenu" id="IDM_VS_CTXT_REFERENCE"/>
</Group> </Group>
<Group guid="guidILSpyAddInCmdSet" id="OpenILSpyPackageRefGroup" priority="0x0200">
<Parent guid="guidSHLMainMenu" id="IDM_VS_CTXT_PACKAGEREFERENCE"/>
</Group>
</Groups> </Groups>
<!--The bitmaps section is used to define the bitmaps that are used for the commands.--> <!--The bitmaps section is used to define the bitmaps that are used for the commands.-->
@ -75,10 +79,12 @@
<IDSymbol name="OpenILSpyRefGroup" value="0x1020" /> <IDSymbol name="OpenILSpyRefGroup" value="0x1020" />
<IDSymbol name="OpenILSpyProjGroup" value="0x1030" /> <IDSymbol name="OpenILSpyProjGroup" value="0x1030" />
<IDSymbol name="OpenILSpyCodeItemGroup" value="0x1040" /> <IDSymbol name="OpenILSpyCodeItemGroup" value="0x1040" />
<IDSymbol name="OpenILSpyPackageRefGroup" value="0x1050" />
<IDSymbol name="cmdidOpenILSpy" value="0x0100" /> <IDSymbol name="cmdidOpenILSpy" value="0x0100" />
<IDSymbol name="cmdidOpenReferenceInILSpy" value="0x0200" /> <IDSymbol name="cmdidOpenReferenceInILSpy" value="0x0200" />
<IDSymbol name="cmdidOpenProjectOutputInILSpy" value="0x0300" /> <IDSymbol name="cmdidOpenProjectOutputInILSpy" value="0x0300" />
<IDSymbol name="cmdidOpenCodeItemInILSpy" value="0x0400" /> <IDSymbol name="cmdidOpenCodeItemInILSpy" value="0x0400" />
<IDSymbol name="cmdidOpenPackageReferenceInILSpy" value="0x0500" />
</GuidSymbol> </GuidSymbol>
<GuidSymbol name="guidImages" value="{2f654db9-4641-4638-9937-27c6202b2a6a}" > <GuidSymbol name="guidImages" value="{2f654db9-4641-4638-9937-27c6202b2a6a}" >
@ -89,6 +95,10 @@
<IDSymbol name="bmpPicArrows" value="5" /> <IDSymbol name="bmpPicArrows" value="5" />
<IDSymbol name="bmpPicStrikethrough" value="6" /> <IDSymbol name="bmpPicStrikethrough" value="6" />
</GuidSymbol> </GuidSymbol>
<GuidSymbol name="guidReferenceContext" value="{D309F791-903F-11D0-9EFC-00A0C911004F}">
<IDSymbol name="IDM_VS_CTXT_PACKAGEREFERENCE" value="0x04A3"/>
</GuidSymbol>
</Symbols> </Symbols>
</CommandTable> </CommandTable>

16
ILSpy.AddIn/ILSpyAddIn.zh-Hans.vsct

@ -34,7 +34,7 @@
group; your package should define its own command set in order to avoid collisions group; your package should define its own command set in order to avoid collisions
with command ids defined by other packages. --> with command ids defined by other packages. -->
<!--Buttons section. --> <!--Buttons section. -->
<!--This section defines the elements the user can interact with, like a menu command or a button <!--This section defines the elements the user can interact with, like a menu command or a button
or combo box in a toolbar. --> or combo box in a toolbar. -->
@ -57,6 +57,16 @@
</Strings> </Strings>
</Button> </Button>
<Button guid="guidILSpyAddInCmdSet" id="cmdidOpenPackageReferenceInILSpy" priority="0x0600" type="Button">
<Parent guid="guidILSpyAddInCmdSet" id="OpenILSpyPackageRefGroup" />
<Icon guid="guidImages" id="bmpLogo" />
<CommandFlag>DynamicVisibility</CommandFlag>
<CommandFlag>DefaultInvisible</CommandFlag>
<Strings>
<ButtonText>用 ILSpy 打开</ButtonText>
</Strings>
</Button>
<Button guid="guidILSpyAddInCmdSet" id="cmdidOpenProjectOutputInILSpy" priority="0x0600" type="Button"> <Button guid="guidILSpyAddInCmdSet" id="cmdidOpenProjectOutputInILSpy" priority="0x0600" type="Button">
<Parent guid="guidILSpyAddInCmdSet" id="OpenILSpyProjGroup" /> <Parent guid="guidILSpyAddInCmdSet" id="OpenILSpyProjGroup" />
<Icon guid="guidImages" id="bmpLogo" /> <Icon guid="guidImages" id="bmpLogo" />
@ -84,9 +94,9 @@
<ButtonText>ILSpy</ButtonText> <ButtonText>ILSpy</ButtonText>
</Strings> </Strings>
</Button> </Button>
</Buttons> </Buttons>
</Commands> </Commands>
</CommandTable> </CommandTable>

3
ILSpy.AddIn/ILSpyAddInPackage.cs

@ -94,7 +94,8 @@ namespace ICSharpCode.ILSpy.AddIn
OpenILSpyCommand.Register(this); OpenILSpyCommand.Register(this);
OpenProjectOutputCommand.Register(this); OpenProjectOutputCommand.Register(this);
OpenReferenceCommand.Register(this); OpenReferenceCommand.Register(this, PkgCmdIDList.cmdidOpenReferenceInILSpy);
OpenReferenceCommand.Register(this, PkgCmdIDList.cmdidOpenPackageReferenceInILSpy);
OpenCodeItemCommand.Register(this); OpenCodeItemCommand.Register(this);
} }
#endregion #endregion

1
ILSpy.AddIn/PkgCmdID.cs

@ -9,5 +9,6 @@ namespace ICSharpCode.ILSpy.AddIn
public const uint cmdidOpenReferenceInILSpy = 0x200; public const uint cmdidOpenReferenceInILSpy = 0x200;
public const uint cmdidOpenProjectOutputInILSpy = 0x300; public const uint cmdidOpenProjectOutputInILSpy = 0x300;
public const uint cmdidOpenCodeItemInILSpy = 0x0400; public const uint cmdidOpenCodeItemInILSpy = 0x0400;
public const uint cmdidOpenPackageReferenceInILSpy = 0x500;
}; };
} }
Loading…
Cancel
Save