mirror of https://github.com/icsharpcode/ILSpy.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
70 lines
1.8 KiB
70 lines
1.8 KiB
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt) |
|
// This code is distributed under MIT X11 license (for details please see \doc\license.txt) |
|
|
|
using System; |
|
using System.Collections; |
|
using System.IO; |
|
using System.Linq; |
|
using System.Resources; |
|
using System.Text; |
|
using System.Windows; |
|
using System.Windows.Threading; |
|
|
|
using ICSharpCode.AvalonEdit.Highlighting; |
|
using ICSharpCode.AvalonEdit.Utils; |
|
using ICSharpCode.Decompiler; |
|
using ICSharpCode.ILSpy.TextView; |
|
using Microsoft.Win32; |
|
using Mono.Cecil; |
|
|
|
namespace ICSharpCode.ILSpy.TreeNodes |
|
{ |
|
/// <summary> |
|
/// Lists the embedded resources in an assembly. |
|
/// </summary> |
|
sealed class ResourceListTreeNode : ILSpyTreeNode |
|
{ |
|
readonly ModuleDefinition module; |
|
|
|
public ResourceListTreeNode(ModuleDefinition module) |
|
{ |
|
this.LazyLoading = true; |
|
this.module = module; |
|
} |
|
|
|
public override object Text { |
|
get { return "Resources"; } |
|
} |
|
|
|
public override object Icon { |
|
get { return Images.FolderClosed; } |
|
} |
|
|
|
public override object ExpandedIcon { |
|
get { return Images.FolderOpen; } |
|
} |
|
|
|
protected override void LoadChildren() |
|
{ |
|
foreach (Resource r in module.Resources.OrderBy(m => m.Name)) |
|
this.Children.Add(ResourceTreeNode.Create(r)); |
|
} |
|
|
|
public override FilterResult Filter(FilterSettings settings) |
|
{ |
|
if (string.IsNullOrEmpty(settings.SearchTerm)) |
|
return FilterResult.MatchAndRecurse; |
|
else |
|
return FilterResult.Recurse; |
|
} |
|
|
|
public override void Decompile(Language language, ITextOutput output, DecompilationOptions options) |
|
{ |
|
App.Current.Dispatcher.Invoke(DispatcherPriority.Normal, new Action(EnsureLazyChildren)); |
|
foreach (ILSpyTreeNode child in this.Children) { |
|
child.Decompile(language, output, options); |
|
output.WriteLine(); |
|
} |
|
} |
|
} |
|
}
|
|
|