private void MemoryWriteTimer_Tick(object sender, EventArgs e) { if (Process.GetProcessesByName("halo2").Length > 0) { statusPanel.BackColor = Color.Green; statusLabel.Text = "Halo 2 process detected."; if (!isActive) { HaloMemoryWriter.TryConnectToProcess(); MouseInput.Start(); writeFOVToMemory(); writeCrosshairOffsetToMemory(); isActive = true; jsonHelper.OutputJsonToFile(jsonHelper.Serialize (new JsonData(numFoV.Value, numViewOffset.Value, numHorizontal.Value, numVertical.Value))); } } else { statusPanel.BackColor = Color.Red; statusLabel.Text = "Halo 2 process not detected."; isActive = false; } }
private void processList_SelectionChangeCommitted(object sender, System.EventArgs e) { if (processList.SelectedItem != null) { HaloMemoryWriter.TryConnectToProcess(processList.SelectedItem.ToString()); } }
/// <summary> /// Gets all the processes and adds them to the dropdown list /// </summary> private void UpdateProcesses() { lstProcessList.SuspendLayout(); lstProcessList.Items.Clear(); List <string> processNames = HaloMemoryWriter.GetProcessNames(); for (int i = 0; i < processNames.Count; i++) { lstProcessList.Items.Add(processNames[i]); if (processNames[i] == "halo2") { if (HaloMemoryWriter.TryConnectToProcess(processNames[i])) { lstProcessList.SelectedIndex = i; } } } lstProcessList.ResumeLayout(); }