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.
34 lines
985 B
34 lines
985 B
using System; |
|
using System.Collections.Generic; |
|
using System.ComponentModel.Composition; |
|
using System.Linq; |
|
using System.Reflection.Metadata; |
|
using System.Text; |
|
using System.Threading.Tasks; |
|
using ICSharpCode.Decompiler.Metadata; |
|
using ICSharpCode.ILSpy.TreeNodes; |
|
|
|
namespace ICSharpCode.ILSpy.Metadata |
|
{ |
|
[Export(typeof(IProtocolHandler))] |
|
class MetadataProtocolHandler : IProtocolHandler |
|
{ |
|
public ILSpyTreeNode Resolve(string protocol, PEFile module, Handle handle, out bool newTabPage) |
|
{ |
|
newTabPage = true; |
|
if (protocol != "metadata") |
|
return null; |
|
var assemblyTreeNode = MainWindow.Instance.FindTreeNode(module) as AssemblyTreeNode; |
|
if (assemblyTreeNode == null) |
|
return null; |
|
var mxNode = assemblyTreeNode.Children.OfType<MetadataTreeNode>().FirstOrDefault(); |
|
if (mxNode != null) { |
|
mxNode.EnsureLazyChildren(); |
|
var node = mxNode.FindNodeByHandleKind(handle.Kind); |
|
node?.ScrollTo(handle); |
|
return node; |
|
} |
|
return null; |
|
} |
|
} |
|
}
|
|
|