/* Native method wrappers */ private static void PostMessageSafe(IntPtr hWnd, uint msg, int wParam, int lParam) { bool returnValue = PostMessage(hWnd, msg, wParam, lParam); if (!returnValue) { // error consoleWriter.DebugLog(Marshal.GetLastWin32Error().ToString(), ConfigurationManager.LogType.ERROR); throw new Win32Exception(Marshal.GetLastWin32Error()); } else { string msgName; switch (msg) { case WM_KEYDOWN: msgName = "WM_KEYDOWN"; break; case WM_KEYUP: msgName = "WM_KEYUP"; break; default: msgName = ""; break; } consoleWriter.DebugLog($"Send msg {msgName} {(Keys)wParam} to client {hWnd}", ConfigurationManager.LogType.DEBUG); } }
public void SetMasterClient(int procId) // using this to test what memory i'm reading, ie. how to read memory { Process master = Process.GetProcessById(procId); MasterClient = new WoWClient(master.Id); consoleWriter.Clear(); consoleWriter.DebugLog($"Set master client to {MasterClient.Player.Name} - {procId}", ConfigurationManager.LogType.MESSAGE); consoleWriter.DebugLog($"Game version - {MasterClient.Player.GameVersion}", ConfigurationManager.LogType.MESSAGE); consoleWriter.DebugLog($"Realm name - {MasterClient.Player.RealmName}", ConfigurationManager.LogType.MESSAGE); consoleWriter.DebugLog($"Class - {MasterClient.Player.ClassName}", ConfigurationManager.LogType.MESSAGE); }
private void listBoxSelectMasterClient_SelectedIndexChanged(object sender, EventArgs e) { try { if (listBoxSelectMasterClient.SelectedItem != null) // avoid unecessary exceptions { string procDataUnformatted = listBoxSelectMasterClient.SelectedItem.ToString(); string procDataFormatted = procDataUnformatted.Replace(" ", ""); string[] procData = procDataFormatted.Split('-'); InputCallback.ProcManager.SetMasterClient(Convert.ToInt32(procData[1])); } } catch (Exception b) { consoleWriterMain.DebugLog(b.ToString(), ConfigurationManager.LogType.ERROR); } }