Better why of looping to detect change.
- by Dremation
As of now I'm using a while(true) method to detect changes in memory. The problem with this is it's kill the applications performance. I have a list of 30 pointers that need checked as rapidly as possible for changes, without sacrificing a huge performance loss. Anyone have ideas on this?
memScan = new Thread(ScanMem);
public static void ScanMem()
{
int i = addy.Length;
while (true)
{
Thread.Sleep(30000); //I do this to cut down on cpu usage
for (int j = 0; j < i; j++)
{
string[] values = addy[j].Split(new char[] { Convert.ToChar(",") });
//MessageBox.Show(values[2]);
try
{
if (Memory.Scanner.getIntFromMem(hwnd, (IntPtr)Convert.ToInt32(values[0], 16), 32).ToString() != values[1].ToString())
{
//Ok, it changed lets do our work
//work
if (Globals.Working)
return;
SomeFunction("Results: " + values[2].ToString(), "Memory");
Globals.Working = true;
}//end if
}//end try
catch { }
}//end for
}//end while
}//end void