Browse Source

Add ILSpy AddIn.

4.0
Daniel Grunwald 15 years ago
parent
commit
8af6f54abd
  1. 558
      SharpDevelop.Tests.sln
  2. 24
      SharpDevelop.sln
  3. 44
      data/resources/StringResources.resx
  4. BIN
      data/resources/image/BitmapResources/BitmapResources-data/ILSpy.png
  5. 1
      data/resources/image/BitmapResources/BitmapResources.res
  6. 33
      src/AddIns/Misc/ILSpyAddIn/ILSpyAddIn.addin
  7. 85
      src/AddIns/Misc/ILSpyAddIn/ILSpyAddIn.csproj
  8. 168
      src/AddIns/Misc/ILSpyAddIn/ILSpyController.cs
  9. 24
      src/AddIns/Misc/ILSpyAddIn/Properties/AssemblyInfo.cs
  10. 166
      src/AddIns/Misc/ILSpyAddIn/SetILSpyPathDialog.Designer.cs
  11. 73
      src/AddIns/Misc/ILSpyAddIn/SetILSpyPathDialog.cs
  12. 135
      src/AddIns/Misc/ILSpyAddIn/SetILSpyPathDialog.resx
  13. 63
      src/AddIns/Misc/ILSpyAddIn/TextEditorContextMenuCommand.cs
  14. BIN
      src/Main/StartUp/Project/Resources/BitmapResources.resources
  15. 6
      src/Setup/Files.wxs
  16. 1
      src/Setup/Setup.wxs

558
SharpDevelop.Tests.sln

File diff suppressed because it is too large Load Diff

24
SharpDevelop.sln

@ -1,7 +1,7 @@
 
Microsoft Visual Studio Solution File, Format Version 11.00 Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010 # Visual Studio 2010
# SharpDevelop 4.0.1.7084 # SharpDevelop 4.0.1.7113
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Main", "Main", "{256F5C28-532C-44C0-8AB8-D8EC5E492E01}" Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Main", "Main", "{256F5C28-532C-44C0-8AB8-D8EC5E492E01}"
ProjectSection(SolutionItems) = postProject ProjectSection(SolutionItems) = postProject
EndProjectSection EndProjectSection
@ -252,6 +252,11 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Misc", "Misc", "{F3662720-9
ProjectSection(SolutionItems) = postProject ProjectSection(SolutionItems) = postProject
EndProjectSection EndProjectSection
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ILSpyAddIn", "src\AddIns\Misc\ILSpyAddIn\ILSpyAddIn.csproj", "{8AA421C8-D7AF-4957-9F43-5135328ACB24}"
ProjectSection(ProjectDependencies) = postProject
{35CEF10F-2D4C-45F2-9DD1-161E0FEC583C} = {35CEF10F-2D4C-45F2-9DD1-161E0FEC583C}
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "UsageDataCollector", "UsageDataCollector", "{DEFC8584-BEC3-4921-BD0F-40482E450B7B}" Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "UsageDataCollector", "UsageDataCollector", "{DEFC8584-BEC3-4921-BD0F-40482E450B7B}"
ProjectSection(SolutionItems) = postProject ProjectSection(SolutionItems) = postProject
EndProjectSection EndProjectSection
@ -903,6 +908,22 @@ Global
{7048AE18-EB93-4A84-82D0-DD60EB58ADBD}.Release|x86.ActiveCfg = Release|x86 {7048AE18-EB93-4A84-82D0-DD60EB58ADBD}.Release|x86.ActiveCfg = Release|x86
{7048AE18-EB93-4A84-82D0-DD60EB58ADBD}.Release|Debug.Build.0 = Release|x86 {7048AE18-EB93-4A84-82D0-DD60EB58ADBD}.Release|Debug.Build.0 = Release|x86
{7048AE18-EB93-4A84-82D0-DD60EB58ADBD}.Release|Debug.ActiveCfg = Release|x86 {7048AE18-EB93-4A84-82D0-DD60EB58ADBD}.Release|Debug.ActiveCfg = Release|x86
{8AA421C8-D7AF-4957-9F43-5135328ACB24}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8AA421C8-D7AF-4957-9F43-5135328ACB24}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{8AA421C8-D7AF-4957-9F43-5135328ACB24}.Debug|Win32.Build.0 = Debug|Any CPU
{8AA421C8-D7AF-4957-9F43-5135328ACB24}.Debug|Win32.ActiveCfg = Debug|Any CPU
{8AA421C8-D7AF-4957-9F43-5135328ACB24}.Debug|x86.Build.0 = Debug|Any CPU
{8AA421C8-D7AF-4957-9F43-5135328ACB24}.Debug|x86.ActiveCfg = Debug|Any CPU
{8AA421C8-D7AF-4957-9F43-5135328ACB24}.Debug|Debug.Build.0 = Debug|Any CPU
{8AA421C8-D7AF-4957-9F43-5135328ACB24}.Debug|Debug.ActiveCfg = Debug|Any CPU
{8AA421C8-D7AF-4957-9F43-5135328ACB24}.Release|Any CPU.Build.0 = Release|Any CPU
{8AA421C8-D7AF-4957-9F43-5135328ACB24}.Release|Any CPU.ActiveCfg = Release|Any CPU
{8AA421C8-D7AF-4957-9F43-5135328ACB24}.Release|Win32.Build.0 = Release|Any CPU
{8AA421C8-D7AF-4957-9F43-5135328ACB24}.Release|Win32.ActiveCfg = Release|Any CPU
{8AA421C8-D7AF-4957-9F43-5135328ACB24}.Release|x86.Build.0 = Release|Any CPU
{8AA421C8-D7AF-4957-9F43-5135328ACB24}.Release|x86.ActiveCfg = Release|Any CPU
{8AA421C8-D7AF-4957-9F43-5135328ACB24}.Release|Debug.Build.0 = Release|Any CPU
{8AA421C8-D7AF-4957-9F43-5135328ACB24}.Release|Debug.ActiveCfg = Release|Any CPU
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE
@ -974,6 +995,7 @@ Global
{64A3E5E6-90BF-47F6-94DF-68C94B62C817} = {F3662720-9EA2-4591-BBC6-97361DCE50A9} {64A3E5E6-90BF-47F6-94DF-68C94B62C817} = {F3662720-9EA2-4591-BBC6-97361DCE50A9}
{461606BD-E824-4D0A-8CBA-01810B1F5E02} = {F3662720-9EA2-4591-BBC6-97361DCE50A9} {461606BD-E824-4D0A-8CBA-01810B1F5E02} = {F3662720-9EA2-4591-BBC6-97361DCE50A9}
{DEFC8584-BEC3-4921-BD0F-40482E450B7B} = {F3662720-9EA2-4591-BBC6-97361DCE50A9} {DEFC8584-BEC3-4921-BD0F-40482E450B7B} = {F3662720-9EA2-4591-BBC6-97361DCE50A9}
{8AA421C8-D7AF-4957-9F43-5135328ACB24} = {F3662720-9EA2-4591-BBC6-97361DCE50A9}
{6B1CFE35-DA17-4DEB-9C6E-227E5E251DA0} = {DEFC8584-BEC3-4921-BD0F-40482E450B7B} {6B1CFE35-DA17-4DEB-9C6E-227E5E251DA0} = {DEFC8584-BEC3-4921-BD0F-40482E450B7B}
{0008FCE9-9EB4-4E2E-979B-553278E5BBA6} = {DEFC8584-BEC3-4921-BD0F-40482E450B7B} {0008FCE9-9EB4-4E2E-979B-553278E5BBA6} = {DEFC8584-BEC3-4921-BD0F-40482E450B7B}
{1D18D788-F7EE-4585-A23B-34DC8EC63CB8} = {CDE0C5A4-2096-48B5-BEA3-74DBA0F0E1EF} {1D18D788-F7EE-4585-A23B-34DC8EC63CB8} = {CDE0C5A4-2096-48B5-BEA3-74DBA0F0E1EF}

44
data/resources/StringResources.resx

@ -6411,37 +6411,37 @@ Removed the end part of the original message ", reason '${Message}'" since this
<value>Delete all web references</value> <value>Delete all web references</value>
<comment>Title of the dialog box when the user tries to remove all web references.</comment> <comment>Title of the dialog box when the user tries to remove all web references.</comment>
</data> </data>
<data name="ReflectorAddIn.IdeOptions.FindReflectorPath" xml:space="preserve"> <data name="ILSpyAddIn.IdeOptions.FindILSpyPath" xml:space="preserve">
<value>Select Reflector path</value> <value>Select ILSpy path</value>
<comment>Button to select the Reflector path</comment> <comment>Button to select the ILSpy path</comment>
</data> </data>
<data name="ReflectorAddIn.IdeOptions.ReflectorFoundInPath" xml:space="preserve"> <data name="ILSpyAddIn.IdeOptions.ILSpyFoundInPath" xml:space="preserve">
<value>Reflector was found in the following directory:</value> <value>ILSpy was found in the following directory:</value>
</data> </data>
<data name="ReflectorAddIn.IdeOptions.ReflectorTitle" xml:space="preserve"> <data name="ILSpyAddIn.IdeOptions.ILSpyTitle" xml:space="preserve">
<value>Reflector</value> <value>ILSpy</value>
<comment>Title of Reflector path option panel</comment> <comment>Title of ILSpy path option panel</comment>
</data> </data>
<data name="ReflectorAddIn.OpenReflectorCommand" xml:space="preserve"> <data name="ILSpyAddIn.OpenILSpyCommand" xml:space="preserve">
<value>Open .NET Reflector</value> <value>Open ILSpy</value>
</data> </data>
<data name="ReflectorAddIn.ReflectorDoesNotExist" xml:space="preserve"> <data name="ILSpyAddIn.ILSpyDoesNotExist" xml:space="preserve">
<value>Reflector could not be found at the specified location, or SharpDevelop does not have sufficient rights to access it.</value> <value>ILSpy could not be found at the specified location, or SharpDevelop does not have sufficient rights to access it.</value>
</data> </data>
<data name="ReflectorAddIn.ReflectorPathNotSet" xml:space="preserve"> <data name="ILSpyAddIn.ILSpyPathNotSet" xml:space="preserve">
<value>The path to Reflector has not been set yet.</value> <value>The path to ILSpy has not been set yet.</value>
</data> </data>
<data name="ReflectorAddIn.ReflectorRemotingFailed" xml:space="preserve"> <data name="ILSpyAddIn.ILSpyRemotingFailed" xml:space="preserve">
<value>Failed to connect to Reflector.</value> <value>Failed to connect to ILSpy.</value>
</data> </data>
<data name="ReflectorAddIn.SetReflectorPathDialog.PathToReflectorExe" xml:space="preserve"> <data name="ILSpyAddIn.SetILSpyPathDialog.PathToILSpyExe" xml:space="preserve">
<value>Full path to Reflector.exe</value> <value>Full path to ILSpy.exe</value>
</data> </data>
<data name="ReflectorAddIn.SetReflectorPathDialog.ReflectorInfo" xml:space="preserve"> <data name="ILSpyAddIn.SetILSpyPathDialog.ILSpyInfo" xml:space="preserve">
<value>This feature requires Red Gate's .NET Reflector. If you do not have it yet, you can download it for free there:</value> <value>This feature requires ILSpy. If you do not have it yet, you can download it for free there:</value>
</data> </data>
<data name="ReflectorAddIn.SetReflectorPathDialogTitle" xml:space="preserve"> <data name="ILSpyAddIn.SetILSpyPathDialogTitle" xml:space="preserve">
<value>Set path to Reflector</value> <value>Set path to ILSpy</value>
</data> </data>
<data name="RegExpTk.MainDialog.Assemblies" xml:space="preserve"> <data name="RegExpTk.MainDialog.Assemblies" xml:space="preserve">
<value>Assemblies (*.dll)|*.dll</value> <value>Assemblies (*.dll)|*.dll</value>

BIN
data/resources/image/BitmapResources/BitmapResources-data/ILSpy.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 689 B

1
data/resources/image/BitmapResources/BitmapResources.res

@ -226,6 +226,7 @@ Icons.16x16.OpenFileIcon = BitmapResources-data\Icons.1
Icons.16x16.HtmlElements.FieldSetElement = BitmapResources-data\Icons.16x16.HtmlElements.FieldSetElement.png Icons.16x16.HtmlElements.FieldSetElement = BitmapResources-data\Icons.16x16.HtmlElements.FieldSetElement.png
Icons.16x16.SplitWindow = BitmapResources-data\Icons.16x16.SplitWindow.png Icons.16x16.SplitWindow = BitmapResources-data\Icons.16x16.SplitWindow.png
Icons.16x16.DeleteHistory = BitmapResources-data\Icons.16x16.DeleteHistory.png Icons.16x16.DeleteHistory = BitmapResources-data\Icons.16x16.DeleteHistory.png
ILSpy = BitmapResources-data\ILSpy.png
#pad icons #pad icons
PadIcons.ErrorList = PadIcons\ErrorList.png PadIcons.ErrorList = PadIcons\ErrorList.png

33
src/AddIns/Misc/ILSpyAddIn/ILSpyAddIn.addin

@ -0,0 +1,33 @@
<AddIn name = "ILSpyAddIn"
author = "Daniel Grunwald"
copyright = "prj:///doc/copyright.txt"
description = "Can open ILSpy on a selected class or member."
addInManagerHidden = "preinstalled">
<Manifest>
<Identity name="ICSharpCode.ILSpyAddIn" />
</Manifest>
<Runtime>
<Import assembly = "ILSpyAddIn.dll"/>
</Runtime>
<!-- Text editor context menu -->
<Path name = "/SharpDevelop/ViewContent/DefaultTextEditor/ClassMemberContextMenu">
<MenuItem id="ILSpy" icon="ILSpy" type="Item" label="${res:ILSpyAddIn.OpenILSpyCommand}" class="ICSharpCode.ILSpyAddIn.TextEditorContextMenuCommand"/>
</Path>
<Path name = "/SharpDevelop/ViewContent/DefaultTextEditor/ClassBookmarkContextMenu">
<MenuItem id="ILSpy" icon="ILSpy" type="Item" label="${res:ILSpyAddIn.OpenILSpyCommand}" class="ICSharpCode.ILSpyAddIn.TextEditorContextMenuCommand"/>
</Path>
<Path name = "/SharpDevelop/Pads/ClassBrowser/MemberContextMenu">
<MenuItem id="ILSpy" icon="ILSpy" type="Item" label="${res:ILSpyAddIn.OpenILSpyCommand}" class="ICSharpCode.ILSpyAddIn.TextEditorContextMenuCommand"/>
</Path>
<Path name = "/SharpDevelop/Pads/ClassBrowser/ClassContextMenu">
<MenuItem id="ILSpy" icon="ILSpy" type="Item" label="${res:ILSpyAddIn.OpenILSpyCommand}" class="ICSharpCode.ILSpyAddIn.TextEditorContextMenuCommand"/>
</Path>
</AddIn>

85
src/AddIns/Misc/ILSpyAddIn/ILSpyAddIn.csproj

@ -0,0 +1,85 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<ProjectGuid>{8AA421C8-D7AF-4957-9F43-5135328ACB24}</ProjectGuid>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<OutputType>Library</OutputType>
<RootNamespace>ICSharpCode.ILSpyAddIn</RootNamespace>
<AssemblyName>ILSpyAddIn</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<AppDesignerFolder>Properties</AppDesignerFolder>
<OutputPath>..\..\..\..\AddIns\Misc\ILSpyAddIn\</OutputPath>
<AllowUnsafeBlocks>False</AllowUnsafeBlocks>
<NoStdLib>False</NoStdLib>
<WarningLevel>4</WarningLevel>
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
<TargetFrameworkProfile>
</TargetFrameworkProfile>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>Full</DebugType>
<Optimize>False</Optimize>
<CheckForOverflowUnderflow>True</CheckForOverflowUnderflow>
<DefineConstants>DEBUG;TRACE</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<DebugSymbols>False</DebugSymbols>
<DebugType>None</DebugType>
<Optimize>True</Optimize>
<CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
<DefineConstants>TRACE</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition=" '$(Platform)' == 'AnyCPU' ">
<RegisterForComInterop>False</RegisterForComInterop>
<GenerateSerializationAssemblies>Auto</GenerateSerializationAssemblies>
<BaseAddress>4194304</BaseAddress>
<PlatformTarget>AnyCPU</PlatformTarget>
<FileAlignment>4096</FileAlignment>
</PropertyGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" />
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
</ItemGroup>
<ItemGroup>
<Compile Include="..\..\..\Main\GlobalAssemblyInfo.cs">
<Link>Properties\GlobalAssemblyInfo.cs</Link>
</Compile>
<Compile Include="ILSpyController.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="SetILSpyPathDialog.cs" />
<Compile Include="SetILSpyPathDialog.Designer.cs">
<DependentUpon>SetILSpyPathDialog.cs</DependentUpon>
</Compile>
<Compile Include="TextEditorContextMenuCommand.cs" />
<None Include="ILSpyAddIn.addin">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<EmbeddedResource Include="SetILSpyPathDialog.resx">
<DependentUpon>SetILSpyPathDialog.cs</DependentUpon>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\Main\Base\Project\ICSharpCode.SharpDevelop.csproj">
<Project>{2748AD25-9C63-4E12-877B-4DCE96FBED54}</Project>
<Name>ICSharpCode.SharpDevelop</Name>
<Private>False</Private>
</ProjectReference>
<ProjectReference Include="..\..\..\Main\Core\Project\ICSharpCode.Core.csproj">
<Project>{35CEF10F-2D4C-45F2-9DD1-161E0FEC583C}</Project>
<Name>ICSharpCode.Core</Name>
<Private>False</Private>
</ProjectReference>
<ProjectReference Include="..\..\..\Main\ICSharpCode.SharpDevelop.Dom\Project\ICSharpCode.SharpDevelop.Dom.csproj">
<Project>{924EE450-603D-49C1-A8E5-4AFAA31CE6F3}</Project>
<Name>ICSharpCode.SharpDevelop.Dom</Name>
<Private>False</Private>
</ProjectReference>
</ItemGroup>
</Project>

168
src/AddIns/Misc/ILSpyAddIn/ILSpyController.cs

@ -0,0 +1,168 @@
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Text;
using System.Windows.Forms;
using ICSharpCode.Core;
using ICSharpCode.SharpDevelop.Dom;
using ICSharpCode.SharpDevelop.Gui;
using ICSharpCode.SharpDevelop.Project;
namespace ICSharpCode.ILSpyAddIn
{
/// <summary>
/// Controls .NET ILSpy.
/// </summary>
public static class ILSpyController
{
public static void TryGoTo(AbstractEntity entity)
{
if (entity == null)
throw new ArgumentNullException("entity");
while ((entity is IMember) && ((IMember)entity).GenericMember is AbstractEntity)
entity = (AbstractEntity)((IMember)entity).GenericMember;
// Try to find the assembly which contains the resolved type
IProjectContent pc = entity.ProjectContent;
ReflectionProjectContent rpc = pc as ReflectionProjectContent;
string assemblyLocation = null;
if (rpc != null) {
// prefer GAC assemblies over reference assemblies:
assemblyLocation = FindAssemblyInNetGac(new DomAssemblyName(rpc.AssemblyFullName));
if (string.IsNullOrEmpty(assemblyLocation)) {
// use file only if assembly isn't in GAC:
assemblyLocation = rpc.AssemblyLocation;
}
} else {
IProject project = pc.Project as IProject;
if (project != null) {
assemblyLocation = project.OutputAssemblyFullPath;
}
}
if (string.IsNullOrEmpty(assemblyLocation)) {
MessageService.ShowWarning("ILSpy AddIn: Could not determine the assembly location for " + entity.FullyQualifiedName + ".");
return;
}
string ilspyPath = GetILSpyExeFullPathInteractive();
if (string.IsNullOrEmpty(ilspyPath))
return;
string commandLine = "/singleInstance \"" + assemblyLocation + "\" \"/navigateTo:" + entity.DocumentationTag + "\"";
LoggingService.Debug(ilspyPath + " " + commandLine);
Process.Start(ilspyPath, commandLine);
}
#region Find ILSpy
internal const string ILSpyExePathPropertyName = "ILSpyAddIn.ILSpyExePath";
/// <summary>
/// Gets the full path of ILSpy.exe, asking the user for it if it
/// has not been set.
/// </summary>
/// <param name="owner">The owner for the path selection dialog, if it is needed.</param>
/// <returns>The full path of ILSpy.exe, or <c>null</c> if the path was unknown and the user cancelled the path selection dialog.</returns>
internal static string GetILSpyExeFullPathInteractive()
{
string path = PropertyService.Get(ILSpyExePathPropertyName);
string askReason = null;
if (String.IsNullOrEmpty(path)) {
askReason = ResourceService.GetString("ILSpyAddIn.ILSpyPathNotSet");
} else if (!File.Exists(path)) {
askReason = ResourceService.GetString("ILSpyAddIn.ILSpyDoesNotExist");
}
if (askReason != null) {
using(SetILSpyPathDialog dialog = new SetILSpyPathDialog(path, askReason)) {
if (dialog.ShowDialog(WorkbenchSingleton.MainWin32Window) != DialogResult.OK || !File.Exists(dialog.SelectedFile)) {
return null;
}
path = dialog.SelectedFile;
PropertyService.Set(ILSpyExePathPropertyName, path);
}
}
return path;
}
#endregion
#region FindAssemblyInGac
// This region is based on code from Mono.Cecil:
// Author:
// Jb Evain (jbevain@gmail.com)
//
// Copyright (c) 2008 - 2010 Jb Evain
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
static readonly string[] gac_paths = { GacInterop.GacRootPathV2, GacInterop.GacRootPathV4 };
static readonly string[] gacs = { "GAC_MSIL", "GAC_32", "GAC" };
static readonly string[] prefixes = { string.Empty, "v4.0_" };
/// <summary>
/// Gets the file name for an assembly stored in the GAC.
/// </summary>
public static string FindAssemblyInNetGac (DomAssemblyName reference)
{
// without public key, it can't be in the GAC
if (reference.PublicKeyToken == null)
return null;
for (int i = 0; i < 2; i++) {
for (int j = 0; j < gacs.Length; j++) {
var gac = Path.Combine (gac_paths [i], gacs [j]);
var file = GetAssemblyFile (reference, prefixes [i], gac);
if (File.Exists (file))
return file;
}
}
return null;
}
static string GetAssemblyFile (DomAssemblyName reference, string prefix, string gac)
{
var gac_folder = new StringBuilder ()
.Append (prefix)
.Append (reference.Version)
.Append ("__");
gac_folder.Append (reference.PublicKeyToken);
return Path.Combine (
Path.Combine (
Path.Combine (gac, reference.ShortName), gac_folder.ToString ()),
reference.ShortName + ".dll");
}
#endregion
}
}

24
src/AddIns/Misc/ILSpyAddIn/Properties/AssemblyInfo.cs

@ -0,0 +1,24 @@
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
using System.Reflection;
// Information about this assembly is defined by the following
// attributes.
//
// change them to the information which is associated with the assembly
// you compile.
[assembly: AssemblyTitle("Reflector AddIn")]
[assembly: AssemblyDescription("Reflector AddIn for SharpDevelop")]
#if DEBUG
[assembly: AssemblyConfiguration("Debug")]
#else
[assembly: AssemblyConfiguration("Release")]
#endif
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: System.CLSCompliant(true)]

166
src/AddIns/Misc/ILSpyAddIn/SetILSpyPathDialog.Designer.cs generated

@ -0,0 +1,166 @@
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
namespace ICSharpCode.ILSpyAddIn
{
partial class SetILSpyPathDialog
{
/// <summary>
/// Designer variable used to keep track of non-visual components.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Disposes resources used by the form.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing) {
if (components != null) {
components.Dispose();
}
}
base.Dispose(disposing);
}
/// <summary>
/// This method is required for Windows Forms designer support.
/// Do not change the method contents inside the source code editor. The Forms designer might
/// not be able to load this method if it was changed manually.
/// </summary>
private void InitializeComponent()
{
System.Windows.Forms.Button pshOK;
System.Windows.Forms.Button pshCancel;
System.Windows.Forms.Label txtILSpyExplanation;
System.Windows.Forms.GroupBox grpPath;
System.Windows.Forms.Button pshBrowse;
this.slePath = new System.Windows.Forms.TextBox();
this.linkILSpy = new System.Windows.Forms.LinkLabel();
this.txtReason = new System.Windows.Forms.Label();
pshOK = new System.Windows.Forms.Button();
pshCancel = new System.Windows.Forms.Button();
txtILSpyExplanation = new System.Windows.Forms.Label();
grpPath = new System.Windows.Forms.GroupBox();
pshBrowse = new System.Windows.Forms.Button();
grpPath.SuspendLayout();
this.SuspendLayout();
//
// pshOK
//
pshOK.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
pshOK.DialogResult = System.Windows.Forms.DialogResult.OK;
pshOK.Location = new System.Drawing.Point(272, 187);
pshOK.Name = "pshOK";
pshOK.Size = new System.Drawing.Size(75, 23);
pshOK.TabIndex = 0;
pshOK.Text = "${res:Global.OKButtonText}";
pshOK.UseVisualStyleBackColor = true;
//
// pshCancel
//
pshCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
pshCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
pshCancel.Location = new System.Drawing.Point(353, 187);
pshCancel.Name = "pshCancel";
pshCancel.Size = new System.Drawing.Size(75, 23);
pshCancel.TabIndex = 1;
pshCancel.Text = "${res:Global.CancelButtonText}";
pshCancel.UseVisualStyleBackColor = true;
//
// txtILSpyExplanation
//
txtILSpyExplanation.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
txtILSpyExplanation.Location = new System.Drawing.Point(12, 45);
txtILSpyExplanation.Name = "txtILSpyExplanation";
txtILSpyExplanation.Size = new System.Drawing.Size(416, 46);
txtILSpyExplanation.TabIndex = 3;
txtILSpyExplanation.Text = "${res:ILSpyAddIn.SetILSpyPathDialog.ILSpyInfo}";
//
// grpPath
//
grpPath.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
grpPath.Controls.Add(pshBrowse);
grpPath.Controls.Add(this.slePath);
grpPath.Location = new System.Drawing.Point(12, 127);
grpPath.Name = "grpPath";
grpPath.Size = new System.Drawing.Size(416, 51);
grpPath.TabIndex = 5;
grpPath.TabStop = false;
grpPath.Text = "${res:ILSpyAddIn.SetILSpyPathDialog.PathToILSpyExe}";
//
// pshBrowse
//
pshBrowse.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
pshBrowse.Location = new System.Drawing.Point(303, 17);
pshBrowse.Name = "pshBrowse";
pshBrowse.Size = new System.Drawing.Size(107, 23);
pshBrowse.TabIndex = 1;
pshBrowse.Text = "${res:Global.BrowseButtonText}";
pshBrowse.UseVisualStyleBackColor = true;
pshBrowse.Click += new System.EventHandler(this.PshBrowseClick);
//
// slePath
//
this.slePath.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.slePath.Location = new System.Drawing.Point(6, 19);
this.slePath.Name = "slePath";
this.slePath.Size = new System.Drawing.Size(291, 20);
this.slePath.TabIndex = 0;
//
// linkILSpy
//
this.linkILSpy.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.linkILSpy.Location = new System.Drawing.Point(12, 91);
this.linkILSpy.Name = "linkILSpy";
this.linkILSpy.Size = new System.Drawing.Size(416, 23);
this.linkILSpy.TabIndex = 4;
this.linkILSpy.TabStop = true;
this.linkILSpy.Text = "http://www.ilspy.net/";
this.linkILSpy.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.LinkILSpyLinkClicked);
//
// txtReason
//
this.txtReason.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.txtReason.Location = new System.Drawing.Point(12, 9);
this.txtReason.Name = "txtReason";
this.txtReason.Size = new System.Drawing.Size(416, 36);
this.txtReason.TabIndex = 2;
//
// SetILSpyPathDialog
//
this.AcceptButton = pshOK;
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.CancelButton = pshCancel;
this.ClientSize = new System.Drawing.Size(440, 222);
this.Controls.Add(grpPath);
this.Controls.Add(this.linkILSpy);
this.Controls.Add(txtILSpyExplanation);
this.Controls.Add(this.txtReason);
this.Controls.Add(pshCancel);
this.Controls.Add(pshOK);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "SetILSpyPathDialog";
this.ShowIcon = false;
this.ShowInTaskbar = false;
this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "${res:ILSpyAddIn.SetILSpyPathDialogTitle}";
grpPath.ResumeLayout(false);
grpPath.PerformLayout();
this.ResumeLayout(false);
}
private System.Windows.Forms.LinkLabel linkILSpy;
private System.Windows.Forms.TextBox slePath;
private System.Windows.Forms.Label txtReason;
}
}

73
src/AddIns/Misc/ILSpyAddIn/SetILSpyPathDialog.cs

@ -0,0 +1,73 @@
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
using System;
using System.Drawing;
using System.Windows.Forms;
using ICSharpCode.Core;
namespace ICSharpCode.ILSpyAddIn
{
/// <summary>
/// Asks the user for the path to ILSpy.exe.
/// </summary>
internal partial class SetILSpyPathDialog : Form
{
public SetILSpyPathDialog(string oldPath, string reason)
{
//
// The InitializeComponent() call is required for Windows Forms designer support.
//
InitializeComponent();
Translate(this);
this.txtReason.Text = reason;
if (!String.IsNullOrEmpty(oldPath)) {
this.slePath.Text = oldPath;
}
}
private static void Translate(Control container) {
container.Text = StringParser.Parse(container.Text);
foreach (Control c in container.Controls) {
Translate(c);
}
}
void LinkILSpyLinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
{
try {
using(System.Diagnostics.Process.Start(linkILSpy.Text)) {
}
} catch (Exception ex) {
MessageService.ShowError(ex.Message);
}
}
void PshBrowseClick(object sender, EventArgs e)
{
using(OpenFileDialog dialog = new OpenFileDialog()) {
dialog.Title = this.Text;
dialog.DefaultExt = "exe";
dialog.RestoreDirectory = true;
dialog.Filter = "ILSpy.exe|ILSpy.exe";
if (!String.IsNullOrEmpty(this.slePath.Text)) {
dialog.FileName = this.slePath.Text;
}
if (dialog.ShowDialog(this) == DialogResult.OK) {
this.slePath.Text = dialog.FileName;
}
}
}
public string SelectedFile {
get { return this.slePath.Text; }
}
}
}

135
src/AddIns/Misc/ILSpyAddIn/SetILSpyPathDialog.resx

@ -0,0 +1,135 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="pshOK.GenerateMember" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
<metadata name="pshCancel.GenerateMember" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
<metadata name="txtILSpyExplanation.GenerateMember" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
<metadata name="grpPath.GenerateMember" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
<metadata name="pshBrowse.GenerateMember" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
</root>

63
src/AddIns/Misc/ILSpyAddIn/TextEditorContextMenuCommand.cs

@ -0,0 +1,63 @@
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
using System;
using ICSharpCode.Core;
using ICSharpCode.SharpDevelop.Bookmarks;
using ICSharpCode.SharpDevelop.Dom;
using ICSharpCode.SharpDevelop.Gui.ClassBrowser;
namespace ICSharpCode.ILSpyAddIn
{
/// <summary>
/// Implements a menu command to position .NET ILSpy on a class
/// or class member.
/// </summary>
public sealed class TextEditorContextMenuCommand : AbstractMenuCommand
{
public override void Run()
{
IClass c;
IMember m;
MemberNode mn = this.Owner as MemberNode;
if (mn != null) {
m = mn.Member;
c = m.DeclaringType;
} else {
ClassNode cn = this.Owner as ClassNode;
if (cn != null) {
c = cn.Class;
m = null;
} else {
ClassMemberBookmark cmbm = this.Owner as ClassMemberBookmark;
if (cmbm != null) {
m = cmbm.Member;
c = m.DeclaringType;
} else {
ClassBookmark cbm = this.Owner as ClassBookmark;
if (cbm != null) {
c = cbm.Class;
m = null;
} else {
MessageService.ShowWarning("ILSpy AddIn: Could not determine the class for the selected element. Owner: " + ((this.Owner == null) ? "<null>" : this.Owner.ToString()));
return;
}
}
}
}
if (c == null) {
MessageService.ShowWarning("ILSpy AddIn: Could not determine the class for the selected element (known owner). Owner: " + this.Owner.ToString());
return;
}
AbstractEntity entity = m as AbstractEntity;
if (entity == null)
entity = c as AbstractEntity;
if (entity != null) {
ILSpyController.TryGoTo(entity);
}
}
}
}

BIN
src/Main/StartUp/Project/Resources/BitmapResources.resources

Binary file not shown.

6
src/Setup/Files.wxs

@ -1442,6 +1442,12 @@
<File Source="..\..\AddIns\Misc\SharpDevelopReports\itextsharp.dll" Name="itextsharp.dll" Id="itextsharp.dll" KeyPath="yes" /> <File Source="..\..\AddIns\Misc\SharpDevelopReports\itextsharp.dll" Name="itextsharp.dll" Id="itextsharp.dll" KeyPath="yes" />
</Component> </Component>
</Directory> </Directory>
<Directory Id="ILSpyAddIn" Name="ILSpyAddIn">
<Component Id="ILSpyAddInFiles" Guid="F1422563-5927-4D98-B4D4-33FE5576C665" DiskId="1">
<File Id="ILSpyAddIn.dll" Name="ILSpyAddIn.dll" Source="..\..\AddIns\Misc\ILSpyAddIn\ILSpyAddIn.dll" KeyPath="yes" />
<File Id="ILSpyAddIn.addin" Name="ILSpyAddIn.addin" Source="..\..\AddIns\Misc\ILSpyAddIn\ILSpyAddIn.addin" />
</Component>
</Directory>
</Directory> </Directory>
<Directory Id="VersionControlAddInsFolder" Name="VersionControl"> <Directory Id="VersionControlAddInsFolder" Name="VersionControl">
<Directory Id="SubversionAddInFolder" Name="SubversionAddIn"> <Directory Id="SubversionAddInFolder" Name="SubversionAddIn">

1
src/Setup/Setup.wxs

@ -349,6 +349,7 @@
<ComponentRef Id="RegExToolkitFiles"/> <ComponentRef Id="RegExToolkitFiles"/>
<ComponentRef Id="ResourceToolkitFiles"/> <ComponentRef Id="ResourceToolkitFiles"/>
<ComponentRef Id="SearchAndReplaceFiles"/> <ComponentRef Id="SearchAndReplaceFiles"/>
<ComponentRef Id="ILSpyAddInFiles"/>
<ComponentRef Id="StartPageAddInFiles"/> <ComponentRef Id="StartPageAddInFiles"/>
<ComponentRef Id="SubversionAddInDll"/> <ComponentRef Id="SubversionAddInDll"/>

Loading…
Cancel
Save