Class GenericMockMemory<T>
Provides a semi high-level mapping between addresses and objects that live outside of the sandbox.
public class GenericMockMemory<T> : UninitializedMemorySpace, IMemorySpace where T : notnull
Type Parameters
TThe type of objects to store.
- Inheritance
-
GenericMockMemory<T>
- Implements
- Inherited Members
Remarks
Reading from this memory chunk always results in reading unknown memory.
Constructors
GenericMockMemory(int, int, IEqualityComparer<T>)
Creates a new generic mock memory chunk.
public GenericMockMemory(int size, int itemSize, IEqualityComparer<T> comparer)
Parameters
sizeintThe size in bytes of the memory.
itemSizeintThe size in bytes of a single element.
comparerIEqualityComparer<T>The equality comparer to use for comparing elements for uniqueness.
Methods
GetAddress(T)
Gets the address or assigns a new address to the provided object.
public long GetAddress(T item)
Parameters
itemTThe object.
Returns
- long
The address.
GetObject(long)
Gets the object at the provided address.
public T GetObject(long address)
Parameters
addresslongThe address.
Returns
- T
The object.
TryGetObject(long, out T?)
Attempts to get the object at the provided address.
public bool TryGetObject(long address, out T? value)
Parameters
addresslongThe address.
valueTThe object.
Returns
- bool
trueif the address maps to an object,falseotherwise.