Class DataSourceSegment
- Namespace
- AsmResolver
- Assembly
- AsmResolver.dll
Represents a segment that originates from a slice of a IDataSource.
public class DataSourceSegment : SegmentBase, IReadableSegment, ISegment, IOffsetProvider, IWritable
- Inheritance
-
DataSourceSegment
- Implements
- Inherited Members
- Extension Methods
Constructors
DataSourceSegment(IDataSource, ulong, uint, uint)
public DataSourceSegment(IDataSource dataSource, ulong offset, uint rva, uint size)
Parameters
dataSource
IDataSourceoffset
ulongrva
uintsize
uint
Methods
CreateReader(ulong, uint)
Creates a new binary reader that reads the raw contents of the segment.
public BinaryStreamReader CreateReader(ulong fileOffset, uint size)
Parameters
Returns
- BinaryStreamReader
The created binary reader.
Exceptions
- ArgumentOutOfRangeException
Occurs when
fileOffset
is not within the range of the segment.- EndOfStreamException
Occurs when
size
indicates a too large length.
GetPhysicalSize()
Computes the number of bytes that the structure contains.
public override uint GetPhysicalSize()
Returns
- uint
The number of bytes.
UpdateOffsets(in RelocationParameters)
Assigns a new file and virtual offset to the segment and all its sub-components.
public override void UpdateOffsets(in RelocationParameters parameters)
Parameters
parameters
RelocationParametersThe parameters containing the new offset information for the segment.
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.