Class MemoryBlock
- Namespace
- Extism
- Assembly
- Extism.Pdk.dll
A block of allocated memory.
public class MemoryBlock : IDisposable
- Inheritance
-
MemoryBlock
- Implements
- Inherited Members
Constructors
MemoryBlock(ulong, ulong)
public MemoryBlock(ulong offset, ulong length)
Parameters
Properties
Empty
An Empty memory block.
public static MemoryBlock Empty { get; }
Property Value
IsEmpty
Is block empty.
public bool IsEmpty { get; }
Property Value
Length
Length of block in bytes
public ulong Length { get; }
Property Value
Offset
Starts address of block
public ulong Offset { get; }
Property Value
Methods
CopyTo(Span<byte>)
Copies the contents of a memory block into a buffer.
public void CopyTo(Span<byte> buffer)
Parameters
Exceptions
Dispose()
Frees the current memory block.
public void Dispose()
Find(ulong)
Finds a memory block based on its start address.
public static MemoryBlock Find(ulong offset)
Parameters
offset
ulong
Returns
ReadBytes()
Reads the current memory block as a byte array.
public byte[] ReadBytes()
Returns
- byte[]
ReadString()
Reads the current memory block as a UTF8 encoded string.
public string ReadString()
Returns
WriteBytes(ReadOnlySpan<byte>)
Writes a byte buffer to this memory block.
public void WriteBytes(ReadOnlySpan<byte> bytes)
Parameters
bytes
ReadOnlySpan<byte>
Exceptions
WriteString(string)
Writes a string to the current memory block.
public void WriteString(string text)
Parameters
text
string