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:
authorAlexey 'Cluster' Avdyukhin <clusterrr@clusterrr.com>2017-02-05 19:28:18 +0300
committerAlexey 'Cluster' Avdyukhin <clusterrr@clusterrr.com>2017-02-05 19:28:18 +0300
commit2a7a875eb541bf23fc3c453447e6a3346103fe33 (patch)
treecc3e94c304d895586dd5b3fb4e5a859ca1f84b09 /GameGenieCodeAddModForm.cs
parent50c42899f67784834697d118eb241f573b2a9955 (diff)
Game Genie database support (great work Nhakin!)
Diffstat (limited to 'GameGenieCodeAddModForm.cs')
-rw-r--r--GameGenieCodeAddModForm.cs31
1 files changed, 10 insertions, 21 deletions
diff --git a/GameGenieCodeAddModForm.cs b/GameGenieCodeAddModForm.cs
index 8e562416..b99f2e09 100644
--- a/GameGenieCodeAddModForm.cs
+++ b/GameGenieCodeAddModForm.cs
@@ -14,11 +14,12 @@ namespace com.clusterrr.hakchi_gui
{
public partial class GameGenieCodeAddModForm : Form
{
- NesGame FGame = null;
+ readonly NesGame FGame = null;
- public GameGenieCodeAddModForm()
+ public GameGenieCodeAddModForm(NesGame game)
{
InitializeComponent();
+ FGame = game;
}
public string Code
@@ -43,33 +44,20 @@ namespace com.clusterrr.hakchi_gui
textBoxDescription.Text = value;
}
}
- public NesGame Game
- {
- get
- {
- return FGame;
- }
- set
- {
- FGame = value;
- }
- }
-
private void buttonOk_Click(object sender, EventArgs e)
{
- if (textBoxCode.Text == "")
+ if (string.IsNullOrEmpty(textBoxCode.Text.Trim()))
{
- MessageBox.Show(this, "You must enter a code!", Resources.Error, MessageBoxButtons.OK, MessageBoxIcon.Warning);
+ MessageBox.Show(this, Resources.GGCodeEmpty, 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"));
+ NesFile lGame = new NesFile(FGame.NesPath);
try
{
- lGame.PRG = GameGenie.Patch(lGame.PRG, textBoxCode.Text.Trim());
+ lGame.PRG = GameGenie.Patch(lGame.PRG, textBoxCode.Text);
}
catch (GameGenieFormatException)
{
@@ -83,11 +71,12 @@ namespace com.clusterrr.hakchi_gui
}
}
- if (textBoxDescription.Text == "")
+ if (string.IsNullOrEmpty(textBoxDescription.Text.Trim()))
{
- MessageBox.Show(this, "You must enter a description!", Resources.Error, MessageBoxButtons.OK, MessageBoxIcon.Warning);
+ MessageBox.Show(this, Resources.GGDescriptionEmpty, Resources.Error, MessageBoxButtons.OK, MessageBoxIcon.Warning);
return;
}
+ textBoxCode.Text = textBoxCode.Text.ToUpper().Trim();
DialogResult = System.Windows.Forms.DialogResult.OK;
}
}