Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
PEReaderExtensions.cs
Go to the documentation of this file.
3
5
6[EditorBrowsable(EditorBrowsableState.Never)]
7public static class PEReaderExtensions
8{
9 public static MethodBodyBlock GetMethodBody(this PEReader peReader, int relativeVirtualAddress)
10 {
11 if (peReader == null)
12 {
13 throw new ArgumentNullException("peReader");
14 }
15 PEMemoryBlock sectionData = peReader.GetSectionData(relativeVirtualAddress);
16 if (sectionData.Length == 0)
17 {
18 throw new BadImageFormatException(System.SR.Format(System.SR.InvalidMethodRva, relativeVirtualAddress));
19 }
20 return MethodBodyBlock.Create(sectionData.GetReader());
21 }
22
23 public static MetadataReader GetMetadataReader(this PEReader peReader)
24 {
25 return peReader.GetMetadataReader(MetadataReaderOptions.Default, null);
26 }
27
29 {
30 return peReader.GetMetadataReader(options, null);
31 }
32
34 {
35 if (peReader == null)
36 {
37 throw new ArgumentNullException("peReader");
38 }
39 PEMemoryBlock metadata = peReader.GetMetadata();
40 return new MetadataReader(metadata.Pointer, metadata.Length, options, utf8Decoder, peReader);
41 }
42}
static MethodBodyBlock Create(BlobReader reader)
static MethodBodyBlock GetMethodBody(this PEReader peReader, int relativeVirtualAddress)
static unsafe MetadataReader GetMetadataReader(this PEReader peReader, MetadataReaderOptions options, MetadataStringDecoder? utf8Decoder)
static MetadataReader GetMetadataReader(this PEReader peReader, MetadataReaderOptions options)
static MetadataReader GetMetadataReader(this PEReader peReader)
PEMemoryBlock GetSectionData(int relativeVirtualAddress)
Definition PEReader.cs:263
static string InvalidMethodRva
Definition SR.cs:100
static string Format(string resourceFormat, object p1)
Definition SR.cs:118
Definition SR.cs:7