Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/ClusterM/hakchi2.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNhakin <KahnAbyss1@gmail.com>2017-02-04 18:18:54 +0300
committerGitHub <noreply@github.com>2017-02-04 18:18:54 +0300
commitfdb1b36cff233053d1d74aa5909c5d9e010af50d (patch)
treefd09b5ca56e23687c6b83501683fc8836c9b573b /GameGenieCodeAddModForm.cs
parentfdef741d924443e5d84a697b24ee480c6b961984 (diff)
Add files via upload
Diffstat (limited to 'GameGenieCodeAddModForm.cs')
-rw-r--r--GameGenieCodeAddModForm.cs94
1 files changed, 94 insertions, 0 deletions
diff --git a/GameGenieCodeAddModForm.cs b/GameGenieCodeAddModForm.cs
new file mode 100644
index 00000000..8e562416
--- /dev/null
+++ b/GameGenieCodeAddModForm.cs
@@ -0,0 +1,94 @@
+using com.clusterrr.hakchi_gui.Properties;
+using com.clusterrr.Famicom;
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Data;
+using System.Drawing;
+using System.Linq;
+using System.Text;
+using System.Windows.Forms;
+using System.IO;
+
+namespace com.clusterrr.hakchi_gui
+{
+ public partial class GameGenieCodeAddModForm : Form
+ {
+ NesGame FGame = null;
+
+ public GameGenieCodeAddModForm()
+ {
+ InitializeComponent();
+ }
+
+ public string Code
+ {
+ get
+ {
+ return textBoxCode.Text;
+ }
+ set
+ {
+ textBoxCode.Text = value;
+ }
+ }
+ public string Description
+ {
+ get
+ {
+ return textBoxDescription.Text;
+ }
+ set
+ {
+ textBoxDescription.Text = value;
+ }
+ }
+ public NesGame Game
+ {
+ get
+ {
+ return FGame;
+ }
+ set
+ {
+ FGame = value;
+ }
+ }
+
+ private void buttonOk_Click(object sender, EventArgs e)
+ {
+ if (textBoxCode.Text == "")
+ {
+ MessageBox.Show(this, "You must enter a code!", Resources.Error, MessageBoxButtons.OK, MessageBoxIcon.Warning);
+ return;
+ }
+
+ if (FGame != null)
+ {
+ string lGamesDir = Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), "games");
+ NesFile lGame = new NesFile(Path.Combine(Path.Combine(lGamesDir, FGame.Code), FGame.Code + ".nes"));
+ try
+ {
+ lGame.PRG = GameGenie.Patch(lGame.PRG, textBoxCode.Text.Trim());
+ }
+ catch (GameGenieFormatException)
+ {
+ MessageBox.Show(this, string.Format(Resources.GameGenieFormatError, textBoxCode.Text, FGame.Name), Resources.Error, MessageBoxButtons.OK, MessageBoxIcon.Error);
+ return;
+ }
+ catch (GameGenieNotFoundException)
+ {
+ MessageBox.Show(this, string.Format(Resources.GameGenieNotFound, textBoxCode.Text, FGame.Name), Resources.Error, MessageBoxButtons.OK, MessageBoxIcon.Error);
+ return;
+ }
+ }
+
+ if (textBoxDescription.Text == "")
+ {
+ MessageBox.Show(this, "You must enter a description!", Resources.Error, MessageBoxButtons.OK, MessageBoxIcon.Warning);
+ return;
+ }
+ DialogResult = System.Windows.Forms.DialogResult.OK;
+ }
+ }
+}