mirror of https://github.com/icsharpcode/ILSpy.git
39 changed files with 3321 additions and 256 deletions
@ -0,0 +1,118 @@ |
|||||||
|
// Copyright (c) 2011 AlphaSierraPapa for the SharpDevelop Team
|
||||||
|
//
|
||||||
|
// Permission is hereby granted, free of charge, to any person obtaining a copy of this
|
||||||
|
// software and associated documentation files (the "Software"), to deal in the Software
|
||||||
|
// without restriction, including without limitation the rights to use, copy, modify, merge,
|
||||||
|
// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
|
||||||
|
// to whom the Software is furnished to do so, subject to the following conditions:
|
||||||
|
//
|
||||||
|
// The above copyright notice and this permission notice shall be included in all copies or
|
||||||
|
// substantial portions of the Software.
|
||||||
|
//
|
||||||
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||||
|
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
|
||||||
|
// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
|
||||||
|
// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||||
|
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||||
|
// DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
|
using System; |
||||||
|
using System.Collections.Generic; |
||||||
|
using System.Reflection.Metadata; |
||||||
|
using System.Reflection.Metadata.Ecma335; |
||||||
|
using System.Windows.Controls; |
||||||
|
using ICSharpCode.Decompiler; |
||||||
|
using ICSharpCode.Decompiler.Metadata; |
||||||
|
using ICSharpCode.ILSpy.TextView; |
||||||
|
using ICSharpCode.ILSpy.TreeNodes; |
||||||
|
|
||||||
|
namespace ICSharpCode.ILSpy.Metadata |
||||||
|
{ |
||||||
|
internal class AssemblyRefTableTreeNode : ILSpyTreeNode |
||||||
|
{ |
||||||
|
private PEFile module; |
||||||
|
|
||||||
|
public AssemblyRefTableTreeNode(PEFile module) |
||||||
|
{ |
||||||
|
this.module = module; |
||||||
|
} |
||||||
|
|
||||||
|
public override object Text => $"23 AssemblyRef ({module.Metadata.GetTableRowCount(TableIndex.AssemblyRef)})"; |
||||||
|
|
||||||
|
public override object Icon => Images.Literal; |
||||||
|
|
||||||
|
public override bool View(DecompilerTextView textView) |
||||||
|
{ |
||||||
|
ListView view = Helpers.CreateListView("AssemblyRefView"); |
||||||
|
|
||||||
|
var metadata = module.Metadata; |
||||||
|
|
||||||
|
var list = new List<AssemblyRefEntry>(); |
||||||
|
|
||||||
|
foreach (var row in metadata.AssemblyReferences) { |
||||||
|
list.Add(new AssemblyRefEntry(module, row)); |
||||||
|
} |
||||||
|
|
||||||
|
view.ItemsSource = list; |
||||||
|
|
||||||
|
textView.ShowContent(new[] { this }, view); |
||||||
|
return true; |
||||||
|
} |
||||||
|
|
||||||
|
struct AssemblyRefEntry |
||||||
|
{ |
||||||
|
readonly int metadataOffset; |
||||||
|
readonly PEFile module; |
||||||
|
readonly MetadataReader metadata; |
||||||
|
readonly AssemblyReferenceHandle handle; |
||||||
|
readonly System.Reflection.Metadata.AssemblyReference assemblyRef; |
||||||
|
|
||||||
|
public int RID => MetadataTokens.GetRowNumber(handle); |
||||||
|
|
||||||
|
public int Token => MetadataTokens.GetToken(handle); |
||||||
|
|
||||||
|
public int Offset => metadataOffset |
||||||
|
+ metadata.GetTableMetadataOffset(TableIndex.AssemblyRef) |
||||||
|
+ metadata.GetTableRowSize(TableIndex.AssemblyRef) * (RID - 1); |
||||||
|
|
||||||
|
public Version Version => assemblyRef.Version; |
||||||
|
|
||||||
|
public int Flags => (int)assemblyRef.Flags; |
||||||
|
|
||||||
|
public string FlagsTooltip => null;// Helpers.AttributesToString(assemblyRef.Flags);
|
||||||
|
|
||||||
|
public int PublicKeyOrToken => MetadataTokens.GetHeapOffset(assemblyRef.PublicKeyOrToken); |
||||||
|
|
||||||
|
public string PublicKeyOrTokenTooltip { |
||||||
|
get { |
||||||
|
if (assemblyRef.PublicKeyOrToken.IsNil) |
||||||
|
return null; |
||||||
|
System.Collections.Immutable.ImmutableArray<byte> token = metadata.GetBlobContent(assemblyRef.PublicKeyOrToken); |
||||||
|
return token.ToHexString(token.Length); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public int NameStringHandle => MetadataTokens.GetHeapOffset(assemblyRef.Name); |
||||||
|
|
||||||
|
public string Name => metadata.GetString(assemblyRef.Name); |
||||||
|
|
||||||
|
public int CultureStringHandle => MetadataTokens.GetHeapOffset(assemblyRef.Culture); |
||||||
|
|
||||||
|
public string Culture => metadata.GetString(assemblyRef.Culture); |
||||||
|
|
||||||
|
public AssemblyRefEntry(PEFile module, AssemblyReferenceHandle handle) |
||||||
|
{ |
||||||
|
this.metadataOffset = module.Reader.PEHeaders.MetadataStartOffset; |
||||||
|
this.module = module; |
||||||
|
this.metadata = module.Metadata; |
||||||
|
this.handle = handle; |
||||||
|
this.assemblyRef = metadata.GetAssemblyReference(handle); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public override void Decompile(Language language, ITextOutput output, DecompilationOptions options) |
||||||
|
{ |
||||||
|
language.WriteCommentLine(output, "AssemblyRef"); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,114 @@ |
|||||||
|
// Copyright (c) 2011 AlphaSierraPapa for the SharpDevelop Team
|
||||||
|
//
|
||||||
|
// Permission is hereby granted, free of charge, to any person obtaining a copy of this
|
||||||
|
// software and associated documentation files (the "Software"), to deal in the Software
|
||||||
|
// without restriction, including without limitation the rights to use, copy, modify, merge,
|
||||||
|
// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
|
||||||
|
// to whom the Software is furnished to do so, subject to the following conditions:
|
||||||
|
//
|
||||||
|
// The above copyright notice and this permission notice shall be included in all copies or
|
||||||
|
// substantial portions of the Software.
|
||||||
|
//
|
||||||
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||||
|
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
|
||||||
|
// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
|
||||||
|
// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||||
|
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||||
|
// DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
|
using System; |
||||||
|
using System.Collections.Generic; |
||||||
|
using System.Linq; |
||||||
|
using System.Reflection; |
||||||
|
using System.Reflection.Metadata; |
||||||
|
using System.Reflection.Metadata.Ecma335; |
||||||
|
using System.Text; |
||||||
|
using System.Windows.Controls; |
||||||
|
using System.Windows.Data; |
||||||
|
using ICSharpCode.Decompiler; |
||||||
|
using ICSharpCode.Decompiler.CSharp.Syntax; |
||||||
|
using ICSharpCode.Decompiler.Metadata; |
||||||
|
using ICSharpCode.ILSpy.Controls; |
||||||
|
using ICSharpCode.ILSpy.TextView; |
||||||
|
using ICSharpCode.ILSpy.TreeNodes; |
||||||
|
using ICSharpCode.TreeView; |
||||||
|
|
||||||
|
namespace ICSharpCode.ILSpy.Metadata |
||||||
|
{ |
||||||
|
internal class AssemblyTableTreeNode : ILSpyTreeNode |
||||||
|
{ |
||||||
|
private PEFile module; |
||||||
|
|
||||||
|
public AssemblyTableTreeNode(PEFile module) |
||||||
|
{ |
||||||
|
this.module = module; |
||||||
|
} |
||||||
|
|
||||||
|
public override object Text => $"20 Assembly ({module.Metadata.GetTableRowCount(TableIndex.Assembly)})"; |
||||||
|
|
||||||
|
public override object Icon => Images.Literal; |
||||||
|
|
||||||
|
public override bool View(DecompilerTextView textView) |
||||||
|
{ |
||||||
|
ListView view = Helpers.CreateListView("AssemblyView"); |
||||||
|
|
||||||
|
var metadata = module.Metadata; |
||||||
|
|
||||||
|
var list = new List<AssemblyEntry>(); |
||||||
|
|
||||||
|
list.Add(new AssemblyEntry(module)); |
||||||
|
|
||||||
|
view.ItemsSource = list; |
||||||
|
|
||||||
|
textView.ShowContent(new[] { this }, view); |
||||||
|
return true; |
||||||
|
} |
||||||
|
|
||||||
|
struct AssemblyEntry |
||||||
|
{ |
||||||
|
readonly int metadataOffset; |
||||||
|
readonly PEFile module; |
||||||
|
readonly MetadataReader metadata; |
||||||
|
readonly AssemblyDefinition assembly; |
||||||
|
|
||||||
|
public int RID => MetadataTokens.GetRowNumber(EntityHandle.AssemblyDefinition); |
||||||
|
|
||||||
|
public int Token => MetadataTokens.GetToken(EntityHandle.AssemblyDefinition); |
||||||
|
|
||||||
|
public int Offset => metadataOffset |
||||||
|
+ metadata.GetTableMetadataOffset(TableIndex.Assembly) |
||||||
|
+ metadata.GetTableRowSize(TableIndex.Assembly) * (RID - 1); |
||||||
|
|
||||||
|
public int HashAlgorithm => (int)assembly.HashAlgorithm; |
||||||
|
|
||||||
|
public string HashAlgorithmTooltip => assembly.HashAlgorithm.ToString(); |
||||||
|
|
||||||
|
public int Flags => (int)assembly.Flags; |
||||||
|
|
||||||
|
public string FlagsTooltip => null;// Helpers.AttributesToString(assembly.Flags);
|
||||||
|
|
||||||
|
public Version Version => assembly.Version; |
||||||
|
|
||||||
|
public int NameStringHandle => MetadataTokens.GetHeapOffset(assembly.Name); |
||||||
|
|
||||||
|
public string Name => metadata.GetString(assembly.Name); |
||||||
|
|
||||||
|
public int CultureStringHandle => MetadataTokens.GetHeapOffset(assembly.Culture); |
||||||
|
|
||||||
|
public string Culture => metadata.GetString(assembly.Culture); |
||||||
|
|
||||||
|
public AssemblyEntry(PEFile module) |
||||||
|
{ |
||||||
|
this.metadataOffset = module.Reader.PEHeaders.MetadataStartOffset; |
||||||
|
this.module = module; |
||||||
|
this.metadata = module.Metadata; |
||||||
|
this.assembly = metadata.GetAssemblyDefinition(); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public override void Decompile(Language language, ITextOutput output, DecompilationOptions options) |
||||||
|
{ |
||||||
|
language.WriteCommentLine(output, "Assembly"); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,116 @@ |
|||||||
|
// Copyright (c) 2011 AlphaSierraPapa for the SharpDevelop Team
|
||||||
|
//
|
||||||
|
// Permission is hereby granted, free of charge, to any person obtaining a copy of this
|
||||||
|
// software and associated documentation files (the "Software"), to deal in the Software
|
||||||
|
// without restriction, including without limitation the rights to use, copy, modify, merge,
|
||||||
|
// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
|
||||||
|
// to whom the Software is furnished to do so, subject to the following conditions:
|
||||||
|
//
|
||||||
|
// The above copyright notice and this permission notice shall be included in all copies or
|
||||||
|
// substantial portions of the Software.
|
||||||
|
//
|
||||||
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||||
|
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
|
||||||
|
// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
|
||||||
|
// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||||
|
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||||
|
// DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
|
using System.Collections.Generic; |
||||||
|
using System.Reflection.Metadata; |
||||||
|
using System.Reflection.Metadata.Ecma335; |
||||||
|
using System.Windows.Controls; |
||||||
|
using ICSharpCode.Decompiler; |
||||||
|
using ICSharpCode.Decompiler.Disassembler; |
||||||
|
using ICSharpCode.Decompiler.IL; |
||||||
|
using ICSharpCode.Decompiler.Metadata; |
||||||
|
using ICSharpCode.ILSpy.TextView; |
||||||
|
using ICSharpCode.ILSpy.TreeNodes; |
||||||
|
|
||||||
|
namespace ICSharpCode.ILSpy.Metadata |
||||||
|
{ |
||||||
|
internal class ConstantTableTreeNode : ILSpyTreeNode |
||||||
|
{ |
||||||
|
private PEFile module; |
||||||
|
|
||||||
|
public ConstantTableTreeNode(PEFile module) |
||||||
|
{ |
||||||
|
this.module = module; |
||||||
|
} |
||||||
|
|
||||||
|
public override object Text => $"0B Constant ({module.Metadata.GetTableRowCount(TableIndex.Constant)})"; |
||||||
|
|
||||||
|
public override object Icon => Images.Literal; |
||||||
|
|
||||||
|
public override bool View(DecompilerTextView textView) |
||||||
|
{ |
||||||
|
ListView view = Helpers.CreateListView("ConstantsView"); |
||||||
|
var metadata = module.Metadata; |
||||||
|
|
||||||
|
var list = new List<ConstantEntry>(); |
||||||
|
|
||||||
|
for (int row = 1; row <= module.Metadata.GetTableRowCount(TableIndex.Constant); row++) { |
||||||
|
list.Add(new ConstantEntry(module, MetadataTokens.ConstantHandle(row))); |
||||||
|
} |
||||||
|
|
||||||
|
view.ItemsSource = list; |
||||||
|
|
||||||
|
textView.ShowContent(new[] { this }, view); |
||||||
|
return true; |
||||||
|
} |
||||||
|
|
||||||
|
struct ConstantEntry |
||||||
|
{ |
||||||
|
readonly int metadataOffset; |
||||||
|
readonly PEFile module; |
||||||
|
readonly MetadataReader metadata; |
||||||
|
readonly EntityHandle handle; |
||||||
|
readonly Constant constant; |
||||||
|
|
||||||
|
public int RID => MetadataTokens.GetRowNumber(handle); |
||||||
|
|
||||||
|
public int Token => MetadataTokens.GetToken(handle); |
||||||
|
|
||||||
|
public int Offset => metadataOffset |
||||||
|
+ metadata.GetTableMetadataOffset(TableIndex.Constant) |
||||||
|
+ metadata.GetTableRowSize(TableIndex.Constant) * (RID - 1); |
||||||
|
|
||||||
|
public int Type => (int)constant.TypeCode; |
||||||
|
|
||||||
|
public string TypeTooltip => constant.TypeCode.ToString(); |
||||||
|
|
||||||
|
public int ParentHandle => MetadataTokens.GetToken(constant.Parent); |
||||||
|
|
||||||
|
public string ParentTooltip { |
||||||
|
get { |
||||||
|
ITextOutput output = new PlainTextOutput(); |
||||||
|
var context = new Decompiler.Metadata.GenericContext(default(TypeDefinitionHandle), module); |
||||||
|
constant.Parent.WriteTo(module, output, context); |
||||||
|
return output.ToString(); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public int Value => MetadataTokens.GetHeapOffset(constant.Value); |
||||||
|
|
||||||
|
public string ValueTooltip { |
||||||
|
get { |
||||||
|
return null; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public ConstantEntry(PEFile module, ConstantHandle handle) |
||||||
|
{ |
||||||
|
this.metadataOffset = module.Reader.PEHeaders.MetadataStartOffset; |
||||||
|
this.module = module; |
||||||
|
this.metadata = module.Metadata; |
||||||
|
this.handle = handle; |
||||||
|
this.constant = metadata.GetConstant(handle); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public override void Decompile(Language language, ITextOutput output, DecompilationOptions options) |
||||||
|
{ |
||||||
|
language.WriteCommentLine(output, "Constants"); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,127 @@ |
|||||||
|
// Copyright (c) 2011 AlphaSierraPapa for the SharpDevelop Team
|
||||||
|
//
|
||||||
|
// Permission is hereby granted, free of charge, to any person obtaining a copy of this
|
||||||
|
// software and associated documentation files (the "Software"), to deal in the Software
|
||||||
|
// without restriction, including without limitation the rights to use, copy, modify, merge,
|
||||||
|
// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
|
||||||
|
// to whom the Software is furnished to do so, subject to the following conditions:
|
||||||
|
//
|
||||||
|
// The above copyright notice and this permission notice shall be included in all copies or
|
||||||
|
// substantial portions of the Software.
|
||||||
|
//
|
||||||
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||||
|
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
|
||||||
|
// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
|
||||||
|
// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||||
|
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||||
|
// DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
|
using System; |
||||||
|
using System.Collections.Generic; |
||||||
|
using System.Linq; |
||||||
|
using System.Reflection.Metadata; |
||||||
|
using System.Reflection.Metadata.Ecma335; |
||||||
|
using System.Text; |
||||||
|
using System.Threading.Tasks; |
||||||
|
using System.Windows.Controls; |
||||||
|
using ICSharpCode.Decompiler; |
||||||
|
using ICSharpCode.Decompiler.Disassembler; |
||||||
|
using ICSharpCode.Decompiler.IL; |
||||||
|
using ICSharpCode.Decompiler.Metadata; |
||||||
|
using ICSharpCode.ILSpy.TextView; |
||||||
|
using ICSharpCode.ILSpy.TreeNodes; |
||||||
|
|
||||||
|
namespace ICSharpCode.ILSpy.Metadata |
||||||
|
{ |
||||||
|
class CustomAttributeTableTreeNode : ILSpyTreeNode |
||||||
|
{ |
||||||
|
private PEFile module; |
||||||
|
|
||||||
|
public CustomAttributeTableTreeNode(PEFile module) |
||||||
|
{ |
||||||
|
this.module = module; |
||||||
|
} |
||||||
|
|
||||||
|
public override object Text => $"0C CustomAttribute ({module.Metadata.GetTableRowCount(TableIndex.CustomAttribute)})"; |
||||||
|
|
||||||
|
public override object Icon => Images.Literal; |
||||||
|
|
||||||
|
public override bool View(DecompilerTextView textView) |
||||||
|
{ |
||||||
|
ListView view = Helpers.CreateListView("CustomAttributesView"); |
||||||
|
var metadata = module.Metadata; |
||||||
|
|
||||||
|
var list = new List<CustomAttributeEntry>(); |
||||||
|
|
||||||
|
foreach (var row in metadata.CustomAttributes) { |
||||||
|
list.Add(new CustomAttributeEntry(module, row)); |
||||||
|
} |
||||||
|
|
||||||
|
view.ItemsSource = list; |
||||||
|
|
||||||
|
textView.ShowContent(new[] { this }, view); |
||||||
|
return true; |
||||||
|
} |
||||||
|
|
||||||
|
struct CustomAttributeEntry |
||||||
|
{ |
||||||
|
readonly int metadataOffset; |
||||||
|
readonly PEFile module; |
||||||
|
readonly MetadataReader metadata; |
||||||
|
readonly CustomAttributeHandle handle; |
||||||
|
readonly CustomAttribute customAttr; |
||||||
|
|
||||||
|
public int RID => MetadataTokens.GetRowNumber(handle); |
||||||
|
|
||||||
|
public int Token => MetadataTokens.GetToken(handle); |
||||||
|
|
||||||
|
public int Offset => metadataOffset |
||||||
|
+ metadata.GetTableMetadataOffset(TableIndex.CustomAttribute) |
||||||
|
+ metadata.GetTableRowSize(TableIndex.CustomAttribute) * (RID - 1); |
||||||
|
|
||||||
|
public int ParentHandle => MetadataTokens.GetToken(customAttr.Parent); |
||||||
|
|
||||||
|
public string ParentTooltip { |
||||||
|
get { |
||||||
|
ITextOutput output = new PlainTextOutput(); |
||||||
|
var context = new GenericContext(default(TypeDefinitionHandle), module); |
||||||
|
customAttr.Parent.WriteTo(module, output, context); |
||||||
|
return output.ToString(); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public int ConstructorHandle => MetadataTokens.GetToken(customAttr.Constructor); |
||||||
|
|
||||||
|
public string ConstructorTooltip { |
||||||
|
get { |
||||||
|
ITextOutput output = new PlainTextOutput(); |
||||||
|
var context = new GenericContext(default(TypeDefinitionHandle), module); |
||||||
|
customAttr.Constructor.WriteTo(module, output, context); |
||||||
|
return output.ToString(); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public int ValueHandle => MetadataTokens.GetHeapOffset(customAttr.Value); |
||||||
|
|
||||||
|
public string ValueTooltip { |
||||||
|
get { |
||||||
|
return null; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public CustomAttributeEntry(PEFile module, CustomAttributeHandle handle) |
||||||
|
{ |
||||||
|
this.metadataOffset = module.Reader.PEHeaders.MetadataStartOffset; |
||||||
|
this.module = module; |
||||||
|
this.metadata = module.Metadata; |
||||||
|
this.handle = handle; |
||||||
|
this.customAttr = metadata.GetCustomAttribute(handle); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public override void Decompile(Language language, ITextOutput output, DecompilationOptions options) |
||||||
|
{ |
||||||
|
language.WriteCommentLine(output, "CustomAttributes"); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,124 @@ |
|||||||
|
// Copyright (c) 2011 AlphaSierraPapa for the SharpDevelop Team
|
||||||
|
//
|
||||||
|
// Permission is hereby granted, free of charge, to any person obtaining a copy of this
|
||||||
|
// software and associated documentation files (the "Software"), to deal in the Software
|
||||||
|
// without restriction, including without limitation the rights to use, copy, modify, merge,
|
||||||
|
// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
|
||||||
|
// to whom the Software is furnished to do so, subject to the following conditions:
|
||||||
|
//
|
||||||
|
// The above copyright notice and this permission notice shall be included in all copies or
|
||||||
|
// substantial portions of the Software.
|
||||||
|
//
|
||||||
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||||
|
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
|
||||||
|
// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
|
||||||
|
// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||||
|
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||||
|
// DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
|
using System; |
||||||
|
using System.Collections.Generic; |
||||||
|
using System.Linq; |
||||||
|
using System.Reflection.Metadata; |
||||||
|
using System.Reflection.Metadata.Ecma335; |
||||||
|
using System.Text; |
||||||
|
using System.Threading.Tasks; |
||||||
|
using System.Windows.Controls; |
||||||
|
using ICSharpCode.Decompiler; |
||||||
|
using ICSharpCode.Decompiler.Disassembler; |
||||||
|
using ICSharpCode.Decompiler.IL; |
||||||
|
using ICSharpCode.Decompiler.Metadata; |
||||||
|
using ICSharpCode.ILSpy.TextView; |
||||||
|
using ICSharpCode.ILSpy.TreeNodes; |
||||||
|
|
||||||
|
namespace ICSharpCode.ILSpy.Metadata |
||||||
|
{ |
||||||
|
class DeclSecurityTableTreeNode : ILSpyTreeNode |
||||||
|
{ |
||||||
|
private PEFile module; |
||||||
|
|
||||||
|
public DeclSecurityTableTreeNode(PEFile module) |
||||||
|
{ |
||||||
|
this.module = module; |
||||||
|
} |
||||||
|
|
||||||
|
public override object Text => $"0E DeclSecurity ({module.Metadata.GetTableRowCount(TableIndex.DeclSecurity)})"; |
||||||
|
|
||||||
|
public override object Icon => Images.Literal; |
||||||
|
|
||||||
|
public override bool View(DecompilerTextView textView) |
||||||
|
{ |
||||||
|
ListView view = Helpers.CreateListView("DeclSecurityAttrsView"); |
||||||
|
var metadata = module.Metadata; |
||||||
|
|
||||||
|
var list = new List<DeclSecurityEntry>(); |
||||||
|
|
||||||
|
foreach (var row in metadata.DeclarativeSecurityAttributes) { |
||||||
|
list.Add(new DeclSecurityEntry(module, row)); |
||||||
|
} |
||||||
|
|
||||||
|
view.ItemsSource = list; |
||||||
|
|
||||||
|
textView.ShowContent(new[] { this }, view); |
||||||
|
return true; |
||||||
|
} |
||||||
|
|
||||||
|
struct DeclSecurityEntry |
||||||
|
{ |
||||||
|
readonly int metadataOffset; |
||||||
|
readonly PEFile module; |
||||||
|
readonly MetadataReader metadata; |
||||||
|
readonly DeclarativeSecurityAttributeHandle handle; |
||||||
|
readonly DeclarativeSecurityAttribute declSecAttr; |
||||||
|
|
||||||
|
public int RID => MetadataTokens.GetRowNumber(handle); |
||||||
|
|
||||||
|
public int Token => MetadataTokens.GetToken(handle); |
||||||
|
|
||||||
|
public int Offset => metadataOffset |
||||||
|
+ metadata.GetTableMetadataOffset(TableIndex.DeclSecurity) |
||||||
|
+ metadata.GetTableRowSize(TableIndex.DeclSecurity) * (RID - 1); |
||||||
|
|
||||||
|
public int ParentHandle => MetadataTokens.GetToken(declSecAttr.Parent); |
||||||
|
|
||||||
|
public string ParentTooltip { |
||||||
|
get { |
||||||
|
ITextOutput output = new PlainTextOutput(); |
||||||
|
var context = new GenericContext(default(TypeDefinitionHandle), module); |
||||||
|
declSecAttr.Parent.WriteTo(module, output, context); |
||||||
|
return output.ToString(); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public int Action => (int)declSecAttr.Action; |
||||||
|
|
||||||
|
public string ActionTooltip { |
||||||
|
get { |
||||||
|
return null; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public int PermissionSetHandle => MetadataTokens.GetHeapOffset(declSecAttr.PermissionSet); |
||||||
|
|
||||||
|
public string PermissionSetTooltip { |
||||||
|
get { |
||||||
|
return null; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public DeclSecurityEntry(PEFile module, DeclarativeSecurityAttributeHandle handle) |
||||||
|
{ |
||||||
|
this.metadataOffset = module.Reader.PEHeaders.MetadataStartOffset; |
||||||
|
this.module = module; |
||||||
|
this.metadata = module.Metadata; |
||||||
|
this.handle = handle; |
||||||
|
this.declSecAttr = metadata.GetDeclarativeSecurityAttribute(handle); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public override void Decompile(Language language, ITextOutput output, DecompilationOptions options) |
||||||
|
{ |
||||||
|
language.WriteCommentLine(output, "DeclSecurityAttrs"); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,117 @@ |
|||||||
|
// Copyright (c) 2011 AlphaSierraPapa for the SharpDevelop Team
|
||||||
|
//
|
||||||
|
// Permission is hereby granted, free of charge, to any person obtaining a copy of this
|
||||||
|
// software and associated documentation files (the "Software"), to deal in the Software
|
||||||
|
// without restriction, including without limitation the rights to use, copy, modify, merge,
|
||||||
|
// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
|
||||||
|
// to whom the Software is furnished to do so, subject to the following conditions:
|
||||||
|
//
|
||||||
|
// The above copyright notice and this permission notice shall be included in all copies or
|
||||||
|
// substantial portions of the Software.
|
||||||
|
//
|
||||||
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||||
|
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
|
||||||
|
// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
|
||||||
|
// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||||
|
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||||
|
// DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
|
using System; |
||||||
|
using System.Collections.Generic; |
||||||
|
using System.Linq; |
||||||
|
using System.Reflection.Metadata; |
||||||
|
using System.Reflection.Metadata.Ecma335; |
||||||
|
using System.Text; |
||||||
|
using System.Threading.Tasks; |
||||||
|
using System.Windows.Controls; |
||||||
|
using ICSharpCode.Decompiler; |
||||||
|
using ICSharpCode.Decompiler.IL; |
||||||
|
using ICSharpCode.Decompiler.Disassembler; |
||||||
|
using ICSharpCode.Decompiler.Metadata; |
||||||
|
using ICSharpCode.Decompiler.TypeSystem; |
||||||
|
using ICSharpCode.ILSpy.TextView; |
||||||
|
using ICSharpCode.ILSpy.TreeNodes; |
||||||
|
|
||||||
|
namespace ICSharpCode.ILSpy.Metadata |
||||||
|
{ |
||||||
|
internal class EventTableTreeNode : ILSpyTreeNode |
||||||
|
{ |
||||||
|
private PEFile module; |
||||||
|
|
||||||
|
public EventTableTreeNode(PEFile module) |
||||||
|
{ |
||||||
|
this.module = module; |
||||||
|
} |
||||||
|
|
||||||
|
public override object Text => $"14 Event ({module.Metadata.GetTableRowCount(TableIndex.Event)})"; |
||||||
|
|
||||||
|
public override object Icon => Images.Literal; |
||||||
|
|
||||||
|
public override bool View(DecompilerTextView textView) |
||||||
|
{ |
||||||
|
ListView view = Helpers.CreateListView("EventDefsView"); |
||||||
|
var metadata = module.Metadata; |
||||||
|
|
||||||
|
var list = new List<EventDefEntry>(); |
||||||
|
|
||||||
|
foreach (var row in metadata.EventDefinitions) |
||||||
|
list.Add(new EventDefEntry(module, row)); |
||||||
|
|
||||||
|
view.ItemsSource = list; |
||||||
|
|
||||||
|
textView.ShowContent(new[] { this }, view); |
||||||
|
return true; |
||||||
|
} |
||||||
|
|
||||||
|
struct EventDefEntry : IMemberTreeNode |
||||||
|
{ |
||||||
|
readonly int metadataOffset; |
||||||
|
readonly PEFile module; |
||||||
|
readonly MetadataReader metadata; |
||||||
|
readonly EventDefinitionHandle handle; |
||||||
|
readonly EventDefinition eventDef; |
||||||
|
|
||||||
|
public int RID => MetadataTokens.GetRowNumber(handle); |
||||||
|
|
||||||
|
public int Token => MetadataTokens.GetToken(handle); |
||||||
|
|
||||||
|
public int Offset => metadataOffset |
||||||
|
+ metadata.GetTableMetadataOffset(TableIndex.Event) |
||||||
|
+ metadata.GetTableRowSize(TableIndex.Event) * (RID - 1); |
||||||
|
|
||||||
|
public int Attributes => (int)eventDef.Attributes; |
||||||
|
|
||||||
|
public string AttributesTooltip => null; //Helpers.AttributesToString(EventDef.Attributes);
|
||||||
|
|
||||||
|
public int NameStringHandle => MetadataTokens.GetHeapOffset(eventDef.Name); |
||||||
|
|
||||||
|
public string Name => metadata.GetString(eventDef.Name); |
||||||
|
|
||||||
|
IEntity IMemberTreeNode.Member => ((MetadataModule)module.GetTypeSystemOrNull()?.MainModule).GetDefinition(handle); |
||||||
|
|
||||||
|
public int Type => MetadataTokens.GetToken(eventDef.Type); |
||||||
|
|
||||||
|
public string TypeTooltip { |
||||||
|
get { |
||||||
|
ITextOutput output = new PlainTextOutput(); |
||||||
|
eventDef.Type.WriteTo(module, output, Decompiler.Metadata.GenericContext.Empty); |
||||||
|
return output.ToString(); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public EventDefEntry(PEFile module, EventDefinitionHandle handle) |
||||||
|
{ |
||||||
|
this.metadataOffset = module.Reader.PEHeaders.MetadataStartOffset; |
||||||
|
this.module = module; |
||||||
|
this.metadata = module.Metadata; |
||||||
|
this.handle = handle; |
||||||
|
this.eventDef = metadata.GetEventDefinition(handle); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public override void Decompile(Language language, ITextOutput output, DecompilationOptions options) |
||||||
|
{ |
||||||
|
language.WriteCommentLine(output, "EventDefs"); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,119 @@ |
|||||||
|
// Copyright (c) 2011 AlphaSierraPapa for the SharpDevelop Team
|
||||||
|
//
|
||||||
|
// Permission is hereby granted, free of charge, to any person obtaining a copy of this
|
||||||
|
// software and associated documentation files (the "Software"), to deal in the Software
|
||||||
|
// without restriction, including without limitation the rights to use, copy, modify, merge,
|
||||||
|
// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
|
||||||
|
// to whom the Software is furnished to do so, subject to the following conditions:
|
||||||
|
//
|
||||||
|
// The above copyright notice and this permission notice shall be included in all copies or
|
||||||
|
// substantial portions of the Software.
|
||||||
|
//
|
||||||
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||||
|
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
|
||||||
|
// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
|
||||||
|
// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||||
|
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||||
|
// DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
|
using System; |
||||||
|
using System.Collections.Generic; |
||||||
|
using System.Linq; |
||||||
|
using System.Reflection.Metadata; |
||||||
|
using System.Reflection.Metadata.Ecma335; |
||||||
|
using System.Text; |
||||||
|
using System.Threading.Tasks; |
||||||
|
using System.Windows.Controls; |
||||||
|
using ICSharpCode.Decompiler; |
||||||
|
using ICSharpCode.Decompiler.Disassembler; |
||||||
|
using ICSharpCode.Decompiler.IL; |
||||||
|
using ICSharpCode.Decompiler.Metadata; |
||||||
|
using ICSharpCode.Decompiler.TypeSystem; |
||||||
|
using ICSharpCode.ILSpy.TextView; |
||||||
|
using ICSharpCode.ILSpy.TreeNodes; |
||||||
|
|
||||||
|
namespace ICSharpCode.ILSpy.Metadata |
||||||
|
{ |
||||||
|
internal class FieldLayoutTableTreeNode : ILSpyTreeNode |
||||||
|
{ |
||||||
|
private PEFile module; |
||||||
|
|
||||||
|
public FieldLayoutTableTreeNode(PEFile module) |
||||||
|
{ |
||||||
|
this.module = module; |
||||||
|
} |
||||||
|
|
||||||
|
public override object Text => $"10 FieldLayout ({module.Metadata.GetTableRowCount(TableIndex.FieldLayout)})"; |
||||||
|
|
||||||
|
public override object Icon => Images.Literal; |
||||||
|
|
||||||
|
public override bool View(DecompilerTextView textView) |
||||||
|
{ |
||||||
|
ListView view = Helpers.CreateListView("FieldLayoutsView"); |
||||||
|
var metadata = module.Metadata; |
||||||
|
|
||||||
|
var list = new List<FieldLayoutEntry>(); |
||||||
|
|
||||||
|
foreach (var row in metadata.GetFieldLayouts()) { |
||||||
|
FieldDefinition d = default; |
||||||
|
d.GetOffset(); |
||||||
|
list.Add(new FieldLayoutEntry(module, row)); |
||||||
|
} |
||||||
|
|
||||||
|
view.ItemsSource = list; |
||||||
|
|
||||||
|
textView.ShowContent(new[] { this }, view); |
||||||
|
return true; |
||||||
|
} |
||||||
|
|
||||||
|
struct FieldLayoutEntry |
||||||
|
{ |
||||||
|
readonly int metadataOffset; |
||||||
|
readonly PEFile module; |
||||||
|
readonly MetadataReader metadata; |
||||||
|
readonly EntityHandle handle; |
||||||
|
//readonly fieldDef;
|
||||||
|
|
||||||
|
public int RID => MetadataTokens.GetRowNumber(handle); |
||||||
|
|
||||||
|
public int Token => MetadataTokens.GetToken(handle); |
||||||
|
|
||||||
|
public int Offset => metadataOffset |
||||||
|
+ metadata.GetTableMetadataOffset(TableIndex.FieldLayout) |
||||||
|
+ metadata.GetTableRowSize(TableIndex.FieldLayout) * (RID - 1); |
||||||
|
|
||||||
|
//public int Attributes => (int)fieldDef.Attributes;
|
||||||
|
|
||||||
|
//public string AttributesTooltip => null; //Helpers.AttributesToString(fieldDef.Attributes);
|
||||||
|
|
||||||
|
//public int NameStringHandle => MetadataTokens.GetHeapOffset(fieldDef.Name);
|
||||||
|
|
||||||
|
//public string Name => metadata.GetString(fieldDef.Name);
|
||||||
|
|
||||||
|
//public int Signature => MetadataTokens.GetHeapOffset(fieldDef.Signature);
|
||||||
|
|
||||||
|
public string SignatureTooltip { |
||||||
|
get { |
||||||
|
ITextOutput output = new PlainTextOutput(); |
||||||
|
var context = new Decompiler.Metadata.GenericContext(default(TypeDefinitionHandle), module); |
||||||
|
((EntityHandle)handle).WriteTo(module, output, context); |
||||||
|
return output.ToString(); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public FieldLayoutEntry(PEFile module, EntityHandle handle) |
||||||
|
{ |
||||||
|
this.metadataOffset = module.Reader.PEHeaders.MetadataStartOffset; |
||||||
|
this.module = module; |
||||||
|
this.metadata = module.Metadata; |
||||||
|
this.handle = handle; |
||||||
|
//this.fieldDef = metadata.GetFieldLayoutinition(handle);
|
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public override void Decompile(Language language, ITextOutput output, DecompilationOptions options) |
||||||
|
{ |
||||||
|
language.WriteCommentLine(output, "FieldLayouts"); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -1,4 +1,22 @@ |
|||||||
using System; |
// Copyright (c) 2011 AlphaSierraPapa for the SharpDevelop Team
|
||||||
|
//
|
||||||
|
// Permission is hereby granted, free of charge, to any person obtaining a copy of this
|
||||||
|
// software and associated documentation files (the "Software"), to deal in the Software
|
||||||
|
// without restriction, including without limitation the rights to use, copy, modify, merge,
|
||||||
|
// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
|
||||||
|
// to whom the Software is furnished to do so, subject to the following conditions:
|
||||||
|
//
|
||||||
|
// The above copyright notice and this permission notice shall be included in all copies or
|
||||||
|
// substantial portions of the Software.
|
||||||
|
//
|
||||||
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||||
|
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
|
||||||
|
// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
|
||||||
|
// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||||
|
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||||
|
// DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
|
using System; |
||||||
using System.Collections.Generic; |
using System.Collections.Generic; |
||||||
using System.Linq; |
using System.Linq; |
||||||
using System.Reflection.Metadata; |
using System.Reflection.Metadata; |
@ -0,0 +1,116 @@ |
|||||||
|
// Copyright (c) 2011 AlphaSierraPapa for the SharpDevelop Team
|
||||||
|
//
|
||||||
|
// Permission is hereby granted, free of charge, to any person obtaining a copy of this
|
||||||
|
// software and associated documentation files (the "Software"), to deal in the Software
|
||||||
|
// without restriction, including without limitation the rights to use, copy, modify, merge,
|
||||||
|
// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
|
||||||
|
// to whom the Software is furnished to do so, subject to the following conditions:
|
||||||
|
//
|
||||||
|
// The above copyright notice and this permission notice shall be included in all copies or
|
||||||
|
// substantial portions of the Software.
|
||||||
|
//
|
||||||
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||||
|
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
|
||||||
|
// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
|
||||||
|
// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||||
|
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||||
|
// DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
|
using System; |
||||||
|
using System.Collections.Generic; |
||||||
|
using System.Linq; |
||||||
|
using System.Reflection.Metadata; |
||||||
|
using System.Reflection.Metadata.Ecma335; |
||||||
|
using System.Text; |
||||||
|
using System.Threading.Tasks; |
||||||
|
using System.Windows.Controls; |
||||||
|
using ICSharpCode.Decompiler; |
||||||
|
using ICSharpCode.Decompiler.Disassembler; |
||||||
|
using ICSharpCode.Decompiler.IL; |
||||||
|
using ICSharpCode.Decompiler.Metadata; |
||||||
|
using ICSharpCode.ILSpy.TextView; |
||||||
|
using ICSharpCode.ILSpy.TreeNodes; |
||||||
|
|
||||||
|
namespace ICSharpCode.ILSpy.Metadata |
||||||
|
{ |
||||||
|
class FileTableTreeNode : ILSpyTreeNode |
||||||
|
{ |
||||||
|
private PEFile module; |
||||||
|
|
||||||
|
public FileTableTreeNode(PEFile module) |
||||||
|
{ |
||||||
|
this.module = module; |
||||||
|
} |
||||||
|
|
||||||
|
public override object Text => $"26 File ({module.Metadata.GetTableRowCount(TableIndex.File)})"; |
||||||
|
|
||||||
|
public override object Icon => Images.Literal; |
||||||
|
|
||||||
|
public override bool View(DecompilerTextView textView) |
||||||
|
{ |
||||||
|
ListView view = Helpers.CreateListView("FilesView"); |
||||||
|
var metadata = module.Metadata; |
||||||
|
|
||||||
|
var list = new List<FileEntry>(); |
||||||
|
|
||||||
|
foreach (var row in metadata.AssemblyFiles) { |
||||||
|
list.Add(new FileEntry(module, row)); |
||||||
|
} |
||||||
|
|
||||||
|
view.ItemsSource = list; |
||||||
|
|
||||||
|
textView.ShowContent(new[] { this }, view); |
||||||
|
return true; |
||||||
|
} |
||||||
|
|
||||||
|
struct FileEntry |
||||||
|
{ |
||||||
|
readonly int metadataOffset; |
||||||
|
readonly PEFile module; |
||||||
|
readonly MetadataReader metadata; |
||||||
|
readonly AssemblyFileHandle handle; |
||||||
|
readonly AssemblyFile assemblyFile; |
||||||
|
|
||||||
|
public int RID => MetadataTokens.GetRowNumber(handle); |
||||||
|
|
||||||
|
public int Token => MetadataTokens.GetToken(handle); |
||||||
|
|
||||||
|
public int Offset => metadataOffset |
||||||
|
+ metadata.GetTableMetadataOffset(TableIndex.File) |
||||||
|
+ metadata.GetTableRowSize(TableIndex.File) * (RID - 1); |
||||||
|
|
||||||
|
public int Attributes => assemblyFile.ContainsMetadata ? 1 : 0; |
||||||
|
|
||||||
|
public string AttributesTooltip => assemblyFile.ContainsMetadata ? "ContainsMetaData" : "ContainsNoMetaData"; |
||||||
|
|
||||||
|
public int NameStringHandle => MetadataTokens.GetHeapOffset(assemblyFile.Name); |
||||||
|
|
||||||
|
public string Name => metadata.GetString(assemblyFile.Name); |
||||||
|
|
||||||
|
public int HashValue => MetadataTokens.GetHeapOffset(assemblyFile.HashValue); |
||||||
|
|
||||||
|
public string HashValueTooltip { |
||||||
|
get { |
||||||
|
if (assemblyFile.HashValue.IsNil) |
||||||
|
return null; |
||||||
|
System.Collections.Immutable.ImmutableArray<byte> token = metadata.GetBlobContent(assemblyFile.HashValue); |
||||||
|
return token.ToHexString(token.Length); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public FileEntry(PEFile module, AssemblyFileHandle handle) |
||||||
|
{ |
||||||
|
this.metadataOffset = module.Reader.PEHeaders.MetadataStartOffset; |
||||||
|
this.module = module; |
||||||
|
this.metadata = module.Metadata; |
||||||
|
this.handle = handle; |
||||||
|
this.assemblyFile = metadata.GetAssemblyFile(handle); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public override void Decompile(Language language, ITextOutput output, DecompilationOptions options) |
||||||
|
{ |
||||||
|
language.WriteCommentLine(output, "Files"); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,120 @@ |
|||||||
|
// Copyright (c) 2011 AlphaSierraPapa for the SharpDevelop Team
|
||||||
|
//
|
||||||
|
// Permission is hereby granted, free of charge, to any person obtaining a copy of this
|
||||||
|
// software and associated documentation files (the "Software"), to deal in the Software
|
||||||
|
// without restriction, including without limitation the rights to use, copy, modify, merge,
|
||||||
|
// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
|
||||||
|
// to whom the Software is furnished to do so, subject to the following conditions:
|
||||||
|
//
|
||||||
|
// The above copyright notice and this permission notice shall be included in all copies or
|
||||||
|
// substantial portions of the Software.
|
||||||
|
//
|
||||||
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||||
|
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
|
||||||
|
// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
|
||||||
|
// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||||
|
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||||
|
// DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
|
using System; |
||||||
|
using System.Collections.Generic; |
||||||
|
using System.Linq; |
||||||
|
using System.Reflection; |
||||||
|
using System.Reflection.Metadata; |
||||||
|
using System.Reflection.Metadata.Ecma335; |
||||||
|
using System.Text; |
||||||
|
using System.Windows.Controls; |
||||||
|
using System.Windows.Data; |
||||||
|
using ICSharpCode.Decompiler; |
||||||
|
using ICSharpCode.Decompiler.CSharp.Syntax; |
||||||
|
using ICSharpCode.Decompiler.Disassembler; |
||||||
|
using ICSharpCode.Decompiler.IL; |
||||||
|
using ICSharpCode.Decompiler.Metadata; |
||||||
|
using ICSharpCode.ILSpy.Controls; |
||||||
|
using ICSharpCode.ILSpy.TextView; |
||||||
|
using ICSharpCode.ILSpy.TreeNodes; |
||||||
|
using ICSharpCode.TreeView; |
||||||
|
|
||||||
|
namespace ICSharpCode.ILSpy.Metadata |
||||||
|
{ |
||||||
|
internal class GenericParamConstraintTableTreeNode : ILSpyTreeNode |
||||||
|
{ |
||||||
|
private PEFile module; |
||||||
|
|
||||||
|
public GenericParamConstraintTableTreeNode(PEFile module) |
||||||
|
{ |
||||||
|
this.module = module; |
||||||
|
} |
||||||
|
|
||||||
|
public override object Text => $"2C GenericParamConstraint ({module.Metadata.GetTableRowCount(TableIndex.GenericParamConstraint)})"; |
||||||
|
|
||||||
|
public override object Icon => Images.Literal; |
||||||
|
|
||||||
|
public override bool View(DecompilerTextView textView) |
||||||
|
{ |
||||||
|
ListView view = Helpers.CreateListView("GenericParamConstraintsView"); |
||||||
|
var metadata = module.Metadata; |
||||||
|
|
||||||
|
var list = new List<GenericParamConstraintEntry>(); |
||||||
|
|
||||||
|
for (int row = 1; row <= module.Metadata.GetTableRowCount(TableIndex.GenericParamConstraint); row++) { |
||||||
|
list.Add(new GenericParamConstraintEntry(module, MetadataTokens.GenericParameterConstraintHandle(row))); |
||||||
|
} |
||||||
|
view.ItemsSource = list; |
||||||
|
|
||||||
|
textView.ShowContent(new[] { this }, view); |
||||||
|
return true; |
||||||
|
} |
||||||
|
|
||||||
|
struct GenericParamConstraintEntry |
||||||
|
{ |
||||||
|
readonly int metadataOffset; |
||||||
|
readonly PEFile module; |
||||||
|
readonly MetadataReader metadata; |
||||||
|
readonly GenericParameterConstraintHandle handle; |
||||||
|
readonly GenericParameterConstraint genericParamConstraint; |
||||||
|
|
||||||
|
public int RID => MetadataTokens.GetRowNumber(handle); |
||||||
|
|
||||||
|
public int Token => MetadataTokens.GetToken(handle); |
||||||
|
|
||||||
|
public int Offset => metadataOffset |
||||||
|
+ metadata.GetTableMetadataOffset(TableIndex.GenericParamConstraint) |
||||||
|
+ metadata.GetTableRowSize(TableIndex.GenericParamConstraint) * (RID-1); |
||||||
|
|
||||||
|
public int OwnerHandle => MetadataTokens.GetToken(genericParamConstraint.Parameter); |
||||||
|
|
||||||
|
public string Owner { |
||||||
|
get { |
||||||
|
ITextOutput output = new PlainTextOutput(); |
||||||
|
((EntityHandle)genericParamConstraint.Parameter).WriteTo(module, output, GenericContext.Empty); |
||||||
|
return output.ToString(); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public int Type => MetadataTokens.GetToken(genericParamConstraint.Type); |
||||||
|
|
||||||
|
public string TypeTooltip { |
||||||
|
get { |
||||||
|
ITextOutput output = new PlainTextOutput(); |
||||||
|
genericParamConstraint.Type.WriteTo(module, output, GenericContext.Empty); |
||||||
|
return output.ToString(); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public GenericParamConstraintEntry(PEFile module, GenericParameterConstraintHandle handle) |
||||||
|
{ |
||||||
|
this.metadataOffset = module.Reader.PEHeaders.MetadataStartOffset; |
||||||
|
this.module = module; |
||||||
|
this.metadata = module.Metadata; |
||||||
|
this.handle = handle; |
||||||
|
this.genericParamConstraint = metadata.GetGenericParameterConstraint(handle); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public override void Decompile(Language language, ITextOutput output, DecompilationOptions options) |
||||||
|
{ |
||||||
|
language.WriteCommentLine(output, "GenericParamConstraints"); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,120 @@ |
|||||||
|
// Copyright (c) 2011 AlphaSierraPapa for the SharpDevelop Team
|
||||||
|
//
|
||||||
|
// Permission is hereby granted, free of charge, to any person obtaining a copy of this
|
||||||
|
// software and associated documentation files (the "Software"), to deal in the Software
|
||||||
|
// without restriction, including without limitation the rights to use, copy, modify, merge,
|
||||||
|
// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
|
||||||
|
// to whom the Software is furnished to do so, subject to the following conditions:
|
||||||
|
//
|
||||||
|
// The above copyright notice and this permission notice shall be included in all copies or
|
||||||
|
// substantial portions of the Software.
|
||||||
|
//
|
||||||
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||||
|
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
|
||||||
|
// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
|
||||||
|
// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||||
|
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||||
|
// DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
|
using System; |
||||||
|
using System.Collections.Generic; |
||||||
|
using System.Linq; |
||||||
|
using System.Reflection; |
||||||
|
using System.Reflection.Metadata; |
||||||
|
using System.Reflection.Metadata.Ecma335; |
||||||
|
using System.Text; |
||||||
|
using System.Windows.Controls; |
||||||
|
using System.Windows.Data; |
||||||
|
using ICSharpCode.Decompiler; |
||||||
|
using ICSharpCode.Decompiler.CSharp.Syntax; |
||||||
|
using ICSharpCode.Decompiler.Disassembler; |
||||||
|
using ICSharpCode.Decompiler.IL; |
||||||
|
using ICSharpCode.Decompiler.Metadata; |
||||||
|
using ICSharpCode.ILSpy.Controls; |
||||||
|
using ICSharpCode.ILSpy.TextView; |
||||||
|
using ICSharpCode.ILSpy.TreeNodes; |
||||||
|
using ICSharpCode.TreeView; |
||||||
|
|
||||||
|
namespace ICSharpCode.ILSpy.Metadata |
||||||
|
{ |
||||||
|
internal class GenericParamTableTreeNode : ILSpyTreeNode |
||||||
|
{ |
||||||
|
private PEFile module; |
||||||
|
|
||||||
|
public GenericParamTableTreeNode(PEFile module) |
||||||
|
{ |
||||||
|
this.module = module; |
||||||
|
} |
||||||
|
|
||||||
|
public override object Text => $"2A GenericParam ({module.Metadata.GetTableRowCount(TableIndex.GenericParam)})"; |
||||||
|
|
||||||
|
public override object Icon => Images.Literal; |
||||||
|
|
||||||
|
public override bool View(DecompilerTextView textView) |
||||||
|
{ |
||||||
|
ListView view = Helpers.CreateListView("GenericParamsView"); |
||||||
|
var metadata = module.Metadata; |
||||||
|
|
||||||
|
var list = new List<GenericParamEntry>(); |
||||||
|
|
||||||
|
for (int row = 1; row <= module.Metadata.GetTableRowCount(TableIndex.GenericParam); row++) { |
||||||
|
list.Add(new GenericParamEntry(module, MetadataTokens.GenericParameterHandle(row))); |
||||||
|
} |
||||||
|
view.ItemsSource = list; |
||||||
|
|
||||||
|
textView.ShowContent(new[] { this }, view); |
||||||
|
return true; |
||||||
|
} |
||||||
|
|
||||||
|
struct GenericParamEntry |
||||||
|
{ |
||||||
|
readonly int metadataOffset; |
||||||
|
readonly PEFile module; |
||||||
|
readonly MetadataReader metadata; |
||||||
|
readonly GenericParameterHandle handle; |
||||||
|
readonly GenericParameter genericParam; |
||||||
|
|
||||||
|
public int RID => MetadataTokens.GetRowNumber(handle); |
||||||
|
|
||||||
|
public int Token => MetadataTokens.GetToken(handle); |
||||||
|
|
||||||
|
public int Offset => metadataOffset |
||||||
|
+ metadata.GetTableMetadataOffset(TableIndex.GenericParam) |
||||||
|
+ metadata.GetTableRowSize(TableIndex.GenericParam) * (RID-1); |
||||||
|
|
||||||
|
public int Number => genericParam.Index; |
||||||
|
|
||||||
|
public int Attributes => (int)genericParam.Attributes; |
||||||
|
|
||||||
|
public string AttributesTooltip => null; // TODO
|
||||||
|
|
||||||
|
public int OwnerHandle => MetadataTokens.GetToken(genericParam.Parent); |
||||||
|
|
||||||
|
public string Owner { |
||||||
|
get { |
||||||
|
ITextOutput output = new PlainTextOutput(); |
||||||
|
genericParam.Parent.WriteTo(module, output, GenericContext.Empty); |
||||||
|
return output.ToString(); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public int NameStringHandle => MetadataTokens.GetHeapOffset(genericParam.Name); |
||||||
|
|
||||||
|
public string Name => metadata.GetString(genericParam.Name); |
||||||
|
|
||||||
|
public GenericParamEntry(PEFile module, GenericParameterHandle handle) |
||||||
|
{ |
||||||
|
this.metadataOffset = module.Reader.PEHeaders.MetadataStartOffset; |
||||||
|
this.module = module; |
||||||
|
this.metadata = module.Metadata; |
||||||
|
this.handle = handle; |
||||||
|
this.genericParam = metadata.GetGenericParameter(handle); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public override void Decompile(Language language, ITextOutput output, DecompilationOptions options) |
||||||
|
{ |
||||||
|
language.WriteCommentLine(output, "GenericParams"); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,118 @@ |
|||||||
|
// Copyright (c) 2011 AlphaSierraPapa for the SharpDevelop Team
|
||||||
|
//
|
||||||
|
// Permission is hereby granted, free of charge, to any person obtaining a copy of this
|
||||||
|
// software and associated documentation files (the "Software"), to deal in the Software
|
||||||
|
// without restriction, including without limitation the rights to use, copy, modify, merge,
|
||||||
|
// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
|
||||||
|
// to whom the Software is furnished to do so, subject to the following conditions:
|
||||||
|
//
|
||||||
|
// The above copyright notice and this permission notice shall be included in all copies or
|
||||||
|
// substantial portions of the Software.
|
||||||
|
//
|
||||||
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||||
|
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
|
||||||
|
// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
|
||||||
|
// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||||
|
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||||
|
// DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
|
using System; |
||||||
|
using System.Collections.Generic; |
||||||
|
using System.Linq; |
||||||
|
using System.Reflection.Metadata; |
||||||
|
using System.Reflection.Metadata.Ecma335; |
||||||
|
using System.Text; |
||||||
|
using System.Threading.Tasks; |
||||||
|
using System.Windows.Controls; |
||||||
|
using ICSharpCode.Decompiler; |
||||||
|
using ICSharpCode.Decompiler.Disassembler; |
||||||
|
using ICSharpCode.Decompiler.IL; |
||||||
|
using ICSharpCode.Decompiler.Metadata; |
||||||
|
using ICSharpCode.ILSpy.TextView; |
||||||
|
using ICSharpCode.ILSpy.TreeNodes; |
||||||
|
|
||||||
|
namespace ICSharpCode.ILSpy.Metadata |
||||||
|
{ |
||||||
|
class ManifestResourceTableTreeNode : ILSpyTreeNode |
||||||
|
{ |
||||||
|
private PEFile module; |
||||||
|
|
||||||
|
public ManifestResourceTableTreeNode(PEFile module) |
||||||
|
{ |
||||||
|
this.module = module; |
||||||
|
} |
||||||
|
|
||||||
|
public override object Text => $"28 ManifestResource ({module.Metadata.GetTableRowCount(TableIndex.ManifestResource)})"; |
||||||
|
|
||||||
|
public override object Icon => Images.Literal; |
||||||
|
|
||||||
|
public override bool View(DecompilerTextView textView) |
||||||
|
{ |
||||||
|
ListView view = Helpers.CreateListView("ManifestResourcesView"); |
||||||
|
var metadata = module.Metadata; |
||||||
|
|
||||||
|
var list = new List<ManifestResourceEntry>(); |
||||||
|
|
||||||
|
foreach (var row in metadata.ManifestResources) { |
||||||
|
list.Add(new ManifestResourceEntry(module, row)); |
||||||
|
} |
||||||
|
|
||||||
|
view.ItemsSource = list; |
||||||
|
|
||||||
|
textView.ShowContent(new[] { this }, view); |
||||||
|
return true; |
||||||
|
} |
||||||
|
|
||||||
|
struct ManifestResourceEntry |
||||||
|
{ |
||||||
|
readonly int metadataOffset; |
||||||
|
readonly PEFile module; |
||||||
|
readonly MetadataReader metadata; |
||||||
|
readonly ManifestResourceHandle handle; |
||||||
|
readonly ManifestResource manifestResource; |
||||||
|
|
||||||
|
public int RID => MetadataTokens.GetRowNumber(handle); |
||||||
|
|
||||||
|
public int Token => MetadataTokens.GetToken(handle); |
||||||
|
|
||||||
|
public int Offset => metadataOffset |
||||||
|
+ metadata.GetTableMetadataOffset(TableIndex.ManifestResource) |
||||||
|
+ metadata.GetTableRowSize(TableIndex.ManifestResource) * (RID - 1); |
||||||
|
|
||||||
|
public int Attributes => (int)manifestResource.Attributes; |
||||||
|
|
||||||
|
public string AttributesTooltip => null; // TODO : Helpers.AttributesToString(manifestResource.Attributes);
|
||||||
|
|
||||||
|
public int NameStringHandle => MetadataTokens.GetHeapOffset(manifestResource.Name); |
||||||
|
|
||||||
|
public string Name => metadata.GetString(manifestResource.Name); |
||||||
|
|
||||||
|
public int ImplementationHandle => MetadataTokens.GetToken(manifestResource.Implementation); |
||||||
|
|
||||||
|
public string ImplementationTooltip { |
||||||
|
get { |
||||||
|
if (manifestResource.Implementation.IsNil) |
||||||
|
return null; |
||||||
|
ITextOutput output = new PlainTextOutput(); |
||||||
|
var context = new GenericContext(default(TypeDefinitionHandle), module); |
||||||
|
manifestResource.Implementation.WriteTo(module, output, context); |
||||||
|
return output.ToString(); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public ManifestResourceEntry(PEFile module, ManifestResourceHandle handle) |
||||||
|
{ |
||||||
|
this.metadataOffset = module.Reader.PEHeaders.MetadataStartOffset; |
||||||
|
this.module = module; |
||||||
|
this.metadata = module.Metadata; |
||||||
|
this.handle = handle; |
||||||
|
this.manifestResource = metadata.GetManifestResource(handle); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public override void Decompile(Language language, ITextOutput output, DecompilationOptions options) |
||||||
|
{ |
||||||
|
language.WriteCommentLine(output, "ManifestResources"); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,122 @@ |
|||||||
|
// Copyright (c) 2011 AlphaSierraPapa for the SharpDevelop Team
|
||||||
|
//
|
||||||
|
// Permission is hereby granted, free of charge, to any person obtaining a copy of this
|
||||||
|
// software and associated documentation files (the "Software"), to deal in the Software
|
||||||
|
// without restriction, including without limitation the rights to use, copy, modify, merge,
|
||||||
|
// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
|
||||||
|
// to whom the Software is furnished to do so, subject to the following conditions:
|
||||||
|
//
|
||||||
|
// The above copyright notice and this permission notice shall be included in all copies or
|
||||||
|
// substantial portions of the Software.
|
||||||
|
//
|
||||||
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||||
|
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
|
||||||
|
// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
|
||||||
|
// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||||
|
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||||
|
// DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
|
using System; |
||||||
|
using System.Collections.Generic; |
||||||
|
using System.Linq; |
||||||
|
using System.Reflection.Metadata; |
||||||
|
using System.Reflection.Metadata.Ecma335; |
||||||
|
using System.Text; |
||||||
|
using System.Threading.Tasks; |
||||||
|
using System.Windows.Controls; |
||||||
|
using ICSharpCode.Decompiler; |
||||||
|
using ICSharpCode.Decompiler.IL; |
||||||
|
using ICSharpCode.Decompiler.Disassembler; |
||||||
|
using ICSharpCode.Decompiler.Metadata; |
||||||
|
using ICSharpCode.Decompiler.TypeSystem; |
||||||
|
using ICSharpCode.ILSpy.TextView; |
||||||
|
using ICSharpCode.ILSpy.TreeNodes; |
||||||
|
|
||||||
|
namespace ICSharpCode.ILSpy.Metadata |
||||||
|
{ |
||||||
|
internal class MemberRefTableTreeNode : ILSpyTreeNode |
||||||
|
{ |
||||||
|
private PEFile module; |
||||||
|
|
||||||
|
public MemberRefTableTreeNode(PEFile module) |
||||||
|
{ |
||||||
|
this.module = module; |
||||||
|
} |
||||||
|
|
||||||
|
public override object Text => $"0A MemberRef ({module.Metadata.GetTableRowCount(TableIndex.MemberRef)})"; |
||||||
|
|
||||||
|
public override object Icon => Images.Literal; |
||||||
|
|
||||||
|
public override bool View(DecompilerTextView textView) |
||||||
|
{ |
||||||
|
ListView view = Helpers.CreateListView("MemberRefsView"); |
||||||
|
var metadata = module.Metadata; |
||||||
|
|
||||||
|
var list = new List<MemberRefEntry>(); |
||||||
|
|
||||||
|
foreach (var row in metadata.MemberReferences) |
||||||
|
list.Add(new MemberRefEntry(module, row)); |
||||||
|
|
||||||
|
view.ItemsSource = list; |
||||||
|
|
||||||
|
textView.ShowContent(new[] { this }, view); |
||||||
|
return true; |
||||||
|
} |
||||||
|
|
||||||
|
struct MemberRefEntry |
||||||
|
{ |
||||||
|
readonly int metadataOffset; |
||||||
|
readonly PEFile module; |
||||||
|
readonly MetadataReader metadata; |
||||||
|
readonly MemberReferenceHandle handle; |
||||||
|
readonly MemberReference memberRef; |
||||||
|
|
||||||
|
public int RID => MetadataTokens.GetRowNumber(handle); |
||||||
|
|
||||||
|
public int Token => MetadataTokens.GetToken(handle); |
||||||
|
|
||||||
|
public int Offset => metadataOffset |
||||||
|
+ metadata.GetTableMetadataOffset(TableIndex.MemberRef) |
||||||
|
+ metadata.GetTableRowSize(TableIndex.MemberRef) * (RID - 1); |
||||||
|
|
||||||
|
public int ParentHandle => MetadataTokens.GetToken(memberRef.Parent); |
||||||
|
|
||||||
|
public string ParentTooltip { |
||||||
|
get { |
||||||
|
ITextOutput output = new PlainTextOutput(); |
||||||
|
memberRef.Parent.WriteTo(module, output, Decompiler.Metadata.GenericContext.Empty); |
||||||
|
return output.ToString(); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public int NameStringHandle => MetadataTokens.GetHeapOffset(memberRef.Name); |
||||||
|
|
||||||
|
public string Name => metadata.GetString(memberRef.Name); |
||||||
|
|
||||||
|
public int Signature => MetadataTokens.GetHeapOffset(memberRef.Signature); |
||||||
|
|
||||||
|
public string SignatureTooltip { |
||||||
|
get { |
||||||
|
ITextOutput output = new PlainTextOutput(); |
||||||
|
var context = new Decompiler.Metadata.GenericContext(default(TypeDefinitionHandle), module); |
||||||
|
((EntityHandle)handle).WriteTo(module, output, context); |
||||||
|
return output.ToString(); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public MemberRefEntry(PEFile module, MemberReferenceHandle handle) |
||||||
|
{ |
||||||
|
this.metadataOffset = module.Reader.PEHeaders.MetadataStartOffset; |
||||||
|
this.module = module; |
||||||
|
this.metadata = module.Metadata; |
||||||
|
this.handle = handle; |
||||||
|
this.memberRef = metadata.GetMemberReference(handle); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public override void Decompile(Language language, ITextOutput output, DecompilationOptions options) |
||||||
|
{ |
||||||
|
language.WriteCommentLine(output, "MemberRefs"); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,126 @@ |
|||||||
|
// Copyright (c) 2011 AlphaSierraPapa for the SharpDevelop Team
|
||||||
|
//
|
||||||
|
// Permission is hereby granted, free of charge, to any person obtaining a copy of this
|
||||||
|
// software and associated documentation files (the "Software"), to deal in the Software
|
||||||
|
// without restriction, including without limitation the rights to use, copy, modify, merge,
|
||||||
|
// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
|
||||||
|
// to whom the Software is furnished to do so, subject to the following conditions:
|
||||||
|
//
|
||||||
|
// The above copyright notice and this permission notice shall be included in all copies or
|
||||||
|
// substantial portions of the Software.
|
||||||
|
//
|
||||||
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||||
|
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
|
||||||
|
// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
|
||||||
|
// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||||
|
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||||
|
// DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
|
using System; |
||||||
|
using System.Collections.Generic; |
||||||
|
using System.Linq; |
||||||
|
using System.Reflection.Metadata; |
||||||
|
using System.Reflection.Metadata.Ecma335; |
||||||
|
using System.Text; |
||||||
|
using System.Threading.Tasks; |
||||||
|
using System.Windows.Controls; |
||||||
|
using ICSharpCode.Decompiler; |
||||||
|
using ICSharpCode.Decompiler.IL; |
||||||
|
using ICSharpCode.Decompiler.Disassembler; |
||||||
|
using ICSharpCode.Decompiler.Metadata; |
||||||
|
using ICSharpCode.Decompiler.TypeSystem; |
||||||
|
using ICSharpCode.ILSpy.TextView; |
||||||
|
using ICSharpCode.ILSpy.TreeNodes; |
||||||
|
using System.Reflection; |
||||||
|
|
||||||
|
namespace ICSharpCode.ILSpy.Metadata |
||||||
|
{ |
||||||
|
internal class MethodSemanticsTableTreeNode : ILSpyTreeNode |
||||||
|
{ |
||||||
|
private PEFile module; |
||||||
|
|
||||||
|
public MethodSemanticsTableTreeNode(PEFile module) |
||||||
|
{ |
||||||
|
this.module = module; |
||||||
|
} |
||||||
|
|
||||||
|
public override object Text => $"18 MethodSemantics ({module.Metadata.GetTableRowCount(TableIndex.MethodSemantics)})"; |
||||||
|
|
||||||
|
public override object Icon => Images.Literal; |
||||||
|
|
||||||
|
public override bool View(DecompilerTextView textView) |
||||||
|
{ |
||||||
|
ListView view = Helpers.CreateListView("MethodSemanticsView"); |
||||||
|
var metadata = module.Metadata; |
||||||
|
|
||||||
|
var list = new List<MethodSemanticsEntry>(); |
||||||
|
|
||||||
|
foreach (var row in metadata.GetMethodSemantics()) |
||||||
|
list.Add(new MethodSemanticsEntry(module, row.Handle, row.Semantics, row.Method, row.Association)); |
||||||
|
|
||||||
|
view.ItemsSource = list; |
||||||
|
|
||||||
|
textView.ShowContent(new[] { this }, view); |
||||||
|
return true; |
||||||
|
} |
||||||
|
|
||||||
|
struct MethodSemanticsEntry |
||||||
|
{ |
||||||
|
readonly int metadataOffset; |
||||||
|
readonly PEFile module; |
||||||
|
readonly MetadataReader metadata; |
||||||
|
readonly Handle handle; |
||||||
|
readonly MethodSemanticsAttributes semantics; |
||||||
|
readonly MethodDefinitionHandle method; |
||||||
|
readonly EntityHandle association; |
||||||
|
|
||||||
|
public int RID => MetadataTokens.GetToken(handle) & 0xFFFFFF; |
||||||
|
|
||||||
|
public int Token => MetadataTokens.GetToken(handle); |
||||||
|
|
||||||
|
public int Offset => metadataOffset |
||||||
|
+ metadata.GetTableMetadataOffset(TableIndex.MethodDef) |
||||||
|
+ metadata.GetTableRowSize(TableIndex.MethodDef) * (RID - 1); |
||||||
|
|
||||||
|
public int Semantics => (int)semantics; |
||||||
|
|
||||||
|
public string SemanticsTooltip => semantics.ToString(); |
||||||
|
|
||||||
|
public int MethodHandle => MetadataTokens.GetToken(method); |
||||||
|
|
||||||
|
public string Method { |
||||||
|
get { |
||||||
|
ITextOutput output = new PlainTextOutput(); |
||||||
|
((EntityHandle)method).WriteTo(module, output, Decompiler.Metadata.GenericContext.Empty); |
||||||
|
return output.ToString(); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public int AssociationHandle => MetadataTokens.GetToken(association); |
||||||
|
|
||||||
|
public string Association { |
||||||
|
get { |
||||||
|
ITextOutput output = new PlainTextOutput(); |
||||||
|
association.WriteTo(module, output, Decompiler.Metadata.GenericContext.Empty); |
||||||
|
return output.ToString(); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public MethodSemanticsEntry(PEFile module, Handle handle, MethodSemanticsAttributes semantics, MethodDefinitionHandle method, EntityHandle association) |
||||||
|
{ |
||||||
|
this.metadataOffset = module.Reader.PEHeaders.MetadataStartOffset; |
||||||
|
this.module = module; |
||||||
|
this.metadata = module.Metadata; |
||||||
|
this.handle = handle; |
||||||
|
this.semantics = semantics; |
||||||
|
this.method = method; |
||||||
|
this.association = association; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public override void Decompile(Language language, ITextOutput output, DecompilationOptions options) |
||||||
|
{ |
||||||
|
language.WriteCommentLine(output, "MethodDefs"); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,128 @@ |
|||||||
|
// Copyright (c) 2011 AlphaSierraPapa for the SharpDevelop Team
|
||||||
|
//
|
||||||
|
// Permission is hereby granted, free of charge, to any person obtaining a copy of this
|
||||||
|
// software and associated documentation files (the "Software"), to deal in the Software
|
||||||
|
// without restriction, including without limitation the rights to use, copy, modify, merge,
|
||||||
|
// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
|
||||||
|
// to whom the Software is furnished to do so, subject to the following conditions:
|
||||||
|
//
|
||||||
|
// The above copyright notice and this permission notice shall be included in all copies or
|
||||||
|
// substantial portions of the Software.
|
||||||
|
//
|
||||||
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||||
|
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
|
||||||
|
// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
|
||||||
|
// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||||
|
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||||
|
// DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
|
using System; |
||||||
|
using System.Collections.Generic; |
||||||
|
using System.Linq; |
||||||
|
using System.Reflection; |
||||||
|
using System.Reflection.Metadata; |
||||||
|
using System.Reflection.Metadata.Ecma335; |
||||||
|
using System.Text; |
||||||
|
using System.Windows.Controls; |
||||||
|
using System.Windows.Data; |
||||||
|
using ICSharpCode.Decompiler; |
||||||
|
using ICSharpCode.Decompiler.CSharp.Syntax; |
||||||
|
using ICSharpCode.Decompiler.Disassembler; |
||||||
|
using ICSharpCode.Decompiler.IL; |
||||||
|
using ICSharpCode.Decompiler.Metadata; |
||||||
|
using ICSharpCode.ILSpy.Controls; |
||||||
|
using ICSharpCode.ILSpy.TextView; |
||||||
|
using ICSharpCode.ILSpy.TreeNodes; |
||||||
|
using ICSharpCode.TreeView; |
||||||
|
|
||||||
|
namespace ICSharpCode.ILSpy.Metadata |
||||||
|
{ |
||||||
|
internal class MethodSpecTableTreeNode : ILSpyTreeNode |
||||||
|
{ |
||||||
|
private PEFile module; |
||||||
|
|
||||||
|
public MethodSpecTableTreeNode(PEFile module) |
||||||
|
{ |
||||||
|
this.module = module; |
||||||
|
} |
||||||
|
|
||||||
|
public override object Text => $"2B MethodSpec ({module.Metadata.GetTableRowCount(TableIndex.MethodSpec)})"; |
||||||
|
|
||||||
|
public override object Icon => Images.Literal; |
||||||
|
|
||||||
|
public override bool View(DecompilerTextView textView) |
||||||
|
{ |
||||||
|
ListView view = Helpers.CreateListView("MethodSpecsView"); |
||||||
|
var metadata = module.Metadata; |
||||||
|
|
||||||
|
var list = new List<MethodSpecEntry>(); |
||||||
|
|
||||||
|
foreach (var row in metadata.GetMethodSpecifications()) |
||||||
|
list.Add(new MethodSpecEntry(module, row)); |
||||||
|
|
||||||
|
view.ItemsSource = list; |
||||||
|
|
||||||
|
textView.ShowContent(new[] { this }, view); |
||||||
|
return true; |
||||||
|
} |
||||||
|
|
||||||
|
struct MethodSpecEntry |
||||||
|
{ |
||||||
|
readonly int metadataOffset; |
||||||
|
readonly PEFile module; |
||||||
|
readonly MetadataReader metadata; |
||||||
|
readonly MethodSpecificationHandle handle; |
||||||
|
readonly MethodSpecification methodSpec; |
||||||
|
|
||||||
|
public int RID => MetadataTokens.GetRowNumber(handle); |
||||||
|
|
||||||
|
public int Token => MetadataTokens.GetToken(handle); |
||||||
|
|
||||||
|
public int Offset => metadataOffset |
||||||
|
+ metadata.GetTableMetadataOffset(TableIndex.MethodSpec) |
||||||
|
+ metadata.GetTableRowSize(TableIndex.MethodSpec) * (RID-1); |
||||||
|
|
||||||
|
public int MethodHandle => MetadataTokens.GetToken(methodSpec.Method); |
||||||
|
|
||||||
|
public string Method { |
||||||
|
get { |
||||||
|
ITextOutput output = new PlainTextOutput(); |
||||||
|
methodSpec.Method.WriteTo(module, output, GenericContext.Empty); |
||||||
|
return output.ToString(); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public int Signature => MetadataTokens.GetHeapOffset(methodSpec.Signature); |
||||||
|
|
||||||
|
public string SignatureTooltip { |
||||||
|
get { |
||||||
|
ITextOutput output = new PlainTextOutput(); |
||||||
|
var signature = methodSpec.DecodeSignature(new DisassemblerSignatureProvider(module, output), GenericContext.Empty); |
||||||
|
bool first = true; |
||||||
|
foreach (var type in signature) { |
||||||
|
if (first) |
||||||
|
first = false; |
||||||
|
else |
||||||
|
output.Write(", "); |
||||||
|
type(ILNameSyntax.TypeName); |
||||||
|
} |
||||||
|
return output.ToString(); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public MethodSpecEntry(PEFile module, MethodSpecificationHandle handle) |
||||||
|
{ |
||||||
|
this.metadataOffset = module.Reader.PEHeaders.MetadataStartOffset; |
||||||
|
this.module = module; |
||||||
|
this.metadata = module.Metadata; |
||||||
|
this.handle = handle; |
||||||
|
this.methodSpec = metadata.GetMethodSpecification(handle); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public override void Decompile(Language language, ITextOutput output, DecompilationOptions options) |
||||||
|
{ |
||||||
|
language.WriteCommentLine(output, "MethodSpecs"); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -1,4 +1,22 @@ |
|||||||
using System; |
// Copyright (c) 2011 AlphaSierraPapa for the SharpDevelop Team
|
||||||
|
//
|
||||||
|
// Permission is hereby granted, free of charge, to any person obtaining a copy of this
|
||||||
|
// software and associated documentation files (the "Software"), to deal in the Software
|
||||||
|
// without restriction, including without limitation the rights to use, copy, modify, merge,
|
||||||
|
// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
|
||||||
|
// to whom the Software is furnished to do so, subject to the following conditions:
|
||||||
|
//
|
||||||
|
// The above copyright notice and this permission notice shall be included in all copies or
|
||||||
|
// substantial portions of the Software.
|
||||||
|
//
|
||||||
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||||
|
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
|
||||||
|
// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
|
||||||
|
// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||||
|
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||||
|
// DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
|
using System; |
||||||
using System.Collections.Generic; |
using System.Collections.Generic; |
||||||
using System.Linq; |
using System.Linq; |
||||||
using System.Reflection.Metadata; |
using System.Reflection.Metadata; |
@ -0,0 +1,102 @@ |
|||||||
|
// Copyright (c) 2011 AlphaSierraPapa for the SharpDevelop Team
|
||||||
|
//
|
||||||
|
// Permission is hereby granted, free of charge, to any person obtaining a copy of this
|
||||||
|
// software and associated documentation files (the "Software"), to deal in the Software
|
||||||
|
// without restriction, including without limitation the rights to use, copy, modify, merge,
|
||||||
|
// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
|
||||||
|
// to whom the Software is furnished to do so, subject to the following conditions:
|
||||||
|
//
|
||||||
|
// The above copyright notice and this permission notice shall be included in all copies or
|
||||||
|
// substantial portions of the Software.
|
||||||
|
//
|
||||||
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||||
|
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
|
||||||
|
// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
|
||||||
|
// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||||
|
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||||
|
// DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
|
using System; |
||||||
|
using System.Collections.Generic; |
||||||
|
using System.Linq; |
||||||
|
using System.Reflection; |
||||||
|
using System.Reflection.Metadata; |
||||||
|
using System.Reflection.Metadata.Ecma335; |
||||||
|
using System.Text; |
||||||
|
using System.Windows.Controls; |
||||||
|
using System.Windows.Data; |
||||||
|
using ICSharpCode.Decompiler; |
||||||
|
using ICSharpCode.Decompiler.CSharp.Syntax; |
||||||
|
using ICSharpCode.Decompiler.Metadata; |
||||||
|
using ICSharpCode.ILSpy.Controls; |
||||||
|
using ICSharpCode.ILSpy.TextView; |
||||||
|
using ICSharpCode.ILSpy.TreeNodes; |
||||||
|
using ICSharpCode.TreeView; |
||||||
|
|
||||||
|
namespace ICSharpCode.ILSpy.Metadata |
||||||
|
{ |
||||||
|
internal class ModuleRefTableTreeNode : ILSpyTreeNode |
||||||
|
{ |
||||||
|
private PEFile module; |
||||||
|
|
||||||
|
public ModuleRefTableTreeNode(PEFile module) |
||||||
|
{ |
||||||
|
this.module = module; |
||||||
|
} |
||||||
|
|
||||||
|
public override object Text => $"1A ModuleRef ({module.Metadata.GetTableRowCount(TableIndex.ModuleRef)})"; |
||||||
|
|
||||||
|
public override object Icon => Images.Literal; |
||||||
|
|
||||||
|
public override bool View(DecompilerTextView textView) |
||||||
|
{ |
||||||
|
ListView view = Helpers.CreateListView("ModuleRefsView"); |
||||||
|
var metadata = module.Metadata; |
||||||
|
|
||||||
|
var list = new List<ModuleRefEntry>(); |
||||||
|
|
||||||
|
foreach (var row in metadata.GetModuleReferences()) |
||||||
|
list.Add(new ModuleRefEntry(module, row)); |
||||||
|
|
||||||
|
view.ItemsSource = list; |
||||||
|
|
||||||
|
textView.ShowContent(new[] { this }, view); |
||||||
|
return true; |
||||||
|
} |
||||||
|
|
||||||
|
struct ModuleRefEntry |
||||||
|
{ |
||||||
|
readonly int metadataOffset; |
||||||
|
readonly PEFile module; |
||||||
|
readonly MetadataReader metadata; |
||||||
|
readonly ModuleReferenceHandle handle; |
||||||
|
readonly ModuleReference moduleRef; |
||||||
|
|
||||||
|
public int RID => MetadataTokens.GetRowNumber(handle); |
||||||
|
|
||||||
|
public int Token => MetadataTokens.GetToken(handle); |
||||||
|
|
||||||
|
public int Offset => metadataOffset |
||||||
|
+ metadata.GetTableMetadataOffset(TableIndex.ModuleRef) |
||||||
|
+ metadata.GetTableRowSize(TableIndex.ModuleRef) * (RID-1); |
||||||
|
|
||||||
|
public int NameStringHandle => MetadataTokens.GetHeapOffset(moduleRef.Name); |
||||||
|
|
||||||
|
public string Name => metadata.GetString(moduleRef.Name); |
||||||
|
|
||||||
|
public ModuleRefEntry(PEFile module, ModuleReferenceHandle handle) |
||||||
|
{ |
||||||
|
this.metadataOffset = module.Reader.PEHeaders.MetadataStartOffset; |
||||||
|
this.module = module; |
||||||
|
this.metadata = module.Metadata; |
||||||
|
this.handle = handle; |
||||||
|
this.moduleRef = metadata.GetModuleReference(handle); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public override void Decompile(Language language, ITextOutput output, DecompilationOptions options) |
||||||
|
{ |
||||||
|
language.WriteCommentLine(output, "ModuleRefs"); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,115 @@ |
|||||||
|
// Copyright (c) 2011 AlphaSierraPapa for the SharpDevelop Team
|
||||||
|
//
|
||||||
|
// Permission is hereby granted, free of charge, to any person obtaining a copy of this
|
||||||
|
// software and associated documentation files (the "Software"), to deal in the Software
|
||||||
|
// without restriction, including without limitation the rights to use, copy, modify, merge,
|
||||||
|
// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
|
||||||
|
// to whom the Software is furnished to do so, subject to the following conditions:
|
||||||
|
//
|
||||||
|
// The above copyright notice and this permission notice shall be included in all copies or
|
||||||
|
// substantial portions of the Software.
|
||||||
|
//
|
||||||
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||||
|
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
|
||||||
|
// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
|
||||||
|
// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||||
|
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||||
|
// DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
|
using System; |
||||||
|
using System.Collections.Generic; |
||||||
|
using System.Linq; |
||||||
|
using System.Reflection; |
||||||
|
using System.Reflection.Metadata; |
||||||
|
using System.Reflection.Metadata.Ecma335; |
||||||
|
using System.Text; |
||||||
|
using System.Windows.Controls; |
||||||
|
using System.Windows.Data; |
||||||
|
using ICSharpCode.Decompiler; |
||||||
|
using ICSharpCode.Decompiler.CSharp.Syntax; |
||||||
|
using ICSharpCode.Decompiler.Metadata; |
||||||
|
using ICSharpCode.ILSpy.Controls; |
||||||
|
using ICSharpCode.ILSpy.TextView; |
||||||
|
using ICSharpCode.ILSpy.TreeNodes; |
||||||
|
using ICSharpCode.TreeView; |
||||||
|
|
||||||
|
namespace ICSharpCode.ILSpy.Metadata |
||||||
|
{ |
||||||
|
internal class ModuleTableTreeNode : ILSpyTreeNode |
||||||
|
{ |
||||||
|
private PEFile module; |
||||||
|
|
||||||
|
public ModuleTableTreeNode(PEFile module) |
||||||
|
{ |
||||||
|
this.module = module; |
||||||
|
} |
||||||
|
|
||||||
|
public override object Text => $"00 Module ({module.Metadata.GetTableRowCount(TableIndex.Module)})"; |
||||||
|
|
||||||
|
public override object Icon => Images.Literal; |
||||||
|
|
||||||
|
public override bool View(DecompilerTextView textView) |
||||||
|
{ |
||||||
|
ListView view = Helpers.CreateListView("ModulesView"); |
||||||
|
var metadata = module.Metadata; |
||||||
|
|
||||||
|
var list = new List<ModuleEntry>(); |
||||||
|
|
||||||
|
list.Add(new ModuleEntry(module, EntityHandle.ModuleDefinition)); |
||||||
|
|
||||||
|
view.ItemsSource = list; |
||||||
|
|
||||||
|
textView.ShowContent(new[] { this }, view); |
||||||
|
return true; |
||||||
|
} |
||||||
|
|
||||||
|
struct ModuleEntry |
||||||
|
{ |
||||||
|
readonly int metadataOffset; |
||||||
|
readonly PEFile module; |
||||||
|
readonly MetadataReader metadata; |
||||||
|
readonly ModuleDefinitionHandle handle; |
||||||
|
readonly ModuleDefinition moduleDef; |
||||||
|
|
||||||
|
public int RID => MetadataTokens.GetRowNumber(handle); |
||||||
|
|
||||||
|
public int Token => MetadataTokens.GetToken(handle); |
||||||
|
|
||||||
|
public int Offset => metadataOffset |
||||||
|
+ metadata.GetTableMetadataOffset(TableIndex.Module) |
||||||
|
+ metadata.GetTableRowSize(TableIndex.Module) * (RID-1); |
||||||
|
|
||||||
|
public int Generation => moduleDef.Generation; |
||||||
|
|
||||||
|
public int NameStringHandle => MetadataTokens.GetHeapOffset(moduleDef.Name); |
||||||
|
|
||||||
|
public string Name => metadata.GetString(moduleDef.Name); |
||||||
|
|
||||||
|
public int Mvid => MetadataTokens.GetHeapOffset(moduleDef.Mvid); |
||||||
|
|
||||||
|
public string MvidTooltip => metadata.GetGuid(moduleDef.Mvid).ToString(); |
||||||
|
|
||||||
|
public int GenerationId => MetadataTokens.GetHeapOffset(moduleDef.GenerationId); |
||||||
|
|
||||||
|
public string GenerationIdTooltip => moduleDef.GenerationId.IsNil ? null : metadata.GetGuid(moduleDef.GenerationId).ToString(); |
||||||
|
|
||||||
|
public int BaseGenerationId => MetadataTokens.GetHeapOffset(moduleDef.BaseGenerationId); |
||||||
|
|
||||||
|
public string BaseGenerationIdTooltip => moduleDef.BaseGenerationId.IsNil ? null : metadata.GetGuid(moduleDef.BaseGenerationId).ToString(); |
||||||
|
|
||||||
|
public ModuleEntry(PEFile module, ModuleDefinitionHandle handle) |
||||||
|
{ |
||||||
|
this.metadataOffset = module.Reader.PEHeaders.MetadataStartOffset; |
||||||
|
this.module = module; |
||||||
|
this.metadata = module.Metadata; |
||||||
|
this.handle = handle; |
||||||
|
this.moduleDef = metadata.GetModuleDefinition(); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public override void Decompile(Language language, ITextOutput output, DecompilationOptions options) |
||||||
|
{ |
||||||
|
language.WriteCommentLine(output, "Modules"); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,111 @@ |
|||||||
|
// Copyright (c) 2011 AlphaSierraPapa for the SharpDevelop Team
|
||||||
|
//
|
||||||
|
// Permission is hereby granted, free of charge, to any person obtaining a copy of this
|
||||||
|
// software and associated documentation files (the "Software"), to deal in the Software
|
||||||
|
// without restriction, including without limitation the rights to use, copy, modify, merge,
|
||||||
|
// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
|
||||||
|
// to whom the Software is furnished to do so, subject to the following conditions:
|
||||||
|
//
|
||||||
|
// The above copyright notice and this permission notice shall be included in all copies or
|
||||||
|
// substantial portions of the Software.
|
||||||
|
//
|
||||||
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||||
|
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
|
||||||
|
// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
|
||||||
|
// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||||
|
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||||
|
// DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
|
using System; |
||||||
|
using System.Collections.Generic; |
||||||
|
using System.Linq; |
||||||
|
using System.Reflection; |
||||||
|
using System.Reflection.Metadata; |
||||||
|
using System.Reflection.Metadata.Ecma335; |
||||||
|
using System.Text; |
||||||
|
using System.Windows.Controls; |
||||||
|
using System.Windows.Data; |
||||||
|
using ICSharpCode.Decompiler; |
||||||
|
using ICSharpCode.Decompiler.CSharp.Syntax; |
||||||
|
using ICSharpCode.Decompiler.Disassembler; |
||||||
|
using ICSharpCode.Decompiler.IL; |
||||||
|
using ICSharpCode.Decompiler.Metadata; |
||||||
|
using ICSharpCode.ILSpy.Controls; |
||||||
|
using ICSharpCode.ILSpy.TextView; |
||||||
|
using ICSharpCode.ILSpy.TreeNodes; |
||||||
|
using ICSharpCode.TreeView; |
||||||
|
|
||||||
|
namespace ICSharpCode.ILSpy.Metadata |
||||||
|
{ |
||||||
|
internal class ParamTableTreeNode : ILSpyTreeNode |
||||||
|
{ |
||||||
|
private PEFile module; |
||||||
|
|
||||||
|
public ParamTableTreeNode(PEFile module) |
||||||
|
{ |
||||||
|
this.module = module; |
||||||
|
} |
||||||
|
|
||||||
|
public override object Text => $"08 Param ({module.Metadata.GetTableRowCount(TableIndex.Param)})"; |
||||||
|
|
||||||
|
public override object Icon => Images.Literal; |
||||||
|
|
||||||
|
public override bool View(DecompilerTextView textView) |
||||||
|
{ |
||||||
|
ListView view = Helpers.CreateListView("ParamsView"); |
||||||
|
var metadata = module.Metadata; |
||||||
|
|
||||||
|
var list = new List<ParamEntry>(); |
||||||
|
|
||||||
|
for (int row = 1; row <= module.Metadata.GetTableRowCount(TableIndex.Param); row++) { |
||||||
|
list.Add(new ParamEntry(module, MetadataTokens.ParameterHandle(row))); |
||||||
|
} |
||||||
|
|
||||||
|
view.ItemsSource = list; |
||||||
|
|
||||||
|
textView.ShowContent(new[] { this }, view); |
||||||
|
return true; |
||||||
|
} |
||||||
|
|
||||||
|
struct ParamEntry |
||||||
|
{ |
||||||
|
readonly int metadataOffset; |
||||||
|
readonly PEFile module; |
||||||
|
readonly MetadataReader metadata; |
||||||
|
readonly ParameterHandle handle; |
||||||
|
readonly Parameter param; |
||||||
|
|
||||||
|
public int RID => MetadataTokens.GetRowNumber(handle); |
||||||
|
|
||||||
|
public int Token => MetadataTokens.GetToken(handle); |
||||||
|
|
||||||
|
public int Offset => metadataOffset |
||||||
|
+ metadata.GetTableMetadataOffset(TableIndex.Param) |
||||||
|
+ metadata.GetTableRowSize(TableIndex.Param) * (RID-1); |
||||||
|
|
||||||
|
public int Attributes => (int)param.Attributes; |
||||||
|
|
||||||
|
public string AttributesTooltip => null; //Helpers.AttributesToString(param.Attributes);
|
||||||
|
|
||||||
|
public int NameStringHandle => MetadataTokens.GetHeapOffset(param.Name); |
||||||
|
|
||||||
|
public string Name => metadata.GetString(param.Name); |
||||||
|
|
||||||
|
public int Sequence => param.SequenceNumber; |
||||||
|
|
||||||
|
public ParamEntry(PEFile module, ParameterHandle handle) |
||||||
|
{ |
||||||
|
this.metadataOffset = module.Reader.PEHeaders.MetadataStartOffset; |
||||||
|
this.module = module; |
||||||
|
this.metadata = module.Metadata; |
||||||
|
this.handle = handle; |
||||||
|
this.param = metadata.GetParameter(handle); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public override void Decompile(Language language, ITextOutput output, DecompilationOptions options) |
||||||
|
{ |
||||||
|
language.WriteCommentLine(output, "Params"); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,117 @@ |
|||||||
|
// Copyright (c) 2011 AlphaSierraPapa for the SharpDevelop Team
|
||||||
|
//
|
||||||
|
// Permission is hereby granted, free of charge, to any person obtaining a copy of this
|
||||||
|
// software and associated documentation files (the "Software"), to deal in the Software
|
||||||
|
// without restriction, including without limitation the rights to use, copy, modify, merge,
|
||||||
|
// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
|
||||||
|
// to whom the Software is furnished to do so, subject to the following conditions:
|
||||||
|
//
|
||||||
|
// The above copyright notice and this permission notice shall be included in all copies or
|
||||||
|
// substantial portions of the Software.
|
||||||
|
//
|
||||||
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||||
|
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
|
||||||
|
// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
|
||||||
|
// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||||
|
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||||
|
// DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
|
using System; |
||||||
|
using System.Collections.Generic; |
||||||
|
using System.Linq; |
||||||
|
using System.Reflection.Metadata; |
||||||
|
using System.Reflection.Metadata.Ecma335; |
||||||
|
using System.Text; |
||||||
|
using System.Threading.Tasks; |
||||||
|
using System.Windows.Controls; |
||||||
|
using ICSharpCode.Decompiler; |
||||||
|
using ICSharpCode.Decompiler.IL; |
||||||
|
using ICSharpCode.Decompiler.Disassembler; |
||||||
|
using ICSharpCode.Decompiler.Metadata; |
||||||
|
using ICSharpCode.Decompiler.TypeSystem; |
||||||
|
using ICSharpCode.ILSpy.TextView; |
||||||
|
using ICSharpCode.ILSpy.TreeNodes; |
||||||
|
|
||||||
|
namespace ICSharpCode.ILSpy.Metadata |
||||||
|
{ |
||||||
|
internal class PropertyTableTreeNode : ILSpyTreeNode |
||||||
|
{ |
||||||
|
private PEFile module; |
||||||
|
|
||||||
|
public PropertyTableTreeNode(PEFile module) |
||||||
|
{ |
||||||
|
this.module = module; |
||||||
|
} |
||||||
|
|
||||||
|
public override object Text => $"17 Property ({module.Metadata.GetTableRowCount(TableIndex.Property)})"; |
||||||
|
|
||||||
|
public override object Icon => Images.Literal; |
||||||
|
|
||||||
|
public override bool View(DecompilerTextView textView) |
||||||
|
{ |
||||||
|
ListView view = Helpers.CreateListView("PropertyDefsView"); |
||||||
|
var metadata = module.Metadata; |
||||||
|
|
||||||
|
var list = new List<PropertyDefEntry>(); |
||||||
|
|
||||||
|
foreach (var row in metadata.PropertyDefinitions) |
||||||
|
list.Add(new PropertyDefEntry(module, row)); |
||||||
|
|
||||||
|
view.ItemsSource = list; |
||||||
|
|
||||||
|
textView.ShowContent(new[] { this }, view); |
||||||
|
return true; |
||||||
|
} |
||||||
|
|
||||||
|
struct PropertyDefEntry : IMemberTreeNode |
||||||
|
{ |
||||||
|
readonly int metadataOffset; |
||||||
|
readonly PEFile module; |
||||||
|
readonly MetadataReader metadata; |
||||||
|
readonly PropertyDefinitionHandle handle; |
||||||
|
readonly PropertyDefinition propertyDef; |
||||||
|
|
||||||
|
public int RID => MetadataTokens.GetRowNumber(handle); |
||||||
|
|
||||||
|
public int Token => MetadataTokens.GetToken(handle); |
||||||
|
|
||||||
|
public int Offset => metadataOffset |
||||||
|
+ metadata.GetTableMetadataOffset(TableIndex.Property) |
||||||
|
+ metadata.GetTableRowSize(TableIndex.Property) * (RID - 1); |
||||||
|
|
||||||
|
public int Attributes => (int)propertyDef.Attributes; |
||||||
|
|
||||||
|
public string AttributesTooltip => null; //Helpers.AttributesToString(PropertyDef.Attributes);
|
||||||
|
|
||||||
|
public int NameStringHandle => MetadataTokens.GetHeapOffset(propertyDef.Name); |
||||||
|
|
||||||
|
public string Name => metadata.GetString(propertyDef.Name); |
||||||
|
|
||||||
|
IEntity IMemberTreeNode.Member => ((MetadataModule)module.GetTypeSystemOrNull()?.MainModule).GetDefinition(handle); |
||||||
|
|
||||||
|
public int Signature => MetadataTokens.GetHeapOffset(propertyDef.Signature); |
||||||
|
|
||||||
|
public string SignatureTooltip { |
||||||
|
get { |
||||||
|
ITextOutput output = new PlainTextOutput(); |
||||||
|
((EntityHandle)handle).WriteTo(module, output, Decompiler.Metadata.GenericContext.Empty); |
||||||
|
return output.ToString(); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public PropertyDefEntry(PEFile module, PropertyDefinitionHandle handle) |
||||||
|
{ |
||||||
|
this.metadataOffset = module.Reader.PEHeaders.MetadataStartOffset; |
||||||
|
this.module = module; |
||||||
|
this.metadata = module.Metadata; |
||||||
|
this.handle = handle; |
||||||
|
this.propertyDef = metadata.GetPropertyDefinition(handle); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public override void Decompile(Language language, ITextOutput output, DecompilationOptions options) |
||||||
|
{ |
||||||
|
language.WriteCommentLine(output, "PropertyDefs"); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,105 @@ |
|||||||
|
// Copyright (c) 2011 AlphaSierraPapa for the SharpDevelop Team
|
||||||
|
//
|
||||||
|
// Permission is hereby granted, free of charge, to any person obtaining a copy of this
|
||||||
|
// software and associated documentation files (the "Software"), to deal in the Software
|
||||||
|
// without restriction, including without limitation the rights to use, copy, modify, merge,
|
||||||
|
// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
|
||||||
|
// to whom the Software is furnished to do so, subject to the following conditions:
|
||||||
|
//
|
||||||
|
// The above copyright notice and this permission notice shall be included in all copies or
|
||||||
|
// substantial portions of the Software.
|
||||||
|
//
|
||||||
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||||
|
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
|
||||||
|
// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
|
||||||
|
// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||||
|
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||||
|
// DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
|
using System; |
||||||
|
using System.Collections.Generic; |
||||||
|
using System.Linq; |
||||||
|
using System.Reflection.Metadata; |
||||||
|
using System.Reflection.Metadata.Ecma335; |
||||||
|
using System.Text; |
||||||
|
using System.Threading.Tasks; |
||||||
|
using System.Windows.Controls; |
||||||
|
using ICSharpCode.Decompiler; |
||||||
|
using ICSharpCode.Decompiler.Disassembler; |
||||||
|
using ICSharpCode.Decompiler.IL; |
||||||
|
using ICSharpCode.Decompiler.Metadata; |
||||||
|
using ICSharpCode.ILSpy.TextView; |
||||||
|
using ICSharpCode.ILSpy.TreeNodes; |
||||||
|
|
||||||
|
namespace ICSharpCode.ILSpy.Metadata |
||||||
|
{ |
||||||
|
class StandAloneSigTableTreeNode : ILSpyTreeNode |
||||||
|
{ |
||||||
|
private PEFile module; |
||||||
|
|
||||||
|
public StandAloneSigTableTreeNode(PEFile module) |
||||||
|
{ |
||||||
|
this.module = module; |
||||||
|
} |
||||||
|
|
||||||
|
public override object Text => $"11 StandAloneSig ({module.Metadata.GetTableRowCount(TableIndex.StandAloneSig)})"; |
||||||
|
|
||||||
|
public override object Icon => Images.Literal; |
||||||
|
|
||||||
|
public override bool View(DecompilerTextView textView) |
||||||
|
{ |
||||||
|
ListView view = Helpers.CreateListView("StandAloneSigsView"); |
||||||
|
var metadata = module.Metadata; |
||||||
|
|
||||||
|
var list = new List<StandAloneSigEntry>(); |
||||||
|
|
||||||
|
for (int row = 1; row <= module.Metadata.GetTableRowCount(TableIndex.StandAloneSig); row++) { |
||||||
|
list.Add(new StandAloneSigEntry(module, MetadataTokens.StandaloneSignatureHandle(row))); |
||||||
|
} |
||||||
|
|
||||||
|
view.ItemsSource = list; |
||||||
|
|
||||||
|
textView.ShowContent(new[] { this }, view); |
||||||
|
return true; |
||||||
|
} |
||||||
|
|
||||||
|
struct StandAloneSigEntry |
||||||
|
{ |
||||||
|
readonly int metadataOffset; |
||||||
|
readonly PEFile module; |
||||||
|
readonly MetadataReader metadata; |
||||||
|
readonly StandaloneSignatureHandle handle; |
||||||
|
readonly StandaloneSignature standaloneSig; |
||||||
|
|
||||||
|
public int RID => MetadataTokens.GetRowNumber(handle); |
||||||
|
|
||||||
|
public int Token => MetadataTokens.GetToken(handle); |
||||||
|
|
||||||
|
public int Offset => metadataOffset |
||||||
|
+ metadata.GetTableMetadataOffset(TableIndex.StandAloneSig) |
||||||
|
+ metadata.GetTableRowSize(TableIndex.StandAloneSig) * (RID - 1); |
||||||
|
|
||||||
|
public int Signature => MetadataTokens.GetHeapOffset(standaloneSig.Signature); |
||||||
|
|
||||||
|
public string SignatureTooltip { |
||||||
|
get { |
||||||
|
return null; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public StandAloneSigEntry(PEFile module, StandaloneSignatureHandle handle) |
||||||
|
{ |
||||||
|
this.metadataOffset = module.Reader.PEHeaders.MetadataStartOffset; |
||||||
|
this.module = module; |
||||||
|
this.metadata = module.Metadata; |
||||||
|
this.handle = handle; |
||||||
|
this.standaloneSig = metadata.GetStandaloneSignature(handle); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public override void Decompile(Language language, ITextOutput output, DecompilationOptions options) |
||||||
|
{ |
||||||
|
language.WriteCommentLine(output, "StandAloneSigs"); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -1,4 +1,22 @@ |
|||||||
using System; |
// Copyright (c) 2011 AlphaSierraPapa for the SharpDevelop Team
|
||||||
|
//
|
||||||
|
// Permission is hereby granted, free of charge, to any person obtaining a copy of this
|
||||||
|
// software and associated documentation files (the "Software"), to deal in the Software
|
||||||
|
// without restriction, including without limitation the rights to use, copy, modify, merge,
|
||||||
|
// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
|
||||||
|
// to whom the Software is furnished to do so, subject to the following conditions:
|
||||||
|
//
|
||||||
|
// The above copyright notice and this permission notice shall be included in all copies or
|
||||||
|
// substantial portions of the Software.
|
||||||
|
//
|
||||||
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||||
|
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
|
||||||
|
// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
|
||||||
|
// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||||
|
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||||
|
// DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
|
using System; |
||||||
using System.Collections.Generic; |
using System.Collections.Generic; |
||||||
using System.Linq; |
using System.Linq; |
||||||
using System.Reflection; |
using System.Reflection; |
@ -0,0 +1,135 @@ |
|||||||
|
// Copyright (c) 2011 AlphaSierraPapa for the SharpDevelop Team
|
||||||
|
//
|
||||||
|
// Permission is hereby granted, free of charge, to any person obtaining a copy of this
|
||||||
|
// software and associated documentation files (the "Software"), to deal in the Software
|
||||||
|
// without restriction, including without limitation the rights to use, copy, modify, merge,
|
||||||
|
// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
|
||||||
|
// to whom the Software is furnished to do so, subject to the following conditions:
|
||||||
|
//
|
||||||
|
// The above copyright notice and this permission notice shall be included in all copies or
|
||||||
|
// substantial portions of the Software.
|
||||||
|
//
|
||||||
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||||
|
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
|
||||||
|
// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
|
||||||
|
// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||||
|
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||||
|
// DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
|
using System; |
||||||
|
using System.Collections.Generic; |
||||||
|
using System.Linq; |
||||||
|
using System.Reflection; |
||||||
|
using System.Reflection.Metadata; |
||||||
|
using System.Reflection.Metadata.Ecma335; |
||||||
|
using System.Text; |
||||||
|
using System.Windows.Controls; |
||||||
|
using System.Windows.Data; |
||||||
|
using ICSharpCode.Decompiler; |
||||||
|
using ICSharpCode.Decompiler.CSharp.Syntax; |
||||||
|
using ICSharpCode.Decompiler.IL; |
||||||
|
using ICSharpCode.Decompiler.Metadata; |
||||||
|
using ICSharpCode.ILSpy.Controls; |
||||||
|
using ICSharpCode.ILSpy.TextView; |
||||||
|
using ICSharpCode.ILSpy.TreeNodes; |
||||||
|
using ICSharpCode.TreeView; |
||||||
|
|
||||||
|
namespace ICSharpCode.ILSpy.Metadata |
||||||
|
{ |
||||||
|
internal class TypeRefTableTreeNode : ILSpyTreeNode |
||||||
|
{ |
||||||
|
private PEFile module; |
||||||
|
|
||||||
|
public TypeRefTableTreeNode(PEFile module) |
||||||
|
{ |
||||||
|
this.module = module; |
||||||
|
} |
||||||
|
|
||||||
|
public override object Text => $"01 TypeRef ({module.Metadata.GetTableRowCount(TableIndex.TypeRef)})"; |
||||||
|
|
||||||
|
public override object Icon => Images.Literal; |
||||||
|
|
||||||
|
public override bool View(DecompilerTextView textView) |
||||||
|
{ |
||||||
|
ListView view = Helpers.CreateListView("TypeRefsView"); |
||||||
|
|
||||||
|
var metadata = module.Metadata; |
||||||
|
|
||||||
|
var list = new List<TypeRefEntry>(); |
||||||
|
|
||||||
|
foreach (var row in metadata.TypeReferences) |
||||||
|
list.Add(new TypeRefEntry(module, row)); |
||||||
|
|
||||||
|
view.ItemsSource = list; |
||||||
|
|
||||||
|
textView.ShowContent(new[] { this }, view); |
||||||
|
return true; |
||||||
|
} |
||||||
|
|
||||||
|
struct TypeRefEntry |
||||||
|
{ |
||||||
|
readonly int metadataOffset; |
||||||
|
readonly PEFile module; |
||||||
|
readonly MetadataReader metadata; |
||||||
|
readonly TypeReferenceHandle handle; |
||||||
|
readonly TypeReference typeRef; |
||||||
|
|
||||||
|
public int RID => MetadataTokens.GetRowNumber(handle); |
||||||
|
|
||||||
|
public int Token => MetadataTokens.GetToken(handle); |
||||||
|
|
||||||
|
public int Offset => metadataOffset |
||||||
|
+ metadata.GetTableMetadataOffset(TableIndex.TypeRef) |
||||||
|
+ metadata.GetTableRowSize(TableIndex.TypeRef) * (RID-1); |
||||||
|
|
||||||
|
public int ResolutionScope => MetadataTokens.GetToken(typeRef.ResolutionScope); |
||||||
|
|
||||||
|
public string ResolutionScopeSignature { |
||||||
|
get { |
||||||
|
if (typeRef.ResolutionScope.IsNil) |
||||||
|
return null; |
||||||
|
var output = new PlainTextOutput(); |
||||||
|
switch (typeRef.ResolutionScope.Kind) { |
||||||
|
case HandleKind.ModuleDefinition: |
||||||
|
output.Write(metadata.GetString(metadata.GetModuleDefinition().Name)); |
||||||
|
break; |
||||||
|
case HandleKind.ModuleReference: |
||||||
|
ModuleReference moduleReference = metadata.GetModuleReference((ModuleReferenceHandle)typeRef.ResolutionScope); |
||||||
|
output.Write(metadata.GetString(moduleReference.Name)); |
||||||
|
break; |
||||||
|
case HandleKind.AssemblyReference: |
||||||
|
var asmRef = new Decompiler.Metadata.AssemblyReference(module, (AssemblyReferenceHandle)typeRef.ResolutionScope); |
||||||
|
output.Write(asmRef.ToString()); |
||||||
|
break; |
||||||
|
default: |
||||||
|
typeRef.ResolutionScope.WriteTo(module, output, GenericContext.Empty); |
||||||
|
break; |
||||||
|
} |
||||||
|
return output.ToString(); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public int NameStringHandle => MetadataTokens.GetHeapOffset(typeRef.Name); |
||||||
|
|
||||||
|
public string Name => metadata.GetString(typeRef.Name); |
||||||
|
|
||||||
|
public int NamespaceStringHandle => MetadataTokens.GetHeapOffset(typeRef.Namespace); |
||||||
|
|
||||||
|
public string Namespace => metadata.GetString(typeRef.Namespace); |
||||||
|
|
||||||
|
public TypeRefEntry(PEFile module, TypeReferenceHandle handle) |
||||||
|
{ |
||||||
|
this.metadataOffset = module.Reader.PEHeaders.MetadataStartOffset; |
||||||
|
this.module = module; |
||||||
|
this.metadata = module.Metadata; |
||||||
|
this.handle = handle; |
||||||
|
this.typeRef = metadata.GetTypeReference(handle); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public override void Decompile(Language language, ITextOutput output, DecompilationOptions options) |
||||||
|
{ |
||||||
|
language.WriteCommentLine(output, "TypeRefs"); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,110 @@ |
|||||||
|
// Copyright (c) 2011 AlphaSierraPapa for the SharpDevelop Team
|
||||||
|
//
|
||||||
|
// Permission is hereby granted, free of charge, to any person obtaining a copy of this
|
||||||
|
// software and associated documentation files (the "Software"), to deal in the Software
|
||||||
|
// without restriction, including without limitation the rights to use, copy, modify, merge,
|
||||||
|
// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
|
||||||
|
// to whom the Software is furnished to do so, subject to the following conditions:
|
||||||
|
//
|
||||||
|
// The above copyright notice and this permission notice shall be included in all copies or
|
||||||
|
// substantial portions of the Software.
|
||||||
|
//
|
||||||
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||||
|
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
|
||||||
|
// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
|
||||||
|
// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||||
|
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||||
|
// DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
|
using System; |
||||||
|
using System.Collections.Generic; |
||||||
|
using System.Linq; |
||||||
|
using System.Reflection; |
||||||
|
using System.Reflection.Metadata; |
||||||
|
using System.Reflection.Metadata.Ecma335; |
||||||
|
using System.Text; |
||||||
|
using System.Windows.Controls; |
||||||
|
using System.Windows.Data; |
||||||
|
using ICSharpCode.Decompiler; |
||||||
|
using ICSharpCode.Decompiler.CSharp.Syntax; |
||||||
|
using ICSharpCode.Decompiler.Disassembler; |
||||||
|
using ICSharpCode.Decompiler.IL; |
||||||
|
using ICSharpCode.Decompiler.Metadata; |
||||||
|
using ICSharpCode.ILSpy.Controls; |
||||||
|
using ICSharpCode.ILSpy.TextView; |
||||||
|
using ICSharpCode.ILSpy.TreeNodes; |
||||||
|
using ICSharpCode.TreeView; |
||||||
|
|
||||||
|
namespace ICSharpCode.ILSpy.Metadata |
||||||
|
{ |
||||||
|
internal class TypeSpecTableTreeNode : ILSpyTreeNode |
||||||
|
{ |
||||||
|
private PEFile module; |
||||||
|
|
||||||
|
public TypeSpecTableTreeNode(PEFile module) |
||||||
|
{ |
||||||
|
this.module = module; |
||||||
|
} |
||||||
|
|
||||||
|
public override object Text => $"1B TypeSpec ({module.Metadata.GetTableRowCount(TableIndex.TypeSpec)})"; |
||||||
|
|
||||||
|
public override object Icon => Images.Literal; |
||||||
|
|
||||||
|
public override bool View(DecompilerTextView textView) |
||||||
|
{ |
||||||
|
ListView view = Helpers.CreateListView("TypeSpecsView"); |
||||||
|
var metadata = module.Metadata; |
||||||
|
|
||||||
|
var list = new List<TypeSpecEntry>(); |
||||||
|
|
||||||
|
foreach (var row in metadata.GetTypeSpecifications()) |
||||||
|
list.Add(new TypeSpecEntry(module, row)); |
||||||
|
|
||||||
|
view.ItemsSource = list; |
||||||
|
|
||||||
|
textView.ShowContent(new[] { this }, view); |
||||||
|
return true; |
||||||
|
} |
||||||
|
|
||||||
|
struct TypeSpecEntry |
||||||
|
{ |
||||||
|
readonly int metadataOffset; |
||||||
|
readonly PEFile module; |
||||||
|
readonly MetadataReader metadata; |
||||||
|
readonly TypeSpecificationHandle handle; |
||||||
|
readonly TypeSpecification typeSpec; |
||||||
|
|
||||||
|
public int RID => MetadataTokens.GetRowNumber(handle); |
||||||
|
|
||||||
|
public int Token => MetadataTokens.GetToken(handle); |
||||||
|
|
||||||
|
public int Offset => metadataOffset |
||||||
|
+ metadata.GetTableMetadataOffset(TableIndex.TypeSpec) |
||||||
|
+ metadata.GetTableRowSize(TableIndex.TypeSpec) * (RID-1); |
||||||
|
|
||||||
|
public int Signature => MetadataTokens.GetHeapOffset(typeSpec.Signature); |
||||||
|
|
||||||
|
public string SignatureTooltip { |
||||||
|
get { |
||||||
|
ITextOutput output = new PlainTextOutput(); |
||||||
|
typeSpec.DecodeSignature(new DisassemblerSignatureProvider(module, output), GenericContext.Empty)(ILNameSyntax.Signature); |
||||||
|
return output.ToString(); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public TypeSpecEntry(PEFile module, TypeSpecificationHandle handle) |
||||||
|
{ |
||||||
|
this.metadataOffset = module.Reader.PEHeaders.MetadataStartOffset; |
||||||
|
this.module = module; |
||||||
|
this.metadata = module.Metadata; |
||||||
|
this.handle = handle; |
||||||
|
this.typeSpec = metadata.GetTypeSpecification(handle); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public override void Decompile(Language language, ITextOutput output, DecompilationOptions options) |
||||||
|
{ |
||||||
|
language.WriteCommentLine(output, "TypeSpecs"); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -1,95 +0,0 @@ |
|||||||
using System; |
|
||||||
using System.Collections.Generic; |
|
||||||
using System.Linq; |
|
||||||
using System.Reflection; |
|
||||||
using System.Reflection.Metadata; |
|
||||||
using System.Reflection.Metadata.Ecma335; |
|
||||||
using System.Text; |
|
||||||
using System.Windows.Controls; |
|
||||||
using System.Windows.Data; |
|
||||||
using ICSharpCode.Decompiler; |
|
||||||
using ICSharpCode.Decompiler.CSharp.Syntax; |
|
||||||
using ICSharpCode.Decompiler.Metadata; |
|
||||||
using ICSharpCode.ILSpy.Controls; |
|
||||||
using ICSharpCode.ILSpy.TextView; |
|
||||||
using ICSharpCode.ILSpy.TreeNodes; |
|
||||||
using ICSharpCode.TreeView; |
|
||||||
|
|
||||||
namespace ICSharpCode.ILSpy.Metadata |
|
||||||
{ |
|
||||||
internal class ModuleTableTreeNode : ILSpyTreeNode |
|
||||||
{ |
|
||||||
private PEFile module; |
|
||||||
|
|
||||||
public ModuleTableTreeNode(PEFile module) |
|
||||||
{ |
|
||||||
this.module = module; |
|
||||||
} |
|
||||||
|
|
||||||
public override object Text => $"00 Module ({module.Metadata.GetTableRowCount(TableIndex.Module)})"; |
|
||||||
|
|
||||||
public override object Icon => Images.Literal; |
|
||||||
|
|
||||||
public override bool View(DecompilerTextView textView) |
|
||||||
{ |
|
||||||
ListView view = Helpers.CreateListView("ModulesView"); |
|
||||||
var metadata = module.Metadata; |
|
||||||
|
|
||||||
var list = new List<ModuleEntry>(); |
|
||||||
|
|
||||||
list.Add(new ModuleEntry(module.Reader.PEHeaders.MetadataStartOffset, metadata, EntityHandle.ModuleDefinition, metadata.GetModuleDefinition())); |
|
||||||
|
|
||||||
view.ItemsSource = list; |
|
||||||
|
|
||||||
textView.ShowContent(new[] { this }, view); |
|
||||||
return true; |
|
||||||
} |
|
||||||
|
|
||||||
struct ModuleEntry |
|
||||||
{ |
|
||||||
readonly int metadataOffset; |
|
||||||
readonly MetadataReader metadata; |
|
||||||
readonly ModuleDefinitionHandle handle; |
|
||||||
readonly ModuleDefinition module; |
|
||||||
|
|
||||||
public int RID => MetadataTokens.GetRowNumber(handle); |
|
||||||
|
|
||||||
public int Token => MetadataTokens.GetToken(handle); |
|
||||||
|
|
||||||
public int Offset => metadataOffset |
|
||||||
+ metadata.GetTableMetadataOffset(TableIndex.Module) |
|
||||||
+ metadata.GetTableRowSize(TableIndex.Module) * (RID-1); |
|
||||||
|
|
||||||
public int Generation => module.Generation; |
|
||||||
|
|
||||||
public int NameStringHandle => MetadataTokens.GetHeapOffset(module.Name); |
|
||||||
|
|
||||||
public string Name => metadata.GetString(module.Name); |
|
||||||
|
|
||||||
public int Mvid => MetadataTokens.GetHeapOffset(module.Mvid); |
|
||||||
|
|
||||||
public string MvidTooltip => metadata.GetGuid(module.Mvid).ToString(); |
|
||||||
|
|
||||||
public int GenerationId => MetadataTokens.GetHeapOffset(module.GenerationId); |
|
||||||
|
|
||||||
public string GenerationIdTooltip => module.GenerationId.IsNil ? null : metadata.GetGuid(module.GenerationId).ToString(); |
|
||||||
|
|
||||||
public int BaseGenerationId => MetadataTokens.GetHeapOffset(module.BaseGenerationId); |
|
||||||
|
|
||||||
public string BaseGenerationIdTooltip => module.BaseGenerationId.IsNil ? null : metadata.GetGuid(module.BaseGenerationId).ToString(); |
|
||||||
|
|
||||||
public ModuleEntry(int metadataOffset, MetadataReader metadata, ModuleDefinitionHandle handle, ModuleDefinition module) |
|
||||||
{ |
|
||||||
this.metadataOffset = metadataOffset; |
|
||||||
this.metadata = metadata; |
|
||||||
this.handle = handle; |
|
||||||
this.module = module; |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
public override void Decompile(Language language, ITextOutput output, DecompilationOptions options) |
|
||||||
{ |
|
||||||
language.WriteCommentLine(output, "Modules"); |
|
||||||
} |
|
||||||
} |
|
||||||
} |
|
@ -1,89 +0,0 @@ |
|||||||
using System; |
|
||||||
using System.Collections.Generic; |
|
||||||
using System.Linq; |
|
||||||
using System.Reflection; |
|
||||||
using System.Reflection.Metadata; |
|
||||||
using System.Reflection.Metadata.Ecma335; |
|
||||||
using System.Text; |
|
||||||
using System.Windows.Controls; |
|
||||||
using System.Windows.Data; |
|
||||||
using ICSharpCode.Decompiler; |
|
||||||
using ICSharpCode.Decompiler.CSharp.Syntax; |
|
||||||
using ICSharpCode.Decompiler.Metadata; |
|
||||||
using ICSharpCode.ILSpy.Controls; |
|
||||||
using ICSharpCode.ILSpy.TextView; |
|
||||||
using ICSharpCode.ILSpy.TreeNodes; |
|
||||||
using ICSharpCode.TreeView; |
|
||||||
|
|
||||||
namespace ICSharpCode.ILSpy.Metadata |
|
||||||
{ |
|
||||||
internal class TypeRefTableTreeNode : ILSpyTreeNode |
|
||||||
{ |
|
||||||
private PEFile module; |
|
||||||
|
|
||||||
public TypeRefTableTreeNode(PEFile module) |
|
||||||
{ |
|
||||||
this.module = module; |
|
||||||
} |
|
||||||
|
|
||||||
public override object Text => $"01 TypeRef ({module.Metadata.GetTableRowCount(TableIndex.TypeRef)})"; |
|
||||||
|
|
||||||
public override object Icon => Images.Literal; |
|
||||||
|
|
||||||
public override bool View(DecompilerTextView textView) |
|
||||||
{ |
|
||||||
ListView view = Helpers.CreateListView("TypeRefsView"); |
|
||||||
|
|
||||||
var metadata = module.Metadata; |
|
||||||
|
|
||||||
var list = new List<TypeRefEntry>(); |
|
||||||
|
|
||||||
foreach (var row in metadata.TypeReferences) |
|
||||||
list.Add(new TypeRefEntry(module.Reader.PEHeaders.MetadataStartOffset, metadata, row, metadata.GetTypeReference(row))); |
|
||||||
|
|
||||||
view.ItemsSource = list; |
|
||||||
|
|
||||||
textView.ShowContent(new[] { this }, view); |
|
||||||
return true; |
|
||||||
} |
|
||||||
|
|
||||||
struct TypeRefEntry |
|
||||||
{ |
|
||||||
readonly int metadataOffset; |
|
||||||
readonly MetadataReader metadata; |
|
||||||
readonly TypeReferenceHandle handle; |
|
||||||
readonly TypeReference typeRef; |
|
||||||
|
|
||||||
public int RID => MetadataTokens.GetRowNumber(handle); |
|
||||||
|
|
||||||
public int Token => MetadataTokens.GetToken(handle); |
|
||||||
|
|
||||||
public int Offset => metadataOffset |
|
||||||
+ metadata.GetTableMetadataOffset(TableIndex.TypeRef) |
|
||||||
+ metadata.GetTableRowSize(TableIndex.TypeRef) * (RID-1); |
|
||||||
|
|
||||||
public int ResolutionScope => MetadataTokens.GetToken(typeRef.ResolutionScope); |
|
||||||
|
|
||||||
public int Name => MetadataTokens.GetHeapOffset(typeRef.Name); |
|
||||||
|
|
||||||
public string NameTooltip => metadata.GetString(typeRef.Name); |
|
||||||
|
|
||||||
public int Namespace => MetadataTokens.GetHeapOffset(typeRef.Namespace); |
|
||||||
|
|
||||||
public string NamespaceTooltip => metadata.GetString(typeRef.Namespace); |
|
||||||
|
|
||||||
public TypeRefEntry(int metadataOffset, MetadataReader metadata, TypeReferenceHandle handle, TypeReference typeRef) |
|
||||||
{ |
|
||||||
this.metadataOffset = metadataOffset; |
|
||||||
this.metadata = metadata; |
|
||||||
this.handle = handle; |
|
||||||
this.typeRef = typeRef; |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
public override void Decompile(Language language, ITextOutput output, DecompilationOptions options) |
|
||||||
{ |
|
||||||
language.WriteCommentLine(output, "TypeRefs"); |
|
||||||
} |
|
||||||
} |
|
||||||
} |
|
Loading…
Reference in new issue