Browse Source

Added assembly lists.

pull/254/head
Dick van den Brink 14 years ago
parent
commit
759f942234
  1. 34
      ILSpy/Commands/OpenListCommand.cs
  2. 5
      ILSpy/ILSpy.csproj
  3. 17
      ILSpy/MainWindow.xaml.cs
  4. 33
      ILSpy/OpenListDialog.xaml
  5. 156
      ILSpy/OpenListDialog.xaml.cs

34
ILSpy/Commands/OpenListCommand.cs

@ -0,0 +1,34 @@ @@ -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);
}
}
}

5
ILSpy/ILSpy.csproj

@ -102,6 +102,7 @@ @@ -102,6 +102,7 @@
<Compile Include="CommandLineArguments.cs" />
<Compile Include="Commands\ExitCommand.cs" />
<Compile Include="Commands\CommandWrapper.cs" />
<Compile Include="Commands\OpenListCommand.cs" />
<Compile Include="Controls\DockedPane.cs" />
<Compile Include="Commands\DecompileAllCommand.cs" />
<Compile Include="Commands\ExportCommandAttribute.cs" />
@ -140,6 +141,9 @@ @@ -140,6 +141,9 @@
<DependentUpon>ResourceStringTable.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
<Compile Include="OpenListDialog.xaml.cs">
<DependentUpon>OpenListDialog.xaml</DependentUpon>
</Compile>
<Compile Include="Options\DecompilerSettingsPanel.xaml.cs">
<DependentUpon>DecompilerSettingsPanel.xaml</DependentUpon>
<SubType>Code</SubType>
@ -266,6 +270,7 @@ @@ -266,6 +270,7 @@
</Page>
<Page Include="MainWindow.xaml" />
<Page Include="OpenFromGacDialog.xaml" />
<Page Include="OpenListDialog.xaml" />
<Page Include="Options\DecompilerSettingsPanel.xaml" />
<Page Include="Options\DisplaySettingsPanel.xaml" />
<Page Include="Options\OptionsDialog.xaml" />

17
ILSpy/MainWindow.xaml.cs

@ -51,7 +51,7 @@ namespace ICSharpCode.ILSpy @@ -51,7 +51,7 @@ namespace ICSharpCode.ILSpy
ILSpySettings spySettings;
internal SessionSettings sessionSettings;
AssemblyListManager assemblyListManager;
internal AssemblyListManager assemblyListManager;
AssemblyList assemblyList;
AssemblyListTreeNode assemblyListTreeNode;
@ -323,6 +323,21 @@ namespace ICSharpCode.ILSpy @@ -323,6 +323,21 @@ namespace ICSharpCode.ILSpy
}
#endregion
public void ShowAssemblyList(string name)
{
ILSpySettings settings = this.spySettings;
if (settings == null)
{
settings = ILSpySettings.Load();
}
AssemblyList list = this.assemblyListManager.LoadList(settings, name);
//Only load a new list when it is a different one
if (list.ListName != CurrentAssemblyList.ListName)
{
ShowAssemblyList(list);
}
}
void ShowAssemblyList(AssemblyList assemblyList)
{
history.Clear();

33
ILSpy/OpenListDialog.xaml

@ -0,0 +1,33 @@ @@ -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>

156
ILSpy/OpenListDialog.xaml.cs

@ -0,0 +1,156 @@ @@ -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…
Cancel
Save