mirror of https://github.com/icsharpcode/ILSpy.git
5 changed files with 244 additions and 1 deletions
@ -0,0 +1,34 @@ |
|||||||
|
// Copyright (c) 2011 AlphaSierraPapa for the SharpDevelop Team
|
||||||
|
//
|
||||||
|
// 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.
|
||||||
|
|
||||||
|
using System; |
||||||
|
|
||||||
|
namespace ICSharpCode.ILSpy |
||||||
|
{ |
||||||
|
[ExportMainMenuCommand(Menu = "_File", Header = "Open _List", MenuCategory = "Open", MenuOrder = 1.7)] |
||||||
|
sealed class OpenListCommand : SimpleCommand |
||||||
|
{ |
||||||
|
public override void Execute(object parameter) |
||||||
|
{ |
||||||
|
OpenListDialog dlg = new OpenListDialog(); |
||||||
|
dlg.Owner = MainWindow.Instance; |
||||||
|
if (dlg.ShowDialog() == true) |
||||||
|
MainWindow.Instance.ShowAssemblyList(dlg.SelectedListName); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,33 @@ |
|||||||
|
<Window |
||||||
|
x:Class="ICSharpCode.ILSpy.OpenListDialog" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:controls="clr-namespace:ICSharpCode.ILSpy.Controls" |
||||||
|
Title="Open List" |
||||||
|
Style="{DynamicResource DialogWindow}" |
||||||
|
WindowStartupLocation="CenterOwner" |
||||||
|
ResizeMode="CanResizeWithGrip" |
||||||
|
MinWidth="200" |
||||||
|
MinHeight="150" |
||||||
|
Height="350" |
||||||
|
Width="300" |
||||||
|
FocusManager.FocusedElement="{Binding ElementName=listView}"> |
||||||
|
<Grid Margin="12,8"> |
||||||
|
<Grid.RowDefinitions> |
||||||
|
<RowDefinition Height="Auto" /> |
||||||
|
<RowDefinition Height="1*" /> |
||||||
|
<RowDefinition Height="Auto" /> |
||||||
|
</Grid.RowDefinitions> |
||||||
|
<StackPanel> |
||||||
|
<Label>Select a list:</Label> |
||||||
|
</StackPanel> |
||||||
|
<ListView Name="listView" Grid.Row="1" Margin="0, 8" controls:SortableGridViewColumn.SortMode="Automatic" SelectionChanged="ListView_SelectionChanged" Loaded="listView_Loaded" SelectionMode="Single"> |
||||||
|
<ListView.View> |
||||||
|
<GridView> |
||||||
|
<controls:SortableGridViewColumn x:Name="nameColumn" Header="Name" DisplayMemberBinding="{Binding .}" /> |
||||||
|
</GridView> |
||||||
|
</ListView.View> |
||||||
|
</ListView> |
||||||
|
<StackPanel Grid.Row="2" Orientation="Horizontal" HorizontalAlignment="Right"> |
||||||
|
<Button IsDefault="True" Margin="2,0" IsEnabled="False" Name="okButton" Click="OKButton_Click">Open</Button> |
||||||
|
<Button IsCancel="True" Margin="2,0">Cancel</Button> |
||||||
|
</StackPanel> |
||||||
|
</Grid> |
||||||
|
</Window> |
||||||
@ -0,0 +1,156 @@ |
|||||||
|
// Copyright (c) 2011 AlphaSierraPapa for the SharpDevelop Team
|
||||||
|
//
|
||||||
|
// 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.
|
||||||
|
|
||||||
|
using System.Windows; |
||||||
|
using System.Windows.Controls; |
||||||
|
using Mono.Cecil; |
||||||
|
|
||||||
|
namespace ICSharpCode.ILSpy |
||||||
|
{ |
||||||
|
/// <summary>
|
||||||
|
/// Interaction logic for OpenListDialog.xaml
|
||||||
|
/// </summary>
|
||||||
|
public partial class OpenListDialog : Window |
||||||
|
{ |
||||||
|
|
||||||
|
public const string DotNet4List = ".NET 4 (WPF)"; |
||||||
|
public const string DotNet35List = ".NET 3.5"; |
||||||
|
public const string ASPDotNetMVC3List = "ASP.NET (MVC3)"; |
||||||
|
|
||||||
|
AssemblyListManager manager; |
||||||
|
|
||||||
|
public OpenListDialog() |
||||||
|
{ |
||||||
|
InitializeComponent(); |
||||||
|
manager = MainWindow.Instance.assemblyListManager; |
||||||
|
} |
||||||
|
|
||||||
|
private void listView_Loaded(object sender, RoutedEventArgs e) |
||||||
|
{ |
||||||
|
listView.ItemsSource = manager.AssemblyLists; |
||||||
|
CreateDefaultAssemblyLists(); |
||||||
|
} |
||||||
|
|
||||||
|
void ListView_SelectionChanged(object sender, SelectionChangedEventArgs e) |
||||||
|
{ |
||||||
|
okButton.IsEnabled = listView.SelectedItems != null; |
||||||
|
} |
||||||
|
|
||||||
|
void OKButton_Click(object sender, RoutedEventArgs e) |
||||||
|
{ |
||||||
|
this.DialogResult = true; |
||||||
|
Close(); |
||||||
|
} |
||||||
|
|
||||||
|
public string SelectedListName |
||||||
|
{ |
||||||
|
get |
||||||
|
{ |
||||||
|
return listView.SelectedItem.ToString(); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
private void CreateDefaultAssemblyLists() |
||||||
|
{ |
||||||
|
if (!manager.AssemblyLists.Contains(DotNet4List)) |
||||||
|
{ |
||||||
|
AssemblyList dotnet4 = new AssemblyList(DotNet4List); |
||||||
|
AddToList(dotnet4, "Microsoft.CSharp, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"); |
||||||
|
AddToList(dotnet4, "PresentationCore, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"); |
||||||
|
AddToList(dotnet4, "PresentationFramework, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"); |
||||||
|
AddToList(dotnet4, "System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"); |
||||||
|
AddToList(dotnet4, "System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"); |
||||||
|
AddToList(dotnet4, "System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"); |
||||||
|
AddToList(dotnet4, "System.Data.DataSetExtensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"); |
||||||
|
AddToList(dotnet4, "System.Xaml, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"); |
||||||
|
AddToList(dotnet4, "System.Xml, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"); |
||||||
|
AddToList(dotnet4, "System.Xml.Linq, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"); |
||||||
|
AddToList(dotnet4, "WindowsBase, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"); |
||||||
|
|
||||||
|
if (dotnet4.assemblies.Count > 0) |
||||||
|
{ |
||||||
|
manager.AssemblyLists.Add(dotnet4.ListName); |
||||||
|
AssemblyListManager.SaveList(dotnet4); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
if (!manager.AssemblyLists.Contains(DotNet35List)) |
||||||
|
{ |
||||||
|
AssemblyList dotnet35 = new AssemblyList(DotNet35List); |
||||||
|
AddToList(dotnet35, "PresentationCore, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"); |
||||||
|
AddToList(dotnet35, "PresentationFramework, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"); |
||||||
|
AddToList(dotnet35, "System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"); |
||||||
|
AddToList(dotnet35, "System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"); |
||||||
|
AddToList(dotnet35, "System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"); |
||||||
|
AddToList(dotnet35, "System.Data.DataSetExtensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"); |
||||||
|
AddToList(dotnet35, "System.Xml, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"); |
||||||
|
AddToList(dotnet35, "System.Xml.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"); |
||||||
|
AddToList(dotnet35, "WindowsBase, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"); |
||||||
|
|
||||||
|
if (dotnet35.assemblies.Count > 0) |
||||||
|
{ |
||||||
|
manager.AssemblyLists.Add(dotnet35.ListName); |
||||||
|
AssemblyListManager.SaveList(dotnet35); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
if (!manager.AssemblyLists.Contains(ASPDotNetMVC3List)) |
||||||
|
{ |
||||||
|
AssemblyList mvc = new AssemblyList(ASPDotNetMVC3List); |
||||||
|
AddToList(mvc, "Microsoft.CSharp, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"); |
||||||
|
AddToList(mvc, "System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"); |
||||||
|
AddToList(mvc, "System.ComponentModel.DataAnnotations, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"); |
||||||
|
AddToList(mvc, "System.Configuration, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"); |
||||||
|
AddToList(mvc, "System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"); |
||||||
|
AddToList(mvc, "System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"); |
||||||
|
AddToList(mvc, "System.Data.DataSetExtensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"); |
||||||
|
AddToList(mvc, "System.Data.Entity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"); |
||||||
|
AddToList(mvc, "System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"); |
||||||
|
AddToList(mvc, "System.EnterpriseServices, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"); |
||||||
|
AddToList(mvc, "System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"); |
||||||
|
AddToList(mvc, "System.Web.Abstractions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"); |
||||||
|
AddToList(mvc, "System.Web.ApplicationServices, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"); |
||||||
|
AddToList(mvc, "System.Web.DynamicData, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"); |
||||||
|
AddToList(mvc, "System.Web.Entity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"); |
||||||
|
AddToList(mvc, "System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"); |
||||||
|
AddToList(mvc, "System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"); |
||||||
|
AddToList(mvc, "System.Web.Routing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"); |
||||||
|
AddToList(mvc, "System.Web.Services, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"); |
||||||
|
AddToList(mvc, "System.Web.WebPages, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"); |
||||||
|
AddToList(mvc, "System.Web.Helpers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"); |
||||||
|
AddToList(mvc, "System.Xml, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"); |
||||||
|
AddToList(mvc, "System.Xml.Linq, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"); |
||||||
|
|
||||||
|
if (mvc.assemblies.Count > 0) |
||||||
|
{ |
||||||
|
manager.AssemblyLists.Add(mvc.ListName); |
||||||
|
AssemblyListManager.SaveList(mvc); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
private void AddToList(AssemblyList list, string FullName) |
||||||
|
{ |
||||||
|
AssemblyNameReference reference = AssemblyNameReference.Parse(FullName); |
||||||
|
string file = GacInterop.FindAssemblyInNetGac(reference); |
||||||
|
if (file != null) |
||||||
|
list.OpenAssembly(file); |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
|
} |
||||||
Loading…
Reference in new issue