Table of Contents

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 IDataSource
offset ulong
rva uint
size 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

fileOffset ulong

The starting file offset of the reader.

size uint

The number of bytes to read.

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 RelocationParameters

The parameters containing the new offset information for the segment.

Write(IBinaryStreamWriter)

Serializes the structure to an output stream.

public override void Write(IBinaryStreamWriter writer)

Parameters

writer IBinaryStreamWriter

The output stream to write the data to.