Class PEFile
- Namespace
- ICSharpCode.Decompiler.Metadata
- Assembly
- ICSharpCode.Decompiler.dll
PEFile is the main class the decompiler uses to represent a metadata assembly/module. Every file on disk can be loaded into a standalone PEFile instance.
A PEFile can be combined with its referenced assemblies/modules to form a type system, in that case the MetadataModule class is used instead.
public class PEFile : IDisposable, IModuleReference
- Inheritance
-
PEFile
- Implements
- Inherited Members
- Extension Methods
Remarks
In addition to wrapping a System.Reflection.Metadata.PEReader
, this class
contains a few decompiler-specific caches to allow efficiently constructing a type
system from multiple PEFiles. This allows the caches to be shared across multiple
decompiled type systems.
Constructors
PEFile(string, Stream, PEStreamOptions, MetadataReaderOptions)
public PEFile(string fileName, Stream stream, PEStreamOptions streamOptions = PEStreamOptions.Default, MetadataReaderOptions metadataOptions = MetadataReaderOptions.ApplyWindowsRuntimeProjections)
Parameters
fileName
stringstream
StreamstreamOptions
PEStreamOptionsmetadataOptions
MetadataReaderOptions
PEFile(string, PEReader, MetadataReaderOptions)
public PEFile(string fileName, PEReader reader, MetadataReaderOptions metadataOptions = MetadataReaderOptions.ApplyWindowsRuntimeProjections)
Parameters
fileName
stringreader
PEReadermetadataOptions
MetadataReaderOptions
PEFile(string, PEStreamOptions, MetadataReaderOptions)
public PEFile(string fileName, PEStreamOptions streamOptions = PEStreamOptions.Default, MetadataReaderOptions metadataOptions = MetadataReaderOptions.ApplyWindowsRuntimeProjections)
Parameters
fileName
stringstreamOptions
PEStreamOptionsmetadataOptions
MetadataReaderOptions
Properties
AssemblyReferences
public ImmutableArray<AssemblyReference> AssemblyReferences { get; }
Property Value
FileName
public string FileName { get; }
Property Value
FullName
public string FullName { get; }
Property Value
IsAssembly
public bool IsAssembly { get; }
Property Value
Metadata
public MetadataReader Metadata { get; }
Property Value
Name
public string Name { get; }
Property Value
Reader
public PEReader Reader { get; }
Property Value
Resources
public ImmutableArray<Resource> Resources { get; }
Property Value
Methods
Dispose()
public void Dispose()
GetRuntime()
public TargetRuntime GetRuntime()
Returns
GetTypeDefinition(TopLevelTypeName)
Finds the top-level-type with the specified name.
public TypeDefinitionHandle GetTypeDefinition(TopLevelTypeName typeName)
Parameters
typeName
TopLevelTypeName
Returns
GetTypeForwarder(FullTypeName)
Finds the type forwarder with the specified name.
public ExportedTypeHandle GetTypeForwarder(FullTypeName typeName)
Parameters
typeName
FullTypeName
Returns
WithOptions(TypeSystemOptions)
public IModuleReference WithOptions(TypeSystemOptions options)
Parameters
options
TypeSystemOptions