Skip to content

Commit

Permalink
Replace all messages with strings from resource file
Browse files Browse the repository at this point in the history
  • Loading branch information
TheIndra55 committed Mar 13, 2023
1 parent 561f4ed commit 54692e7
Show file tree
Hide file tree
Showing 4 changed files with 128 additions and 8 deletions.
12 changes: 6 additions & 6 deletions Yura/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ public void OpenBigfile(string bigfile, IFileSettings settings)
_bigfile = new TigerArchive(bigfile, _littleEndian);
break;
default:
MessageBox.Show(this, "You did not select a game, make sure to select one using the 'Game' dropdown.", "No game selected", MessageBoxButton.OK, MessageBoxImage.Exclamation);
MessageBox.Show(this, Properties.Resources.NoGameSelectedMessage, Properties.Resources.NoGameSelected, MessageBoxButton.OK, MessageBoxImage.Exclamation);
return;
}

Expand All @@ -166,7 +166,7 @@ public void OpenBigfile(string bigfile, IFileSettings settings)
}
catch (Exception e)
{
MessageBox.Show(this, e.Message, "Failed to open bigfile", MessageBoxButton.OK, MessageBoxImage.Error);
MessageBox.Show(this, e.Message, Properties.Resources.FailedOpenBigfile, MessageBoxButton.OK, MessageBoxImage.Error);
return;
}

Expand Down Expand Up @@ -404,7 +404,7 @@ private void FileView_MouseDoubleClick(object sender, MouseButtonEventArgs e)
}
catch (IOException ex)
{
MessageBox.Show(ex.Message, "Failed to write file", MessageBoxButton.OK, MessageBoxImage.Warning);
MessageBox.Show(ex.Message, Properties.Resources.FailedWriteFile, MessageBoxButton.OK, MessageBoxImage.Warning);
}
}

Expand Down Expand Up @@ -444,7 +444,7 @@ private void ExportBtn_Click(object sender, RoutedEventArgs e)
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Failed to export files", MessageBoxButton.OK, MessageBoxImage.Warning);
MessageBox.Show(ex.Message, Properties.Resources.FailedExportFiles, MessageBoxButton.OK, MessageBoxImage.Warning);

break;
}
Expand Down Expand Up @@ -492,7 +492,7 @@ private void ExportFile(FileViewFile item)
}
catch (IOException ex)
{
MessageBox.Show(ex.Message, "Failed to write file", MessageBoxButton.OK, MessageBoxImage.Warning);
MessageBox.Show(ex.Message, Properties.Resources.FailedWriteFile, MessageBoxButton.OK, MessageBoxImage.Warning);
}
}
}
Expand Down Expand Up @@ -560,7 +560,7 @@ private void SearchBox_KeyDown(object sender, KeyEventArgs e)

if (_bigfile == null)
{
MessageBox.Show("No bigfile is open, open a bigfile under 'File > Open'", "No bigfile open", MessageBoxButton.OK, MessageBoxImage.Error);
MessageBox.Show(Properties.Resources.NoBigfileOpenMessage, Properties.Resources.NoBigfileOpen, MessageBoxButton.OK, MessageBoxImage.Error);
return;
}

Expand Down
90 changes: 90 additions & 0 deletions Yura/Properties/Resources.Designer.cs

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

30 changes: 30 additions & 0 deletions Yura/Properties/Resources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -117,10 +117,40 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="DeepSearchNotSupported" xml:space="preserve">
<value>This game is currently not supported for deep search.</value>
</data>
<data name="FailedExportFiles" xml:space="preserve">
<value>Failed to export files</value>
</data>
<data name="FailedOpenBigfile" xml:space="preserve">
<value>Failed to open bigfile</value>
</data>
<data name="FailedWriteFile" xml:space="preserve">
<value>Failed to write file</value>
</data>
<data name="FilePartNotFound" xml:space="preserve">
<value>File part not found</value>
</data>
<data name="FilePartNotFoundMessage" xml:space="preserve">
<value>A part of the bigfile was not found, make sure you are using the right alignment and your game files are complete.</value>
</data>
<data name="GameNotSupported" xml:space="preserve">
<value>Game not supported</value>
</data>
<data name="NoBigfileOpen" xml:space="preserve">
<value>No bigfile open</value>
</data>
<data name="NoBigfileOpenMessage" xml:space="preserve">
<value>No bigfile is open, open a bigfile under 'File &gt; Open'.</value>
</data>
<data name="NoBigfileOpenMessage2" xml:space="preserve">
<value>No bigfile is open, open a bigfile under 'File &gt; Open' and reopen this window.</value>
</data>
<data name="NoGameSelected" xml:space="preserve">
<value>No game selected</value>
</data>
<data name="NoGameSelectedMessage" xml:space="preserve">
<value>You did not select a game, make sure to select one using the 'Game' dropdown.</value>
</data>
</root>
4 changes: 2 additions & 2 deletions Yura/SearchWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ private void SearchButton_Click(object sender, RoutedEventArgs e)
{
if (Archive == null)
{
MessageBox.Show(this, "No bigfile is open, open a bigfile under 'File > Open' and reopen this window.", "No bigfile open", MessageBoxButton.OK, MessageBoxImage.Error);
MessageBox.Show(this, Properties.Resources.NoBigfileOpenMessage2, Properties.Resources.NoBigfileOpen, MessageBoxButton.OK, MessageBoxImage.Error);
return;
}

Expand Down Expand Up @@ -94,7 +94,7 @@ private void SearchTask(IEnumerable<ArchiveRecord> files, int id, SectionType ty
// check drm version
if (BitConverter.ToUInt32(content) != 14)
{
MessageBox.Show("This game is currently not supported for deep search.", "Game not supported", MessageBoxButton.OK, MessageBoxImage.Error);
MessageBox.Show(Properties.Resources.DeepSearchNotSupported, Properties.Resources.GameNotSupported, MessageBoxButton.OK, MessageBoxImage.Error);
break;
}

Expand Down

0 comments on commit 54692e7

Please sign in to comment.