TheLeftExit.Memory 3.0.1

There is a newer version of this package available.
See the version list below for details.
dotnet add package TheLeftExit.Memory --version 3.0.1
NuGet\Install-Package TheLeftExit.Memory -Version 3.0.1
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="TheLeftExit.Memory" Version="3.0.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add TheLeftExit.Memory --version 3.0.1
#r "nuget: TheLeftExit.Memory, 3.0.1"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install TheLeftExit.Memory as a Cake Addin
#addin nuget:?package=TheLeftExit.Memory&version=3.0.1

// Install TheLeftExit.Memory as a Cake Tool
#tool nuget:?package=TheLeftExit.Memory&version=3.0.1

TheLeftExit.Memory

One of the many libraries focused on reading process memory.

TheLeftExit.Memory is designed to be compact, fast and memory-efficient, making use of unsafe context, and latest .NET features such as spans or Win32 API source generation.

Available as a NuGet package.

Overview of API

TheLeftExit.Memory.Sources
MemorySource
public abstract class MemorySource {
	public abstract bool ReadBytes(ulong address, nuint count, Span<byte> buffer);
	
	public bool TryRead<T>(ulong address, out T result) where T : unmanaged;
	public T? Read<T>(ulong address) where T : unmanaged;
	public T ReadValue<T>(ulong address) where T : unmanaged;
}

None of the MemorySource methods allocate memory on the heap, or invoke any type-specific conversion logic.

You can use those methods to read directly into primitive types, structures containing primitive types, or even tuples:
(float X, float Y) Position = source.ReadValue<(float, float)>(address);

ProcessMemory
public class ProcessMemory : MemorySource, IDisposable {
	public ProcessMemory(uint processId);
	public void Dispose();
}
StoredMemory
public class StoredMemory : MemorySource {
	public StoredMemory(byte[] source);
}

These are just a few possible implementations of MemorySource - you can inherit any of the classes listed to manually enable features like remote memory reading or caching.

TheLeftExit.Memory.RTTI
RTTIMethods
public static class RTTIMethods {
	public static string[] GetRTTIClassNames64(this MemorySource source, ulong address);
	public static string[] GetRTTIClassNames32(this MemorySource source, ulong address);
}

Allows you to query a structure for its RTTI-sourced class names.
The names you can find this way are the same names that tools like Cheat Engine, IDA or ReClass.NET will show you for the address or the pointer to it.
In fact, those methods have been transcribed from ReClass.NET's source.

To learn more about this technology, visit http://www.openrce.org/articles/full_view/23

TheLeftExit.Memory.Queries
PointerQuery
public class PointerQuery {
	public Int64? Offset { get; set; }
	public PointerQuery(PointerQueryCondition queryCondition, uint maxOffset, sbyte scanStep);
	public PointerQueryResult? GetResult(MemorySource source, ulong baseAddress);
}

public delegate PointerQueryConditionResult PointerQueryCondition(MemorySource memorySource, ulong address);
public enum PointerQueryConditionResult { Continue, Return, Break }

Allows you to scan a MemorySource for values matching specific condition. More on conditions below.

QueryConditions
public static class QueryConditions {
	public static PointerQueryCondition AOB(params Byte?[] pattern);
	public static PointerQueryCondition RTTIByRef(string name);
	public static PointerQueryCondition RTTIByVal(string name);
}

Provides a list of preconfigured delegates to use as PointerQuery conditions.

Product Compatible and additional computed target framework versions.
.NET net5.0 is compatible.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net5.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
4.0.0 447 1/21/2022
3.5.0 396 10/25/2021
3.4.0 267 10/23/2021
3.3.2 348 10/17/2021
3.3.1 317 10/16/2021
3.3.0 292 10/14/2021
3.2.0 348 10/10/2021
3.1.0 473 10/7/2021
3.0.1 315 9/25/2021
3.0.0 316 9/25/2021
2.0.0 445 7/27/2021
1.0.0 461 6/13/2021