public ulong NextSearchText(byte[] sVal, byte[] cVal, int align) { ulong cnt = 0, ResCnt = 0; schProg.Maximum = (int)SchResCnt; schProg.Value = 0; ulong maxRes2 = SchResCnt; ulong x = 0; if (SchResCnt >= MaxRes) maxRes2 = MaxCodes; Form1.CodeRes[] tempSchRes = new Form1.CodeRes[maxRes2]; for (cnt = 0; cnt < SchResCnt; cnt++) { tempSchRes = fileio.ReadDumpArray(dFileName, (int)cnt, (int)maxRes2 + (int)cnt, align); using (System.IO.StreamWriter file = new System.IO.StreamWriter(dFileName + "2", true)) { for (x = 0; x < maxRes2; x++) { cnt++; byte[] ret = new byte[sVal.Length]; if (CancelSearch == 1) { schNSearch.Text = "Next Scan"; schProg.Maximum = 0; schProg.Value = 0; return 0; } apiGetMem(tempSchRes[x].addr, ref ret); schProg.Value++; Application.DoEvents(); if (misc.ArrayCompare(sVal, ret, cVal, compMode)) { string end = " -1"; if (NextSAlign == -2) end = " -2"; file.WriteLine(tempSchRes[x].addr + " " + misc.ByteAToStringInt(ret, " ") + " " + sVal.Length + end); ResCnt++; } } } System.IO.File.Delete(dFileName); System.IO.File.Copy(dFileName + "2", dFileName); System.IO.File.Delete(dFileName + "2"); } return ResCnt; }
/* * Reads a NetCheat text dump into a CodeRes struct array */ public static Form1.CodeRes[] ReadDumpArray(String filen, long start, long stop, int align) { if (stop <= start) return null; Form1.CodeRes[] ret = new Form1.CodeRes[stop - start + 1]; String[] a = new String[stop - start + 1]; int i = 0; if (File.Exists(filen) == false) return null; using (var sr = new StreamReader(filen)) { for (i = 0; i <= stop; i++) { if (i >= start) a[i - start] = sr.ReadLine(); else sr.ReadLine(); } } Application.DoEvents(); for (int x = 0; x <= (stop - start); x++) { if (a[x] == null) break; string[] s = a[x].Split(' '); ret[x].addr = ulong.Parse(s[0]); string val = ""; ret[x].align = int.Parse(s[s.Length - 1]); if (align == 0) align = ret[x].align; if (ret[x].align < 0) { int lenStr = int.Parse(s[s.Length - 2]); ret[x].val = new byte[lenStr]; for (i = 0; i < lenStr; i++) { //val = int.Parse(s[i + 1]).ToString("X2") + val; //val = val + (char)int.Parse(s[i + 1]); ret[x].val[i] = (byte)int.Parse(s[i + 1]); } //ret[x].val = misc.GetBytesFromString(val); } else { for (i = 0; i < align; i++) { val = int.Parse(s[i + 1]).ToString("X2") + val; } if (val != "") ret[x].val = misc.ValueToByteArray(val, align); } ret[x].state = false; //bool.Parse(s[i]); ret[x].align = align; Application.DoEvents(); } return ret; }
public ulong NextSearch(byte[] sVal, byte[] c, int align) { ulong cnt = 0, ResCnt = 0; byte[] ret = new byte[align]; schProg.Maximum = (int)SchResCnt + 1; schProg.Value = 0; ulong maxRes2 = SchResCnt; ulong x = 0; if (SchResCnt >= MaxRes) maxRes2 = MaxCodes; Form1.CodeRes[] tempSchRes = new Form1.CodeRes[maxRes2]; using (System.IO.StreamWriter file = new System.IO.StreamWriter(dFileName + "2", true)) { for (cnt = 0; cnt < SchResCnt; cnt++) { tempSchRes = fileio.ReadDumpArray(dFileName, (int)cnt, (int)maxRes2 + (int)cnt, align); for (x = 0; x < maxRes2; x++) { if (cnt >= SchResCnt) break; cnt++; if (cnt == (SchResCnt - 1)) cnt = SchResCnt - 1; if (CancelSearch != 0) { schNSearch.Text = "Next Scan"; schProg.Maximum = 0; schProg.Value = 0; lvSch.Items.Clear(); } if (CancelSearch == 1) return 0; if (CancelSearch == 2) return 0; apiGetMem(tempSchRes[x].addr, ref ret); schProg.Value++; Application.DoEvents(); if (compMode == compINC || compMode == compDEC || compMode == compChg || compMode == compUChg) c = tempSchRes[x].val; if (misc.ArrayCompare(sVal, ret, c, compMode)) { file.WriteLine(tempSchRes[x].addr + " " + misc.ByteAToStringInt(ret, " ") + " " + align); ResCnt++; } } } } System.IO.File.Delete(dFileName); System.IO.File.Copy(dFileName + "2", dFileName); System.IO.File.Delete(dFileName + "2"); return ResCnt; }
/* * Reads a single line in a NetCheat text dump int a CodeRes struct * Used only by the search results copy feature */ public static Form1.CodeRes ReadDump(String filen, int index, int align) { Form1.CodeRes ret = new Form1.CodeRes(); string a = ""; int i = 0; using (var sr = new StreamReader(filen)) { for (i = 0; i < index; i++) sr.ReadLine(); a = sr.ReadLine(); } string[] s = a.Split(' '); ret.addr = ulong.Parse(s[0]); string val = ""; ret.align = int.Parse(s[s.Length - 1]); if (ret.align < 0) { int lenStr = int.Parse(s[s.Length - 2]); for (i = 0; i < lenStr; i++) { val = val + s[i + 1]; } ret.val = misc.StringToByteArray(val); } else { for (i = 0; i < align; i++) { val = int.Parse(s[i + 1]).ToString("X2") + val; } if (val != "") ret.val = misc.ValueToByteArray(val, align); } ret.state = false; //bool.Parse(s[i]); return ret; }