private void ProcessName_KeyPress(object sender, KeyPressEventArgs e) { if (e.KeyChar == ' ') { spacePressed++; System.Media.SystemSounds.Exclamation.Play(); e.Handled = true; if (spacePressed == 10) { Wav.Play(@"C:\Windows\Media\chord.wav"); Dialogs.Win95.ShowMsg("Stop pressing space!!!", "Quit it!"); } } }
// Inject the DLL into the process and show errors if they occur private void Inject_Click(object sender, EventArgs e) { if (FileList.CheckedItems.Count == 0) { MessageBox.Show("No files were checked!\nNothing to inject", "Error"); return; } DllInjector ayy = DllInjector.GetInstance; int failed = 0; int attempted = FileList.CheckedItems.Count; for (int i = 0; i < attempted; i++) { string path = (FileList.CheckedItems[i] as CheatInfo).Path; switch (ayy.Inject(ProcessName.Text, path)) { case DllInjectionResult.DllNotFound: MessageBox.Show( $"Specified DLL file not found!\n\n" + $"Attempted to inject:\n" + $"'{path}'", "Error"); failed++; break; case DllInjectionResult.GameProcessNotFound: MessageBox.Show($"'{ProcessName.Text}.exe' couldn't be found!", "Error"); failed++; return; case DllInjectionResult.InjectionFailed: MessageBox.Show($"Injection failed!\n\n" + $"Attempted to inject:\n" + $"'{path}'", "Error"); failed++; break; } } if (MsgAfterInject.Checked) { Wav.Play(@"C:\Windows\Media\chord.wav"); if (failed == 0) { Dialogs.Win95.ShowMsg( "The injection was successful!\n" + "All DLLs have been injected", "Great news!"); } else { Dialogs.Win95.ShowMsg( $"{attempted - failed}/{attempted} " + $"DLLs were successfuly injected", "News of the day"); } } if (CloseAfterInject.Checked) { Close(); } }