Table of Contents

Class MemorySelection

Namespace
CStructSharp.Memory
Assembly
CStructSharp.dll

The result of resolving a path: which bytes were selected, what type they hold, and which field (and bit slice) named them.

public sealed record MemorySelection : IEquatable<MemorySelection>
Inheritance
MemorySelection
Implements
Inherited Members

Remarks

A selection is a location, not a value. It is what an address display needs ("field pid of the record at 0x1000 is at 0x1000, four bytes") and what patch planning needs, and it can be produced without decoding the record. For a bitfield the region covers the whole storage unit and Field identifies the bits within it. Resolving may already have read intermediate pointers on the way here, but the final selected value is never decoded.

Container is the record that contains the selected member. It differs from the root region once a path has entered a nested record or followed a pointer, and it is what a relative-pointer resolver uses as its base.

Constructors

MemorySelection(MemoryRegion, MemoryTypeDefinition, MemoryField?, string?, MemoryRegion?)

The result of resolving a path: which bytes were selected, what type they hold, and which field (and bit slice) named them.

public MemorySelection(MemoryRegion Region, MemoryTypeDefinition Type, MemoryField? Field, string? ParentTypeId, MemoryRegion? Container = null)

Parameters

Region MemoryRegion

Finite logical storage selected by the path.

Type MemoryTypeDefinition

Type describing the selected bytes.

Field MemoryField

Member descriptor, including an optional bit slice; null for a root or an array element.

ParentTypeId string

ID of the containing record's type, or null for a root.

Container MemoryRegion

Region of the containing record, used to interpret relative pointers; null at a root.

Remarks

A selection is a location, not a value. It is what an address display needs ("field pid of the record at 0x1000 is at 0x1000, four bytes") and what patch planning needs, and it can be produced without decoding the record. For a bitfield the region covers the whole storage unit and Field identifies the bits within it. Resolving may already have read intermediate pointers on the way here, but the final selected value is never decoded.

Container is the record that contains the selected member. It differs from the root region once a path has entered a nested record or followed a pointer, and it is what a relative-pointer resolver uses as its base.

Properties

Container

Region of the containing record, used to interpret relative pointers; null at a root.

public MemoryRegion? Container { get; init; }

Property Value

MemoryRegion

Field

Member descriptor, including an optional bit slice; null for a root or an array element.

public MemoryField? Field { get; init; }

Property Value

MemoryField

ParentTypeId

ID of the containing record's type, or null for a root.

public string? ParentTypeId { get; init; }

Property Value

string

Region

Finite logical storage selected by the path.

public MemoryRegion Region { get; init; }

Property Value

MemoryRegion

Type

Type describing the selected bytes.

public MemoryTypeDefinition Type { get; init; }

Property Value

MemoryTypeDefinition

Methods

Deconstruct(out MemoryRegion, out MemoryTypeDefinition, out MemoryField?, out string?, out MemoryRegion?)

public void Deconstruct(out MemoryRegion Region, out MemoryTypeDefinition Type, out MemoryField? Field, out string? ParentTypeId, out MemoryRegion? Container)

Parameters

Region MemoryRegion
Type MemoryTypeDefinition
Field MemoryField
ParentTypeId string
Container MemoryRegion

Equals(MemorySelection?)

public bool Equals(MemorySelection? other)

Parameters

other MemorySelection

Returns

bool

Equals(object?)

public override bool Equals(object? obj)

Parameters

obj object

Returns

bool

GetHashCode()

public override int GetHashCode()

Returns

int

ToString()

public override string ToString()

Returns

string

Operators

operator ==(MemorySelection?, MemorySelection?)

public static bool operator ==(MemorySelection? left, MemorySelection? right)

Parameters

left MemorySelection
right MemorySelection

Returns

bool

operator !=(MemorySelection?, MemorySelection?)

public static bool operator !=(MemorySelection? left, MemorySelection? right)

Parameters

left MemorySelection
right MemorySelection

Returns

bool