I have been able to successfully get most other functions working with Memory Sharp, but I am having trouble trying to read a double memory location.
This is the memory variable I am using in the main form:
public static MemorySharp sharp;
Procs = Process.GetProcessesByName("notepad");
sharp = new MemorySharp(Procs.First());
This is where I am having trouble in this function in a different class:
//Read Double Address
private static double ReadDoubleMemory(IntPtr staticPointer, int[] offsetArray)
{
//in case of an error return just 0.0
try
{
// Read the static address
var address = Form1.sharp.Read<IntPtr>((IntPtr)staticPointer);
// Find the destination address by using the offsets but the last one
for (var i = 0; i < offsetArray.Length; i++)
{
address = Form1.sharp.Read<IntPtr>(address + offsetArray[i], false);
}
return Convert.ToDouble(Form1.sharp.Read<IntPtr>(address, false));
}
catch (Exception) { return 0.0; }
}
Would appreciate a point in the right direction.