private void B_ReadOffset_Click(object sender, EventArgs e) { var txt = TB_Offset.Text; var offset = Util.GetHexValue(txt); if (offset.ToString("X8") != txt.ToUpper().PadLeft(8, '0')) { WinFormsUtil.Alert("Specified offset is not a valid hex string."); return; } try { var result = Remote.ReadOffset(offset); if (!result) { WinFormsUtil.Alert("No valid data is located at the specified offset."); } } #pragma warning disable CA1031 // Do not catch general exception types catch (Exception ex) { WinFormsUtil.Error("Unable to load data from the specified offset.", ex.Message); } #pragma warning restore CA1031 // Do not catch general exception types }
private void B_ReadOffset_Click(object sender, EventArgs e) { bool readPointer = (ModifierKeys & Keys.Control) == Keys.Control; var txt = TB_Offset.Text; var offset = readPointer && Remote.Bot.com is ICommunicatorNX nx?nx.GetPointerAddress(TB_Pointer.Text) : Util.GetHexValue64(txt); if ((offset.ToString("X16") != txt.ToUpper().PadLeft(16, '0') && !readPointer) || offset == InjectionUtil.INVALID_PTR) { WinFormsUtil.Alert("Specified offset is not a valid hex string."); return; } try { var method = RWMethod.Heap; if (RB_Main.Checked) { method = RWMethod.Main; } if (RB_Absolute.Checked) { method = RWMethod.Absolute; } var result = Remote.ReadOffset(offset, method); if (!result) { WinFormsUtil.Alert("No valid data is located at the specified offset."); } } catch (Exception ex) { WinFormsUtil.Error("Unable to load data from the specified offset.", ex.Message); } }