Class SerializedGuidStream
- Namespace
- AsmResolver.PE.DotNet.Metadata
- Assembly
- AsmResolver.PE.dll
Provides an implementation of a GUID stream that obtains GUIDs from a readable segment in a file.
public class SerializedGuidStream : GuidStream, IMetadataStream, ISegment, IOffsetProvider, IWritable
- Inheritance
-
SerializedGuidStream
- Implements
- Inherited Members
Constructors
SerializedGuidStream(byte[])
Creates a new GUID stream with the provided byte array as the raw contents of the stream.
public SerializedGuidStream(byte[] rawData)
Parameters
rawData
byte[]The raw contents of the stream.
SerializedGuidStream(string, in BinaryStreamReader)
Creates a new GUID stream with the provided file segment reader as the raw contents of the stream.
public SerializedGuidStream(string name, in BinaryStreamReader reader)
Parameters
name
stringThe name of the stream.
reader
BinaryStreamReaderThe raw contents of the stream.
SerializedGuidStream(string, byte[])
Creates a new GUID stream with the provided byte array as the raw contents of the stream.
public SerializedGuidStream(string name, byte[] rawData)
Parameters
Properties
CanRead
Gets a value indicating whether the raw contents of the stream can be read using a binary stream reader.
public override bool CanRead { get; }
Property Value
Methods
CreateReader()
Creates a binary reader that reads the raw contents of the metadata stream.
public override BinaryStreamReader CreateReader()
Returns
- BinaryStreamReader
The reader.
Exceptions
- InvalidOperationException
Occurs when CanRead is
false
.
EnumerateGuids()
Performs a linear sweep on the stream and yields all GUIDs that are stored.
public override IEnumerable<Guid> EnumerateGuids()
Returns
- IEnumerable<Guid>
The GUID enumerator.
GetGuidByIndex(uint)
Gets a GUID by its GUID index.
public override Guid GetGuidByIndex(uint index)
Parameters
index
uintThe offset into the heap to start reading.
Returns
- Guid
The GUID.
GetPhysicalSize()
Computes the number of bytes that the structure contains.
public override uint GetPhysicalSize()
Returns
- uint
The number of bytes.
TryFindGuidIndex(Guid, out uint)
Searches the stream for the provided GUID.
public override bool TryFindGuidIndex(Guid guid, out uint index)
Parameters
guid
GuidThe GUID to search for.
index
uintWhen the function returns
true
, contains the index at which the GUID was found.
Returns
- bool
true
if the GUID index was found,false
otherwise.
Write(BinaryStreamWriter)
Serializes the structure to an output stream.
public override void Write(BinaryStreamWriter writer)
Parameters
writer
BinaryStreamWriterThe output stream to write the data to.