Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: icsharpcode/ILSpy
base: 6746938
...
head fork: icsharpcode/ILSpy
compare: 623de08
Checking mergeability… Don't worry, you can still create the pull request.
  • 7 commits
  • 8 files changed
  • 0 commit comments
  • 2 contributors
View
34 ILSpy/AssemblyListManager.cs
@@ -90,5 +90,39 @@ public static void SaveList(AssemblyList list)
doc.Add(list.SaveAsXml());
});
}
+
+ public bool CreateList(AssemblyList list)
+ {
+ if (!AssemblyLists.Contains(list.ListName))
+ {
+ AssemblyLists.Add(list.ListName);
+ SaveList(list);
+ return true;
+ }
+ return false;
+ }
+
+ public bool DeleteList(string Name)
+ {
+ if (AssemblyLists.Contains(Name))
+ {
+ AssemblyLists.Remove(Name);
+
+ ILSpySettings.Update(
+ delegate(XElement root)
+ {
+ XElement doc = root.Element("AssemblyLists");
+ if (doc == null)
+ {
+ return;
+ }
+ XElement listElement = doc.Elements("List").FirstOrDefault(e => (string)e.Attribute("name") == Name);
+ if (listElement != null)
+ listElement.Remove();
+ });
+ return true;
+ }
+ return false;
+ }
}
}
View
34 ILSpy/Commands/OpenListCommand.cs
@@ -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", MenuIcon = "Images/AssemblyList.png", 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);
+ }
+ }
+}
View
24 ILSpy/CreateListDialog.xaml
@@ -0,0 +1,24 @@
+<Window
+ x:Class="ICSharpCode.ILSpy.CreateListDialog" 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="New list"
+ Style="{DynamicResource DialogWindow}"
+ WindowStartupLocation="CenterOwner"
+ ResizeMode="NoResize"
+ Width="300"
+ Height="150"
+ FocusManager.FocusedElement="{Binding ElementName=listView}">
+ <Grid Margin="12,8">
+ <Grid.RowDefinitions>
+ <RowDefinition Height="Auto" />
+ <RowDefinition Height="Auto" />
+ </Grid.RowDefinitions>
+ <StackPanel>
+ <Label>Enter a list name:</Label>
+ <TextBox Margin="8,8" Name="ListName" TextChanged="TextBox_TextChanged"></TextBox>
+ </StackPanel>
+ <StackPanel Grid.Row="2" Orientation="Horizontal" HorizontalAlignment="Right" Margin="8,0">
+ <Button IsDefault="True" Margin="2,0" IsEnabled="False" Name="okButton" Click="OKButton_Click">Create</Button>
+ <Button IsCancel="True" Margin="2,0">Cancel</Button>
+ </StackPanel>
+ </Grid>
+</Window>
View
49 ILSpy/CreateListDialog.xaml.cs
@@ -0,0 +1,49 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Navigation;
+using System.Windows.Shapes;
+
+namespace ICSharpCode.ILSpy
+{
+ /// <summary>
+ /// Interaction logic for Create.xaml
+ /// </summary>
+ public partial class CreateListDialog : Window
+ {
+ public CreateListDialog()
+ {
+ InitializeComponent();
+ }
+
+ private void TextBox_TextChanged(object sender, TextChangedEventArgs e)
+ {
+ okButton.IsEnabled = !string.IsNullOrWhiteSpace(ListName.Text);
+ }
+
+ private void OKButton_Click(object sender, RoutedEventArgs e)
+ {
+ if (!string.IsNullOrWhiteSpace(ListName.Text))
+ {
+ this.DialogResult = true;
+ }
+ }
+
+ public string NewListName
+ {
+ get
+ {
+ return ListName.Text;
+ }
+ }
+
+ }
+}
View
12 ILSpy/ILSpy.csproj
@@ -102,11 +102,15 @@
<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" />
<Compile Include="Controls\SearchBox.cs" />
<Compile Include="Controls\SortableGridViewColumn.cs" />
+ <Compile Include="CreateListDialog.xaml.cs">
+ <DependentUpon>CreateListDialog.xaml</DependentUpon>
+ </Compile>
<Compile Include="Languages\CSharpLanguage.cs" />
<Compile Include="DecompilationOptions.cs" />
<Compile Include="ExtensionMethods.cs" />
@@ -140,6 +144,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>
@@ -264,8 +271,13 @@
<Page Include="Controls\SearchBoxStyle.xaml">
<DependentUpon>SearchBox.cs</DependentUpon>
</Page>
+ <Page Include="CreateListDialog.xaml">
+ <SubType>Designer</SubType>
+ <Generator>MSBuild:Compile</Generator>
+ </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" />
View
17 ILSpy/MainWindow.xaml.cs
@@ -51,7 +51,7 @@ partial class MainWindow : Window
ILSpySettings spySettings;
internal SessionSettings sessionSettings;
- AssemblyListManager assemblyListManager;
+ internal AssemblyListManager assemblyListManager;
AssemblyList assemblyList;
AssemblyListTreeNode assemblyListTreeNode;
@@ -338,6 +338,21 @@ void downloadUpdateButtonClick(object sender, RoutedEventArgs e)
}
#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();
View
41 ILSpy/OpenListDialog.xaml
@@ -0,0 +1,41 @@
+<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="380"
+ MinHeight="250"
+ Height="350"
+ Width="380"
+ 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>
+ <DockPanel Grid.Row="2">
+ <StackPanel DockPanel.Dock="Right" 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>
+
+ <StackPanel DockPanel.Dock="Left" Orientation="Horizontal" HorizontalAlignment="Left">
+ <Button Margin="2,0" Click="CreateButton_Click">Create</Button>
+ <Button Margin="2,0" IsEnabled="False" Name="removeButton" Click="RemoveButton_Click">Remove</Button>
+ </StackPanel>
+ </DockPanel>
+ </Grid>
+</Window>
View
184 ILSpy/OpenListDialog.xaml.cs
@@ -0,0 +1,184 @@
+// 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.SelectedItem != null;
+ removeButton.IsEnabled = listView.SelectedItem != null;
+ }
+
+ void OKButton_Click(object sender, RoutedEventArgs e)
+ {
+ this.DialogResult = true;
+ }
+
+ public string SelectedListName
+ {
+ get
+ {
+ return listView.SelectedItem.ToString();
+ }
+ }
+
+ private void CreateDefaultAssemblyLists()
+ {
+ if (!manager.AssemblyLists.Contains(DotNet4List))
+ {
+ AssemblyList dotnet4 = new AssemblyList(DotNet4List);
+ AddToList(dotnet4, "mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089");
+ 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, "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, "WindowsBase, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35");
+
+ if (dotnet4.assemblies.Count > 0)
+ {
+ manager.CreateList(dotnet4);
+ }
+ }
+
+ if (!manager.AssemblyLists.Contains(DotNet35List))
+ {
+ AssemblyList dotnet35 = new AssemblyList(DotNet35List);
+ AddToList(dotnet35, "mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089");
+ 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, "PresentationCore, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35");
+ AddToList(dotnet35, "PresentationFramework, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35");
+ AddToList(dotnet35, "WindowsBase, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35");
+
+ if (dotnet35.assemblies.Count > 0)
+ {
+ manager.CreateList(dotnet35);
+ }
+ }
+
+ if (!manager.AssemblyLists.Contains(ASPDotNetMVC3List))
+ {
+ AssemblyList mvc = new AssemblyList(ASPDotNetMVC3List);
+ AddToList(mvc, "mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089");
+ 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");
+ AddToList(mvc, "Microsoft.CSharp, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a");
+
+ if (mvc.assemblies.Count > 0)
+ {
+ manager.CreateList(mvc);
+ }
+ }
+ }
+
+ private void AddToList(AssemblyList list, string FullName)
+ {
+ AssemblyNameReference reference = AssemblyNameReference.Parse(FullName);
+ string file = GacInterop.FindAssemblyInNetGac(reference);
+ if (file != null)
+ list.OpenAssembly(file);
+ }
+
+ private void CreateButton_Click(object sender, RoutedEventArgs e)
+ {
+ CreateListDialog dlg = new CreateListDialog();
+ dlg.Owner = this;
+ dlg.Closing += (s, args) =>
+ {
+ if (dlg.DialogResult == true)
+ {
+ if (manager.AssemblyLists.Contains(dlg.NewListName))
+ {
+ args.Cancel = true;
+ MessageBox.Show("A list with the same name was found.", null, MessageBoxButton.OK);
+ }
+ }
+ };
+ if (dlg.ShowDialog() == true)
+ {
+ manager.CreateList(new AssemblyList(dlg.NewListName));
+ }
+
+ }
+
+ private void RemoveButton_Click(object sender, RoutedEventArgs e)
+ {
+ if (listView.SelectedItem != null)
+ manager.DeleteList(listView.SelectedItem.ToString());
+ }
+
+ }
+}

No commit comments for this range

Something went wrong with that request. Please try again.