mirror of https://github.com/icsharpcode/ILSpy.git
10 changed files with 207 additions and 4 deletions
@ -0,0 +1,17 @@ |
|||||||
|
using System; |
||||||
|
using System.Collections.Generic; |
||||||
|
using System.Linq; |
||||||
|
using System.Text; |
||||||
|
using System.Threading.Tasks; |
||||||
|
|
||||||
|
namespace ICSharpCode.ILSpy.Commands |
||||||
|
{ |
||||||
|
[ExportMainMenuCommand(Menu = "_View", Header = "_Show debug steps", MenuOrder = 5000)] |
||||||
|
class ShowDebugSteps : SimpleCommand |
||||||
|
{ |
||||||
|
public override void Execute(object parameter) |
||||||
|
{ |
||||||
|
DebugSteps.Show(); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,18 @@ |
|||||||
|
<UserControl x:Class="ICSharpCode.ILSpy.DebugSteps" |
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
||||||
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" |
||||||
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" |
||||||
|
xmlns:local="clr-namespace:ICSharpCode.ILSpy" |
||||||
|
mc:Ignorable="d" |
||||||
|
d:DesignHeight="300" d:DesignWidth="300"> |
||||||
|
<Grid> |
||||||
|
<TreeView Name="tree" MouseDoubleClick="tree_MouseDoubleClick"> |
||||||
|
<TreeView.ItemTemplate> |
||||||
|
<HierarchicalDataTemplate ItemsSource="{Binding Children}"> |
||||||
|
<TextBlock Text="{Binding Description}" /> |
||||||
|
</HierarchicalDataTemplate> |
||||||
|
</TreeView.ItemTemplate> |
||||||
|
</TreeView> |
||||||
|
</Grid> |
||||||
|
</UserControl> |
@ -0,0 +1,86 @@ |
|||||||
|
using System; |
||||||
|
using System.Collections.Generic; |
||||||
|
using System.Linq; |
||||||
|
using System.Text; |
||||||
|
using System.Threading.Tasks; |
||||||
|
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; |
||||||
|
using ICSharpCode.Decompiler.IL.Transforms; |
||||||
|
|
||||||
|
namespace ICSharpCode.ILSpy |
||||||
|
{ |
||||||
|
/// <summary>
|
||||||
|
/// Interaktionslogik für DebugSteps.xaml
|
||||||
|
/// </summary>
|
||||||
|
public partial class DebugSteps : UserControl, IPane |
||||||
|
{ |
||||||
|
ILAstLanguage language; |
||||||
|
|
||||||
|
DebugSteps() |
||||||
|
{ |
||||||
|
InitializeComponent(); |
||||||
|
|
||||||
|
MainWindow.Instance.SessionSettings.FilterSettings.PropertyChanged += FilterSettings_PropertyChanged; |
||||||
|
MainWindow.Instance.SelectionChanged += SelectionChanged; |
||||||
|
|
||||||
|
if (MainWindow.Instance.CurrentLanguage is ILAstLanguage l) { |
||||||
|
l.StepperUpdated += ILAstStepperUpdated; |
||||||
|
language = l; |
||||||
|
ILAstStepperUpdated(null, null); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
private void SelectionChanged(object sender, SelectionChangedEventArgs e) |
||||||
|
{ |
||||||
|
Dispatcher.Invoke(() => tree.ItemsSource = null); |
||||||
|
} |
||||||
|
|
||||||
|
private void FilterSettings_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e) |
||||||
|
{ |
||||||
|
if (e.PropertyName == "CurrentLanguage") { |
||||||
|
if (language != null) { |
||||||
|
language.StepperUpdated -= ILAstStepperUpdated; |
||||||
|
} |
||||||
|
if (MainWindow.Instance.CurrentLanguage is ILAstLanguage l) { |
||||||
|
l.StepperUpdated += ILAstStepperUpdated; |
||||||
|
language = l; |
||||||
|
ILAstStepperUpdated(null, null); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
private void ILAstStepperUpdated(object sender, EventArgs e) |
||||||
|
{ |
||||||
|
if (language == null) return; |
||||||
|
Dispatcher.Invoke(() => tree.ItemsSource = language.Stepper.Steps); |
||||||
|
} |
||||||
|
|
||||||
|
public static void Show() |
||||||
|
{ |
||||||
|
MainWindow.Instance.ShowInTopPane("Debug Steps", new DebugSteps()); |
||||||
|
} |
||||||
|
|
||||||
|
void IPane.Closed() |
||||||
|
{ |
||||||
|
MainWindow.Instance.SessionSettings.FilterSettings.PropertyChanged -= FilterSettings_PropertyChanged; |
||||||
|
MainWindow.Instance.SelectionChanged -= SelectionChanged; |
||||||
|
if (language != null) { |
||||||
|
language.StepperUpdated -= ILAstStepperUpdated; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
private void tree_MouseDoubleClick(object sender, MouseButtonEventArgs e) |
||||||
|
{ |
||||||
|
Stepper.Node n = (Stepper.Node)tree.SelectedItem; |
||||||
|
var window = MainWindow.Instance; |
||||||
|
window.TextView.DecompileAsync(window.CurrentLanguage, window.SelectedNodes, new DecompilationOptions() { StepLimit = n.Step + 1 }); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
Loading…
Reference in new issue