//creates threads and assigns them to work a list private void SearchForValuesInMultipleThreads() { List <Thread> threadList = new List <Thread>(); ScanHistory.Add(new List <ScanStructure>()); foreach (List <RegionStructure> list in regionLists) { Thread arsch = new Thread(() => ReadMemory(list)); arsch.Start(); threadList.Add(arsch); } foreach (Thread thread in threadList) { thread.Join(); } if (ScanHistory.Last().Count <= 10_000) { ScanHistory.Last().Sort(); } Output = MemoryConverter.CreateDataGrid(ScanHistory, IsString); }
//Compares Lists and removes no longer valid entries and adds the result to the history public void CompareLists() { //just compares the values in the previous list by reading small areas(size of the new value) in VRAM List <ScanStructure> ScanResult = new List <ScanStructure>(); byte[] _value = Value; int _typesize = TypeSize; bool found; byte[] compareBuffer = new byte[_typesize]; for (int i = ScanHistory.Last().Count() - 1; i >= 0; i--) { if (ReadProcessMemory(targetHandle, ScanHistory.Last().ElementAt(i).Address, compareBuffer, (uint)_typesize, out notNecessary)) { for (int k = 0; k < compareBuffer.Length - (_typesize - 1); k++) { found = true; for (int j = 0; j < _typesize; j++) { if (compareBuffer[k + j] != _value[j]) { found = false; } if (found) { ScanResult.Add(new ScanStructure(ScanHistory.Last().ElementAt(i).Address, _value)); found = false; } } } } } if (ScanResult.Count() <= 20_000) { ScanResult.Sort(); } ScanHistory.Add(ScanResult); Output = MemoryConverter.CreateDataGrid(ScanHistory, IsString); }