From 851ee29261de27ee9d326ef7e6d62142fb30dbe5 Mon Sep 17 00:00:00 2001 From: jkuehner Date: Tue, 3 Sep 2019 11:26:35 +0200 Subject: [PATCH 1/8] work on avalondock --- ILSpy/ILSpy.csproj | 2 + ILSpy/MainWindow.xaml | 188 +++++++++++++++++++-------------------- ILSpy/MainWindow.xaml.cs | 12 +-- 3 files changed, 101 insertions(+), 101 deletions(-) diff --git a/ILSpy/ILSpy.csproj b/ILSpy/ILSpy.csproj index 1dd22579f..3ddf7448a 100644 --- a/ILSpy/ILSpy.csproj +++ b/ILSpy/ILSpy.csproj @@ -49,6 +49,8 @@ + + diff --git a/ILSpy/MainWindow.xaml b/ILSpy/MainWindow.xaml index c8846031e..5bd6722b1 100644 --- a/ILSpy/MainWindow.xaml +++ b/ILSpy/MainWindow.xaml @@ -4,7 +4,7 @@ x:ClassModifier="public" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:tv="clr-namespace:ICSharpCode.TreeView;assembly=ICSharpCode.TreeView" xmlns:local="clr-namespace:ICSharpCode.ILSpy" - xmlns:textView="clr-namespace:ICSharpCode.ILSpy.TextView" + xmlns:avalondock="http://schemas.xceed.com/wpf/xaml/avalondock" xmlns:controls="clr-namespace:ICSharpCode.ILSpy.Controls" xmlns:properties="clr-namespace:ICSharpCode.ILSpy.Properties" Title="ILSpy" @@ -51,7 +51,8 @@ - + + @@ -107,99 +108,94 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + - - - - - - - - - - \ No newline at end of file From 97009de7940e6cbc9e67fc6ece58a839e3ba5c5f Mon Sep 17 00:00:00 2001 From: jkuehner Date: Tue, 3 Sep 2019 15:10:01 +0200 Subject: [PATCH 3/8] support multiple decompilations --- ILSpy/Commands/DecompileInNewViewCommand.cs | 48 +++++++++++++++++++++ ILSpy/Docking/PanePosition.cs | 3 +- ILSpy/ILSpy.csproj | 1 + ILSpy/MainWindow.xaml | 36 ++++++---------- ILSpy/MainWindow.xaml.cs | 46 ++++---------------- ILSpy/Properties/Resources.Designer.cs | 9 ++++ ILSpy/Properties/Resources.resx | 3 ++ 7 files changed, 83 insertions(+), 63 deletions(-) create mode 100644 ILSpy/Commands/DecompileInNewViewCommand.cs diff --git a/ILSpy/Commands/DecompileInNewViewCommand.cs b/ILSpy/Commands/DecompileInNewViewCommand.cs new file mode 100644 index 000000000..b088ae1ad --- /dev/null +++ b/ILSpy/Commands/DecompileInNewViewCommand.cs @@ -0,0 +1,48 @@ +// 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.Linq; +using ICSharpCode.ILSpy.Properties; +using ICSharpCode.ILSpy.TextView; +using ICSharpCode.ILSpy.TreeNodes; + +namespace ICSharpCode.ILSpy.Analyzers +{ + [ExportContextMenuEntry(Header = nameof(Resources.DecompileToNewPanel), Icon = "images/Search.png", Category = nameof(Resources.Analyze), Order = 90)] + internal sealed class DecompileInNewViewCommand : IContextMenuEntry + { + public bool IsVisible(TextViewContext context) + { + return true; + } + + public bool IsEnabled(TextViewContext context) + { + return true; + } + + public void Execute(TextViewContext context) + { + var dtv = new DecompilerTextView(); + var nodes = context.SelectedTreeNodes.Cast().ToArray(); + var title = string.Join(", ", nodes.Select(x => x.ToString())); + MainWindow.Instance.ShowInNewPane(title, dtv, PanePosition.Document); + dtv.Decompile(MainWindow.Instance.CurrentLanguage, nodes, new DecompilationOptions()); + } + } +} diff --git a/ILSpy/Docking/PanePosition.cs b/ILSpy/Docking/PanePosition.cs index d0ff28370..d162d5d7b 100644 --- a/ILSpy/Docking/PanePosition.cs +++ b/ILSpy/Docking/PanePosition.cs @@ -3,6 +3,7 @@ public enum PanePosition { Top, - Bottom + Bottom, + Document } } diff --git a/ILSpy/ILSpy.csproj b/ILSpy/ILSpy.csproj index 6c58619d0..79a5c8023 100644 --- a/ILSpy/ILSpy.csproj +++ b/ILSpy/ILSpy.csproj @@ -101,6 +101,7 @@ + diff --git a/ILSpy/MainWindow.xaml b/ILSpy/MainWindow.xaml index 75ef145a4..c99cbd82b 100644 --- a/ILSpy/MainWindow.xaml +++ b/ILSpy/MainWindow.xaml @@ -97,6 +97,15 @@ ItemsSource="{Binding SelectedItem.LanguageVersions, ElementName=languageComboBox, UpdateSourceTrigger=PropertyChanged}" SelectedItem="{Binding FilterSettings.LanguageVersion, UpdateSourceTrigger=PropertyChanged}"/> + + + + + + - - -