From f267c4346a095bc47582f695d34db3e36d723e48 Mon Sep 17 00:00:00 2001 From: miloush Date: Sat, 24 Jun 2023 10:47:57 -0400 Subject: [PATCH 1/2] Copy key/value/names ContextMenu for resource tables --- ILSpy/Controls/ResourceObjectTable.xaml | 10 ++++++++++ ILSpy/Controls/ResourceObjectTable.xaml.cs | 21 +++++++++++++++++++++ ILSpy/Controls/ResourceStringTable.xaml | 9 +++++++++ ILSpy/Controls/ResourceStringTable.xaml.cs | 17 +++++++++++++++++ 4 files changed, 57 insertions(+) diff --git a/ILSpy/Controls/ResourceObjectTable.xaml b/ILSpy/Controls/ResourceObjectTable.xaml index e719f15b1d..854a6a28e8 100644 --- a/ILSpy/Controls/ResourceObjectTable.xaml +++ b/ILSpy/Controls/ResourceObjectTable.xaml @@ -22,6 +22,16 @@ Value="{Binding RelativeSource={RelativeSource Self}, Path=(ItemsControl.AlternationIndex), Converter={StaticResource BackgroundConverter}}" /> + + + + + + + + + + diff --git a/ILSpy/Controls/ResourceObjectTable.xaml.cs b/ILSpy/Controls/ResourceObjectTable.xaml.cs index 20f2a2a480..9b3ff1ff2a 100644 --- a/ILSpy/Controls/ResourceObjectTable.xaml.cs +++ b/ILSpy/Controls/ResourceObjectTable.xaml.cs @@ -81,6 +81,27 @@ void ExecuteCopy(object sender, ExecutedRoutedEventArgs args) StringBuilder sb = new StringBuilder(); foreach (var item in resourceListView.SelectedItems) { + if (item is TreeNodes.ResourcesFileTreeNode.SerializedObjectRepresentation so) + { + switch (args.Parameter) + { + case "Key": + sb.AppendLine(so.Key); + continue; + + case "Value": + sb.AppendLine(so.Value); + continue; + + case "Type": + sb.AppendLine(so.Type); + continue; + + default: + sb.AppendLine($"{so.Key}\t{so.Value}\t{so.Type}"); + continue; + } + } sb.AppendLine(item.ToString()); } Clipboard.SetText(sb.ToString()); diff --git a/ILSpy/Controls/ResourceStringTable.xaml b/ILSpy/Controls/ResourceStringTable.xaml index b2ce2127cd..b9db04815e 100644 --- a/ILSpy/Controls/ResourceStringTable.xaml +++ b/ILSpy/Controls/ResourceStringTable.xaml @@ -22,6 +22,15 @@ Value="{Binding RelativeSource={RelativeSource Self}, Path=(ItemsControl.AlternationIndex), Converter={StaticResource BackgroundConverter}}" /> + + + + + + + + + diff --git a/ILSpy/Controls/ResourceStringTable.xaml.cs b/ILSpy/Controls/ResourceStringTable.xaml.cs index d76df22a25..61d47a39cd 100644 --- a/ILSpy/Controls/ResourceStringTable.xaml.cs +++ b/ILSpy/Controls/ResourceStringTable.xaml.cs @@ -81,6 +81,23 @@ void ExecuteCopy(object sender, ExecutedRoutedEventArgs args) StringBuilder sb = new StringBuilder(); foreach (var item in resourceListView.SelectedItems) { + if (item is KeyValuePair pair) + { + switch (args.Parameter) + { + case "Key": + sb.AppendLine(pair.Key); + continue; + + case "Value": + sb.AppendLine(pair.Value); + continue; + + default: + sb.AppendLine($"{pair.Key}\t{pair.Value}"); + continue; + } + } sb.AppendLine(item.ToString()); } Clipboard.SetText(sb.ToString()); From 925de0390e72302761ccabd3ed7b3c2f35811b18 Mon Sep 17 00:00:00 2001 From: miloush Date: Sun, 25 Jun 2023 08:24:17 -0400 Subject: [PATCH 2/2] suppress resources context menu gesture text --- ILSpy/Controls/ResourceObjectTable.xaml | 6 +++--- ILSpy/Controls/ResourceStringTable.xaml | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/ILSpy/Controls/ResourceObjectTable.xaml b/ILSpy/Controls/ResourceObjectTable.xaml index 854a6a28e8..f4b2acaac2 100644 --- a/ILSpy/Controls/ResourceObjectTable.xaml +++ b/ILSpy/Controls/ResourceObjectTable.xaml @@ -26,9 +26,9 @@ - - - + + + diff --git a/ILSpy/Controls/ResourceStringTable.xaml b/ILSpy/Controls/ResourceStringTable.xaml index b9db04815e..5e57346701 100644 --- a/ILSpy/Controls/ResourceStringTable.xaml +++ b/ILSpy/Controls/ResourceStringTable.xaml @@ -26,8 +26,8 @@ - - + +