public SpeedOMeter(int decimals, SolidBrush Color, int UpdateRate) { Decimals = decimals; PaintColor = Color; thisSpeedOMeter = this; LoadFont(); InitializeComponent(UpdateRate); }
private void CloseSpeedOMeterButton_Click(object sender, EventArgs e) { if (!FullScreenMode) { if (LaunchSpeedOMeter.ForeColor == Color.Green) { if (SpeedOMeter != null) { SpeedOMeter.SpeedOMeterClose(); } SpeedOMeter = new SpeedOMeter(0, ColorPickerColor, (int)UpdateRateMenu.SelectedItem); // Random int given wich, does not matter LaunchSpeedOMeter.ForeColor = Color.Red; } } else { if (fpsHijacker != null) { fpsHijacker.destroy(); } LaunchSpeedOMeter.ForeColor = Color.Red; } }
private void LaunchSpeedOMeter_Click(object sender, EventArgs e) { if (Process.GetProcessesByName("MirrorsEdgeCatalyst").Length > 0) { if (!FullScreenMode) { // Display speed using overlay (Window/Borderless compatible only) FormCollection fc = Application.OpenForms; if (fc.Count < 2) { if (UpdateRateMenu.SelectedItem == null) { UpdateRateMenu.SelectedItem = 50; } SpeedOMeter = new SpeedOMeter((int)DecimalsNumericBox.Value, ColorPickerColor, (int)UpdateRateMenu.SelectedItem); new Thread(() => Application.Run(SpeedOMeter)).Start(); LaunchSpeedOMeter.ForeColor = Color.Green; } } else { // Display Speed using IG Overlay Hijacking method // All work done in FPSHijacker.cs if (UpdateRateMenu.SelectedItem == null) { UpdateRateMenu.SelectedItem = 50; } fpsHijacker = new FpsHijacker((int)UpdateRateMenu.SelectedItem, (int)DecimalsNumericBox.Value, (float)ScaleFontUIValue.Value, (int)XOffsetUIValue.Value, (int)YOffsetUIValue.Value, (byte)AlphaFontScaleBar.Value ); LaunchSpeedOMeter.ForeColor = Color.Green; } } else { // Mirror's edge catalyst isn't running => ask user if he wants to run it DialogResult dr = MessageBox.Show("It appears that Mirror's Edge : Catalyst isn't running.\n Shall I run it for you ?", "ME:C is not running", MessageBoxButtons.YesNo); if (dr == DialogResult.Yes) { try { // get mexExecPath RegistryKey mecRegKey = Registry.LocalMachine.OpenSubKey("SOFTWARE\\Wow6432Node\\EA Games\\Mirrors Edge Catalyst"); string mecExecPath = (string)mecRegKey.GetValue("Install Dir") + "MirrorsEdgeCatalyst.exe"; // Launch Mirror's Edge Catalyst Process mecProcess = new Process(); mecProcess.StartInfo.FileName = mecExecPath; mecProcess.Start(); } catch { MessageBox.Show("Sorry I couldn't locate MirrorsEdgeCatalyst.exe"); } } } }