diff --git a/ILSpy/Controls/ResourceStringTable.xaml b/ILSpy/Controls/ResourceStringTable.xaml new file mode 100644 index 000000000..47663dc68 --- /dev/null +++ b/ILSpy/Controls/ResourceStringTable.xaml @@ -0,0 +1,20 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/ILSpy/Controls/ResourceStringTable.xaml.cs b/ILSpy/Controls/ResourceStringTable.xaml.cs new file mode 100644 index 000000000..3c7aa04ff --- /dev/null +++ b/ILSpy/Controls/ResourceStringTable.xaml.cs @@ -0,0 +1,36 @@ +/* + * Created by SharpDevelop. + * User: Ronny Klier + * Date: 31.05.2011 + * Time: 00:13 + * + * To change this template use Tools | Options | Coding | Edit Standard Headers. + */ +using System; +using System.Collections; +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; + +namespace ICSharpCode.ILSpy.Controls +{ + /// + /// Interaction logic for ResourceStringTable.xaml + /// + public partial class ResourceStringTable : UserControl + { + public ResourceStringTable(IEnumerable strings) + { + InitializeComponent(); + // set size to fit decompiler window + // TODO: there should be a more transparent way to do this + MaxWidth = MainWindow.Instance.mainPane.ActualWidth-20; + MaxHeight = MainWindow.Instance.mainPane.ActualHeight-100; + resourceListView.ItemsSource = strings; + } + } +} \ No newline at end of file diff --git a/ILSpy/ILSpy.csproj b/ILSpy/ILSpy.csproj index 9090a9a0a..64e99b05c 100644 --- a/ILSpy/ILSpy.csproj +++ b/ILSpy/ILSpy.csproj @@ -68,6 +68,7 @@ 3.5 + 4.0 @@ -101,6 +102,10 @@ + + ResourceStringTable.xaml + Code + DecompilerSettingsPanel.xaml Code @@ -246,6 +251,7 @@ + SearchBox.cs diff --git a/ILSpy/TreeNodes/ResourceNodes/ResourcesFileTreeNode.cs b/ILSpy/TreeNodes/ResourceNodes/ResourcesFileTreeNode.cs index a99e2a989..1b686c2da 100644 --- a/ILSpy/TreeNodes/ResourceNodes/ResourcesFileTreeNode.cs +++ b/ILSpy/TreeNodes/ResourceNodes/ResourcesFileTreeNode.cs @@ -18,10 +18,15 @@ using System; using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; using System.ComponentModel.Composition; using System.IO; using System.Linq; using System.Resources; + +using ICSharpCode.Decompiler; +using ICSharpCode.ILSpy.Controls; using Mono.Cecil; namespace ICSharpCode.ILSpy.TreeNodes @@ -46,6 +51,8 @@ namespace ICSharpCode.ILSpy.TreeNodes sealed class ResourcesFileTreeNode : ResourceTreeNode { + ICollection> filteredEntries = new ObservableCollection>(); + public ResourcesFileTreeNode(EmbeddedResource er) : base(er) { @@ -75,8 +82,26 @@ namespace ICSharpCode.ILSpy.TreeNodes Children.Add(ResourceEntryNode.Create(entry.Key.ToString(), (Stream)entry.Value)); else if (entry.Value is byte[]) Children.Add(ResourceEntryNode.Create(entry.Key.ToString(), new MemoryStream((byte[])entry.Value))); + else if (entry.Value is String) + filteredEntries.Add(new KeyValuePair(entry.Key.ToString(), (string)entry.Value)); } } } + + public override void Decompile(Language language, ITextOutput output, DecompilationOptions options) + { + base.Decompile(language, output, options); + if (null == filteredEntries) + return; + ISmartTextOutput smartOutput = output as ISmartTextOutput; + if (null != smartOutput) { + smartOutput.AddUIElement( + delegate { + return new ResourceStringTable(filteredEntries); + } + ); + } + output.WriteLine(); + } } }