Skip to content

Commit

Permalink
Show error message if WZ/XML export path is not specified
Browse files Browse the repository at this point in the history
  • Loading branch information
eaxvac committed Jun 3, 2018
1 parent 77ac743 commit 3381b3b
Show file tree
Hide file tree
Showing 5 changed files with 65 additions and 10 deletions.
57 changes: 47 additions & 10 deletions HaRepacker/GUI/MainForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -539,9 +539,16 @@ private string GetOutputDirectory()
private void rawDataToolStripMenuItem_Click(object sender, EventArgs e)
{
OpenFileDialog dialog = new OpenFileDialog() { Title = HaRepacker.Properties.Resources.SelectWz, Filter = string.Format("{0}|*.wz", HaRepacker.Properties.Resources.WzFilter), Multiselect = true };
if (dialog.ShowDialog() != DialogResult.OK) return;
if (dialog.ShowDialog() != DialogResult.OK)
return;

string outPath = GetOutputDirectory();
if (outPath == "") return;
if (outPath == string.Empty)
{
MessageBox.Show(Properties.Resources.MainWzExportError, Properties.Resources.Warning, MessageBoxButtons.OK, MessageBoxIcon.Warning);
return;
}

WzPngMp3Serializer serializer = new WzPngMp3Serializer();
threadDone = false;
runningThread = new Thread(new ParameterizedThreadStart(RunWzFilesExtraction));
Expand All @@ -552,9 +559,16 @@ private void rawDataToolStripMenuItem_Click(object sender, EventArgs e)
private void imgToolStripMenuItem_Click(object sender, EventArgs e)
{
OpenFileDialog dialog = new OpenFileDialog() { Title = HaRepacker.Properties.Resources.SelectWz, Filter = string.Format("{0}|*.wz", HaRepacker.Properties.Resources.WzFilter), Multiselect = true };
if (dialog.ShowDialog() != DialogResult.OK) return;
if (dialog.ShowDialog() != DialogResult.OK)
return;

string outPath = GetOutputDirectory();
if (outPath == "") return;
if (outPath == string.Empty)
{
MessageBox.Show(Properties.Resources.MainWzExportError, Properties.Resources.Warning, MessageBoxButtons.OK, MessageBoxIcon.Warning);
return;
}

WzImgSerializer serializer = new WzImgSerializer();
threadDone = false;
runningThread = new Thread(new ParameterizedThreadStart(RunWzFilesExtraction));
Expand All @@ -565,7 +579,12 @@ private void imgToolStripMenuItem_Click(object sender, EventArgs e)
private void imgToolStripMenuItem1_Click(object sender, EventArgs e)
{
string outPath = GetOutputDirectory();
if (outPath == "") return;
if (outPath == string.Empty)
{
MessageBox.Show(Properties.Resources.MainWzExportError, Properties.Resources.Warning, MessageBoxButtons.OK, MessageBoxIcon.Warning);
return;
}

List<WzDirectory> dirs = new List<WzDirectory>();
List<WzImage> imgs = new List<WzImage>();
foreach (WzNode node in MainPanel.DataTree.SelectedNodes)
Expand All @@ -583,7 +602,12 @@ private void imgToolStripMenuItem1_Click(object sender, EventArgs e)
private void pNGsToolStripMenuItem_Click(object sender, EventArgs e)
{
string outPath = GetOutputDirectory();
if (outPath == "") return;
if (outPath == string.Empty)
{
MessageBox.Show(Properties.Resources.MainWzExportError, Properties.Resources.Warning, MessageBoxButtons.OK, MessageBoxIcon.Warning);
return;
}

List<WzObject> objs = new List<WzObject>();
foreach (WzNode node in MainPanel.DataTree.SelectedNodes)
if (node.Tag is WzObject)
Expand All @@ -598,8 +622,11 @@ private void pNGsToolStripMenuItem_Click(object sender, EventArgs e)
private void privateServerToolStripMenuItem_Click(object sender, EventArgs e)
{
string outPath = GetOutputDirectory();
if (outPath == "")
if (outPath == string.Empty)
{
MessageBox.Show(Properties.Resources.MainWzExportError, Properties.Resources.Warning, MessageBoxButtons.OK, MessageBoxIcon.Warning);
return;
}

List<WzDirectory> dirs = new List<WzDirectory>();
List<WzImage> imgs = new List<WzImage>();
Expand All @@ -619,8 +646,12 @@ private void privateServerToolStripMenuItem_Click(object sender, EventArgs e)
private void classicToolStripMenuItem_Click(object sender, EventArgs e)
{
string outPath = GetOutputDirectory();
if (outPath == "")
if (outPath == string.Empty)
{
MessageBox.Show(Properties.Resources.MainWzExportError, Properties.Resources.Warning, MessageBoxButtons.OK, MessageBoxIcon.Warning);
return;
}

List<WzDirectory> dirs = new List<WzDirectory>();
List<WzImage> imgs = new List<WzImage>();
foreach (WzNode node in MainPanel.DataTree.SelectedNodes)
Expand All @@ -639,8 +670,14 @@ private void classicToolStripMenuItem_Click(object sender, EventArgs e)

private void newToolStripMenuItem1_Click(object sender, EventArgs e)
{
SaveFileDialog dialog = new SaveFileDialog() { Title = HaRepacker.Properties.Resources.SelectOutXml, Filter = string.Format("{0}|*.xml", HaRepacker.Properties.Resources.XmlFilter) };
if (dialog.ShowDialog() != DialogResult.OK) return;
SaveFileDialog dialog = new SaveFileDialog() {
Title = HaRepacker.Properties.Resources.SelectOutXml,
Filter = string.Format("{0}|*.xml", HaRepacker.Properties.Resources.XmlFilter)
};

if (dialog.ShowDialog() != DialogResult.OK)
return;

List<WzObject> objs = new List<WzObject>();
foreach (WzNode node in MainPanel.DataTree.SelectedNodes)
if (node.Tag is WzObject)
Expand Down
9 changes: 9 additions & 0 deletions HaRepacker/Properties/Resources.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions HaRepacker/Properties/Resources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -374,4 +374,7 @@ Click "Yes" to download the new version.</value>
<data name="MainErrorImportingWzImageFile" xml:space="preserve">
<value>Error importing {0}.img file. Are you sure you have selected the correct WZ encryption?</value>
</data>
<data name="MainWzExportError" xml:space="preserve">
<value>Export directory not found. Please specify it under Tools -&gt; Options</value>
</data>
</root>
3 changes: 3 additions & 0 deletions HaRepacker/Properties/Resources.zh-CHS.resx
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,9 @@
<data name="MainUpdateTitle" xml:space="preserve">
<value>新版本</value>
</data>
<data name="MainWzExportError" xml:space="preserve">
<value>Export directory not found. Please specify it under Tools -&gt; Options</value>
</data>
<data name="Mp3Filter" xml:space="preserve">
<value>MPEG-1 Audio Layer 3 (*.mp3)</value>
</data>
Expand Down
3 changes: 3 additions & 0 deletions HaRepacker/Properties/Resources.zh-CHT.resx
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,9 @@
<data name="MainUpdateTitle" xml:space="preserve">
<value>新版本</value>
</data>
<data name="MainWzExportError" xml:space="preserve">
<value>Export directory not found. Please specify it under Tools -&gt; Options</value>
</data>
<data name="Mp3Filter" xml:space="preserve">
<value>MPEG-1 Audio Layer 3 (*.mp3)</value>
</data>
Expand Down

0 comments on commit 3381b3b

Please sign in to comment.