public static bool initme() { frmTest = new Frame(0); frmData = new Frame(0); frmMailData = new Frame(0); Frame frmTemp; int RetryCount = 0; while (frmTest.BaseAddress == 0 || frmData.BaseAddress == 0 || frmMailData.BaseAddress == 0) { try { InterfaceHelper.ReloadFrames(); Thread.Sleep(2000); frmTemp = InterfaceHelper.GetFrameByName("frmTest"); frmTest = frmTemp.GetChildObject("frmTestText"); //foreach ( ) frmTemp = InterfaceHelper.GetFrameByName("frmData"); frmData = frmTemp.GetChildObject("frmDataText"); frmTemp = InterfaceHelper.GetFrameByName("frmMailData"); frmMailData = frmTemp.GetChildObject("frmMailDataText"); } catch (Exception e) { Logging.Write("SpyFrame.initme() Error:" + e); } RetryCount++; if (RetryCount > 10) return false; Thread.Sleep(1000); } return true; }
/// <summary> /// Updates the internal list with all frames /// </summary> public static void ReloadFrames() { var allFrames = new Dictionary<String, Frame>(); var @base = Memory.ReadRelative<uint>((uint) Pointers.UiFrame.FrameBase); var currentFrame = Memory.Read<uint>(@base + (uint) Pointers.UiFrame.FirstFrame); while (currentFrame != 0) { var f = new Frame(currentFrame); if (!allFrames.ContainsKey(f.GetName)) allFrames.Add(f.GetName, f); currentFrame = Memory.Read<uint>(currentFrame + Memory.Read<uint>(@base + (uint) Pointers.UiFrame.NextFrame) + 4); Thread.Sleep(1); } _allFrames = allFrames; }
private void DebugBtnFindUiClick(object sender, EventArgs e) { WriteLine("Going to try and find: " + DebugTBUIName.Text); DebugTBLog.Clear(); if (DebugTBUIName.Text != "") { try { _item = InterfaceHelper.GetFrameByName(DebugTBUIName.Text); if (_item != null) { WriteLine("Found the item, dumping info"); WriteLine("Visible: " + _item.IsVisible); WriteLine("Text: " + _item.GetText); foreach (Frame child in _item.GetChilds) { WriteLine("Name: " + child.GetName); WriteLine("Visible: " + child.IsVisible); WriteLine("Text: " + child.GetText); } } else { WriteLine("Could not find the item"); } } catch (Exception d) { WriteLine("Error when trying to log interface item: " + d); } } }
/// <summary> /// Updates the internal list with all frames /// </summary> public static void ReloadFrames() { try { var allFrames = new Dictionary<String, Frame>(); var @base = Memory.ReadRelative<uint>((uint)Pointers.UiFrame.FrameBase); var currentFrame = Memory.Read<uint>(@base + (uint)Pointers.UiFrame.FirstFrame); //Logging.Write("OKOKOK"); while (currentFrame != 0) { var f = new Frame(currentFrame); if (!allFrames.ContainsKey(f.GetName)) allFrames.Add(f.GetName, f); currentFrame = Memory.Read<uint>(currentFrame + Memory.Read<uint>(@base + (uint)Pointers.UiFrame.NextFrame) + 4); Thread.Sleep(1); } //lock (Locker) //{ _allFrames = allFrames; //} } catch (Exception e) { if (!ObjectManager.InGame) StopUpdate(); Logging.Write("ReloadFrames出现错误: " + e); } }