private void OnValidatingGameGenieCode(object sender, CancelEventArgs cancelEventArgs) { string gameGenieCode = gameGenieCodeTextBox.Text.Trim().ToUpper(); if (gameGenieCode.Length > 0 && !Cheat.IsValidGameGenieCode(gameGenieCode)) { errorProvider.SetError(gameGenieCodeTextBox, "Invalid Game Genie code"); cancelEventArgs.Cancel = true; } }
public bool AddCheat(string gameGenieCode) { gameGenieCode = gameGenieCode.Trim().ToUpper(); if (!Cheat.IsValidGameGenieCode(gameGenieCode)) { MessageBox.Show("Invalid Game Genie code", "Add Game Genie Code", MessageBoxButtons.OK, MessageBoxIcon.Error); return(false); } Cheat gameGenieCheat = Cheat.ParseGameGenieCode(gameGenieCode); if (cheats.ContainsKey(gameGenieCheat.Address)) { MessageBox.Show("A cheat is already patched at address: " + Hex.Format(gameGenieCheat.Address), "Add Game Genie Code", MessageBoxButtons.OK, MessageBoxIcon.Error); return(false); } cheats[gameGenieCheat.Address] = gameGenieCheat; PatchCheats(); return(true); }