public static CalibrationInfo[] GetList() { ArrayList arrayList = new ArrayList(); string path = Path.Combine(Path.GetDirectoryName(Environment.GetCommandLineArgs()[0]), "calibration.cfg"); if (File.Exists(path)) { using (StreamReader ip = new StreamReader(path)) { string str; while ((str = ip.ReadLine()) != null) { byte[] mask; byte[] vals; byte[] detx; byte[] dety; byte[] detz; byte[] detf; if (str.Trim().ToLower() == "Begin" && (mask = CalibrationInfo.ReadBytes(ip)) != null && ((vals = CalibrationInfo.ReadBytes(ip)) != null && (detx = CalibrationInfo.ReadBytes(ip)) != null) && ((dety = CalibrationInfo.ReadBytes(ip)) != null && (detz = CalibrationInfo.ReadBytes(ip)) != null && (detf = CalibrationInfo.ReadBytes(ip)) != null)) { arrayList.Add((object)new CalibrationInfo(mask, vals, detx, dety, detz, detf)); } } } } arrayList.AddRange((ICollection)CalibrationInfo.DefaultList); return((CalibrationInfo[])arrayList.ToArray(typeof(CalibrationInfo))); }
public static CalibrationInfo[] GetList() { ArrayList arrayLists = new ArrayList(); string directoryName = Path.GetDirectoryName(Environment.GetCommandLineArgs()[0]); directoryName = Path.Combine(directoryName, "calibration.cfg"); if (File.Exists(directoryName)) { using (StreamReader streamReader = new StreamReader(directoryName)) { while (true) { string str = streamReader.ReadLine(); string str1 = str; if (str == null) { break; } str1 = str1.Trim(); if (str1.ToLower() == "Begin") { byte[] numArray = CalibrationInfo.ReadBytes(streamReader); byte[] numArray1 = numArray; if (numArray != null) { byte[] numArray2 = CalibrationInfo.ReadBytes(streamReader); byte[] numArray3 = numArray2; if (numArray2 != null) { byte[] numArray4 = CalibrationInfo.ReadBytes(streamReader); byte[] numArray5 = numArray4; if (numArray4 != null) { byte[] numArray6 = CalibrationInfo.ReadBytes(streamReader); byte[] numArray7 = numArray6; if (numArray6 != null) { byte[] numArray8 = CalibrationInfo.ReadBytes(streamReader); byte[] numArray9 = numArray8; if (numArray8 != null) { byte[] numArray10 = CalibrationInfo.ReadBytes(streamReader); byte[] numArray11 = numArray10; if (numArray10 != null) { arrayLists.Add(new CalibrationInfo(numArray1, numArray3, numArray5, numArray7, numArray9, numArray11)); } } } } } } } } } } arrayLists.AddRange(CalibrationInfo.DefaultList); return((CalibrationInfo[])arrayLists.ToArray(typeof(CalibrationInfo))); }
/// <summary> /// Attempts to automatically calibrate the <see cref="FindLocation" /> method. /// </summary> /// <returns>The calibrated memory location -or- 0 if it could not be found.</returns> public static void Calibrate(CalibrationInfo[] info) { m_LocationPointer = null; ProcessStream pc = ProcessStream; if (pc == null) { return; } int ptrX = 0, sizeX = 0; int ptrY = 0, sizeY = 0; int ptrZ = 0, sizeZ = 0; int ptrF = 0, sizeF = 0; for (int i = 0; i < info.Length; ++i) { CalibrationInfo ci = info[i]; int ptr = Search(pc, ci.Mask, ci.Vals); if (ptr == 0) { continue; } if (ptrX == 0 && ci.DetX.Length > 0) { GetCoordDetails(pc, ptr, ci.DetX, out ptrX, out sizeX); } if (ptrY == 0 && ci.DetY.Length > 0) { GetCoordDetails(pc, ptr, ci.DetY, out ptrY, out sizeY); } if (ptrZ == 0 && ci.DetZ.Length > 0) { GetCoordDetails(pc, ptr, ci.DetZ, out ptrZ, out sizeZ); } if (ptrF == 0 && ci.DetF.Length > 0) { GetCoordDetails(pc, ptr, ci.DetF, out ptrF, out sizeF); } if (ptrX != 0 && ptrY != 0 && ptrZ != 0 && ptrF != 0) { break; } } if (ptrX != 0 || ptrY != 0 || ptrZ != 0 || ptrF != 0) { m_LocationPointer = new LocationPointer(ptrX, ptrY, ptrZ, ptrF, sizeX, sizeY, sizeZ, sizeF); } }
public static void Calibrate(CalibrationInfo[] info) { Client.m_LocationPointer = (LocationPointer)null; ProcessStream processStream = Client.ProcessStream; if (processStream == null) { return; } int coordPointer1 = 0; int coordSize1 = 0; int coordPointer2 = 0; int coordSize2 = 0; int coordPointer3 = 0; int coordSize3 = 0; int coordPointer4 = 0; int coordSize4 = 0; for (int index = 0; index < info.Length; ++index) { CalibrationInfo calibrationInfo = info[index]; int ptr = Client.Search(processStream, calibrationInfo.Mask, calibrationInfo.Vals); if (ptr != 0) { if (coordPointer1 == 0 && calibrationInfo.DetX.Length > 0) { Client.GetCoordDetails(processStream, ptr, calibrationInfo.DetX, out coordPointer1, out coordSize1); } if (coordPointer2 == 0 && calibrationInfo.DetY.Length > 0) { Client.GetCoordDetails(processStream, ptr, calibrationInfo.DetY, out coordPointer2, out coordSize2); } if (coordPointer3 == 0 && calibrationInfo.DetZ.Length > 0) { Client.GetCoordDetails(processStream, ptr, calibrationInfo.DetZ, out coordPointer3, out coordSize3); } if (coordPointer4 == 0 && calibrationInfo.DetF.Length > 0) { Client.GetCoordDetails(processStream, ptr, calibrationInfo.DetF, out coordPointer4, out coordSize4); } if (coordPointer1 != 0 && coordPointer2 != 0 && (coordPointer3 != 0 && coordPointer4 != 0)) { break; } } } if (coordPointer1 == 0 && coordPointer2 == 0 && (coordPointer3 == 0 && coordPointer4 == 0)) { return; } Client.m_LocationPointer = new LocationPointer(coordPointer1, coordPointer2, coordPointer3, coordPointer4, coordSize1, coordSize2, coordSize3, coordSize4); }
public static void Calibrate(CalibrationInfo[] info) { Client.m_LocationPointer = null; System.ProcessStream processStream = Client.ProcessStream; if (processStream == null) { return; } int num = 0; int num1 = 0; int num2 = 0; int num3 = 0; int num4 = 0; int num5 = 0; int num6 = 0; int num7 = 0; for (int i = 0; i < (int)info.Length; i++) { CalibrationInfo calibrationInfo = info[i]; int num8 = Client.Search(processStream, calibrationInfo.Mask, calibrationInfo.Vals); if (num8 != 0) { if (num == 0 && (int)calibrationInfo.DetX.Length > 0) { Client.GetCoordDetails(processStream, num8, calibrationInfo.DetX, out num, out num1); } if (num2 == 0 && (int)calibrationInfo.DetY.Length > 0) { Client.GetCoordDetails(processStream, num8, calibrationInfo.DetY, out num2, out num3); } if (num4 == 0 && (int)calibrationInfo.DetZ.Length > 0) { Client.GetCoordDetails(processStream, num8, calibrationInfo.DetZ, out num4, out num5); } if (num6 == 0 && (int)calibrationInfo.DetF.Length > 0) { Client.GetCoordDetails(processStream, num8, calibrationInfo.DetF, out num6, out num7); } if (num != 0 && num2 != 0 && num4 != 0 && num6 != 0) { break; } } } if (num != 0 || num2 != 0 || num4 != 0 || num6 != 0) { Client.m_LocationPointer = new Ultima.LocationPointer(num, num2, num4, num6, num1, num3, num5, num7); } }
/// <summary> /// Attempts to automatically calibrate the <see cref="FindLocation" /> method. /// </summary> /// <returns>The calibrated memory location -or- 0 if it could not be found.</returns> public static void Calibrate() { Calibrate(CalibrationInfo.GetList()); }
static CalibrationInfo() { CalibrationInfo[] calibrationInfo = new CalibrationInfo[] { new CalibrationInfo(new byte[] { 255, 0, 0, 0, 0, 255, 255, 255, 255, 0, 255, 255, 255, 255, 255 }, new byte[] { 160, 0, 0, 0, 0, 132, 192, 15, 133, 0, 0, 0, 0, 139, 13 }, new byte[0], new byte[0], new byte[0], new byte[] { 1, 4, 255, 255, 255, 1 }), new CalibrationInfo(new byte[] { 255, 255, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 0, 255, 0, 0, 0, 0, 255, 255, 255, 0, 255, 255, 0, 0, 0, 0, 255, 255, 255, 0 }, new byte[] { 139, 21, 0, 0, 0, 0, 131, 196, 16, 102, 137, 90, 0, 161, 0, 0, 0, 0, 102, 137, 120, 0, 139, 13, 0, 0, 0, 0, 102, 137, 113, 0 }, new byte[] { 2, 4, 4, 12, 1, 2 }, new byte[] { 14, 4, 4, 21, 1, 2 }, new byte[] { 24, 4, 4, 31, 1, 2 }, new byte[0]), new CalibrationInfo(new byte[] { 255, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 255, 255, 0, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0 }, new byte[] { 161, 0, 0, 0, 0, 104, 64, 46, 4, 1, 15, 191, 80, 0, 15, 191, 72, 0, 82, 81, 15, 191, 80, 0, 82, 141, 133, 228, 253, 255, 255, 104, 0, 0, 0, 0, 80, 232, 7, 68, 16, 0, 138, 13, 0, 0, 0, 0 }, new byte[] { 1, 4, 4, 23, 1, 2 }, new byte[] { 1, 4, 4, 17, 1, 2 }, new byte[] { 1, 4, 4, 13, 1, 2 }, new byte[] { 44, 4, 255, 255, 255, 1 }) }; CalibrationInfo.m_DefaultList = calibrationInfo; }
public static void Calibrate(CalibrationInfo[] info) { Client.m_LocationPointer = (LocationPointer) null; ProcessStream processStream = Client.ProcessStream; if (processStream == null) return; int coordPointer1 = 0; int coordSize1 = 0; int coordPointer2 = 0; int coordSize2 = 0; int coordPointer3 = 0; int coordSize3 = 0; int coordPointer4 = 0; int coordSize4 = 0; for (int index = 0; index < info.Length; ++index) { CalibrationInfo calibrationInfo = info[index]; int ptr = Client.Search(processStream, calibrationInfo.Mask, calibrationInfo.Vals); if (ptr != 0) { if (coordPointer1 == 0 && calibrationInfo.DetX.Length > 0) Client.GetCoordDetails(processStream, ptr, calibrationInfo.DetX, out coordPointer1, out coordSize1); if (coordPointer2 == 0 && calibrationInfo.DetY.Length > 0) Client.GetCoordDetails(processStream, ptr, calibrationInfo.DetY, out coordPointer2, out coordSize2); if (coordPointer3 == 0 && calibrationInfo.DetZ.Length > 0) Client.GetCoordDetails(processStream, ptr, calibrationInfo.DetZ, out coordPointer3, out coordSize3); if (coordPointer4 == 0 && calibrationInfo.DetF.Length > 0) Client.GetCoordDetails(processStream, ptr, calibrationInfo.DetF, out coordPointer4, out coordSize4); if (coordPointer1 != 0 && coordPointer2 != 0 && (coordPointer3 != 0 && coordPointer4 != 0)) break; } } if (coordPointer1 == 0 && coordPointer2 == 0 && (coordPointer3 == 0 && coordPointer4 == 0)) return; Client.m_LocationPointer = new LocationPointer(coordPointer1, coordPointer2, coordPointer3, coordPointer4, coordSize1, coordSize2, coordSize3, coordSize4); }