From 9daf59f78eccbb1e9689b51342ea764f1d56f698 Mon Sep 17 00:00:00 2001 From: Natalia Portillo Date: Sun, 30 Aug 2020 03:00:14 +0100 Subject: [PATCH] Move strings to resources. --- RomRepoMgr.Core/Base32.cs | 10 +- RomRepoMgr.Core/Checksums/SpamSumContext.cs | 40 +- RomRepoMgr.Core/ForcedSeekStream.cs | 5 +- .../Resources/Localization.Designer.cs | 495 ++++++++ RomRepoMgr.Core/Resources/Localization.resx | 163 +++ RomRepoMgr.Core/RomRepoMgr.Core.csproj | 16 + RomRepoMgr.Core/Workers/Compression.cs | 17 +- RomRepoMgr.Core/Workers/DatImporter.cs | 27 +- RomRepoMgr.Core/Workers/FileExporter.cs | 17 +- RomRepoMgr.Core/Workers/FileImporter.cs | 37 +- RomRepoMgr.Database/Context.cs | 3 +- .../Resources/Localization.Designer.cs | 54 + .../Resources/Localization.resx | 22 + .../RomRepoMgr.Database.csproj | 15 + RomRepoMgr.Settings/Interop/DetectOS.cs | 9 +- .../Resources/Localization.Designer.cs | 54 + .../Resources/Localization.resx | 22 + .../RomRepoMgr.Settings.csproj | 15 + RomRepoMgr.sln.DotSettings | 7 +- RomRepoMgr/Resources/Localization.Designer.cs | 1047 +++++++++++++++++ RomRepoMgr/Resources/Localization.resx | 349 ++++++ RomRepoMgr/RomRepoMgr.csproj | 11 + RomRepoMgr/ViewModels/AboutViewModel.cs | 21 +- RomRepoMgr/ViewModels/EditDatViewModel.cs | 50 +- RomRepoMgr/ViewModels/ExportDatViewModel.cs | 14 +- RomRepoMgr/ViewModels/ExportRomsViewModel.cs | 7 +- .../ViewModels/ImportDatFolderViewModel.cs | 27 +- RomRepoMgr/ViewModels/ImportDatViewModel.cs | 7 +- .../ViewModels/ImportRomFolderViewModel.cs | 25 +- RomRepoMgr/ViewModels/MainWindowViewModel.cs | 86 +- RomRepoMgr/ViewModels/RemoveDatViewModel.cs | 11 +- RomRepoMgr/ViewModels/SettingsViewModel.cs | 99 +- .../ViewModels/SplashWindowViewModel.cs | 113 +- RomRepoMgr/Views/MainWindow.xaml | 41 +- 34 files changed, 2597 insertions(+), 339 deletions(-) create mode 100644 RomRepoMgr.Core/Resources/Localization.Designer.cs create mode 100644 RomRepoMgr.Core/Resources/Localization.resx create mode 100644 RomRepoMgr.Database/Resources/Localization.Designer.cs create mode 100644 RomRepoMgr.Database/Resources/Localization.resx create mode 100644 RomRepoMgr.Settings/Resources/Localization.Designer.cs create mode 100644 RomRepoMgr.Settings/Resources/Localization.resx create mode 100644 RomRepoMgr/Resources/Localization.Designer.cs create mode 100644 RomRepoMgr/Resources/Localization.resx diff --git a/RomRepoMgr.Core/Base32.cs b/RomRepoMgr.Core/Base32.cs index 85561f7..dd264cf 100644 --- a/RomRepoMgr.Core/Base32.cs +++ b/RomRepoMgr.Core/Base32.cs @@ -6,6 +6,7 @@ using System; using System.Text; +using RomRepoMgr.Core.Resources; namespace RomRepoMgr.Core { @@ -130,8 +131,7 @@ namespace RomRepoMgr.Core // Check the size if(outputBytes.Length == 0) - throw new - ArgumentException("Specified string is not valid Base32 format because it doesn't have enough data to construct a complete byte array"); + throw new ArgumentException(Localization.Base32_Not_enought_data); // Position in the string int base32Position = 0; @@ -154,10 +154,8 @@ namespace RomRepoMgr.Core // Check if found if(currentBase32Byte < 0) - throw new - ArgumentException(string. - Format("Specified string is not valid Base32 format because character \"{0}\" does not exist in Base32 alphabet", - base32String[base32Position])); + throw new ArgumentException(string.Format(Localization.Base32_Invalid_format, + base32String[base32Position])); // Calculate the number of bits we can extract out of current input character to fill missing bits in the output byte int bitsAvailableInByte = diff --git a/RomRepoMgr.Core/Checksums/SpamSumContext.cs b/RomRepoMgr.Core/Checksums/SpamSumContext.cs index 5e1c769..d181e76 100644 --- a/RomRepoMgr.Core/Checksums/SpamSumContext.cs +++ b/RomRepoMgr.Core/Checksums/SpamSumContext.cs @@ -43,6 +43,7 @@ using System; using System.Runtime.CompilerServices; using System.Text; using Aaru.CommonTypes.Interfaces; +using RomRepoMgr.Core.Resources; namespace Aaru.Checksums { @@ -109,7 +110,7 @@ namespace Aaru.Checksums /// /// Returns a byte array of the hash value. - public byte[] Final() => throw new NotImplementedException("SpamSum does not have a binary representation."); + public byte[] Final() => throw new NotImplementedException(Localization.Spamsum_no_binary); /// /// Returns a base64 representation of the hash value. @@ -172,7 +173,7 @@ namespace Aaru.Checksums return; if(_self.Bhend == 0) // assert - throw new Exception("Assertion failed"); + throw new Exception(Localization.Assertion_failed); uint obh = _self.Bhend - 1; uint nbh = _self.Bhend; @@ -188,7 +189,7 @@ namespace Aaru.Checksums void fuzzy_try_reduce_blockhash() { if(_self.Bhstart >= _self.Bhend) - throw new Exception("Assertion failed"); + throw new Exception(Localization.Assertion_failed); if(_self.Bhend - _self.Bhstart < 2) /* Need at least two working hashes. */ @@ -276,7 +277,7 @@ namespace Aaru.Checksums /* Verify that our elimination was not overeager. */ if(!(bi == 0 || ((ulong)SSDEEP_BS(bi) / 2) * SPAMSUM_LENGTH < _self.TotalSize)) - throw new Exception("Assertion failed"); + throw new Exception(Localization.Assertion_failed); int resultOff = 0; @@ -286,7 +287,7 @@ namespace Aaru.Checksums ++bi; if(bi >= NUM_BLOCKHASHES) - throw new OverflowException("The input exceeds data types."); + throw new OverflowException(Localization.Spamsum_Input_exceeds_data); } /* Adapt blocksize guess to actual digest length. */ @@ -299,17 +300,17 @@ namespace Aaru.Checksums if(bi > 0 && _self.Bh[bi].Dlen < SPAMSUM_LENGTH / 2) - throw new Exception("Assertion failed"); + throw new Exception(Localization.Assertion_failed); sb.AppendFormat("{0}:", SSDEEP_BS(bi)); int i = Encoding.ASCII.GetBytes(sb.ToString()).Length; if(i <= 0) /* Maybe snprintf has set errno here? */ - throw new OverflowException("The input exceeds data types."); + throw new OverflowException(Localization.Spamsum_Input_exceeds_data); if(i >= remain) - throw new Exception("Assertion failed"); + throw new Exception(Localization.Assertion_failed); remain -= i; @@ -320,7 +321,7 @@ namespace Aaru.Checksums i = (int)_self.Bh[bi].Dlen; if(i > remain) - throw new Exception("Assertion failed"); + throw new Exception(Localization.Assertion_failed); Array.Copy(_self.Bh[bi].Digest, 0, result, resultOff, i); resultOff += i; @@ -329,7 +330,7 @@ namespace Aaru.Checksums if(h != 0) { if(remain <= 0) - throw new Exception("Assertion failed"); + throw new Exception(Localization.Assertion_failed); result[resultOff] = _b64[_self.Bh[bi].H % 64]; @@ -345,7 +346,7 @@ namespace Aaru.Checksums else if(_self.Bh[bi].Digest[i] != 0) { if(remain <= 0) - throw new Exception("Assertion failed"); + throw new Exception(Localization.Assertion_failed); result[resultOff] = _self.Bh[bi].Digest[i]; @@ -360,7 +361,7 @@ namespace Aaru.Checksums } if(remain <= 0) - throw new Exception("Assertion failed"); + throw new Exception(Localization.Assertion_failed); result[resultOff++] = 0x3A; // ':' --remain; @@ -371,7 +372,7 @@ namespace Aaru.Checksums i = (int)_self.Bh[bi].Dlen; if(i > remain) - throw new Exception("Assertion failed"); + throw new Exception(Localization.Assertion_failed); Array.Copy(_self.Bh[bi].Digest, 0, result, resultOff, i); resultOff += i; @@ -380,7 +381,7 @@ namespace Aaru.Checksums if(h != 0) { if(remain <= 0) - throw new Exception("Assertion failed"); + throw new Exception(Localization.Assertion_failed); h = _self.Bh[bi].Halfh; result[resultOff] = _b64[h % 64]; @@ -401,7 +402,7 @@ namespace Aaru.Checksums if(i != 0) { if(remain <= 0) - throw new Exception("Assertion failed"); + throw new Exception(Localization.Assertion_failed); result[resultOff] = (byte)i; @@ -419,10 +420,10 @@ namespace Aaru.Checksums else if(h != 0) { if(_self.Bh[bi].Dlen != 0) - throw new Exception("Assertion failed"); + throw new Exception(Localization.Assertion_failed); if(remain <= 0) - throw new Exception("Assertion failed"); + throw new Exception(Localization.Assertion_failed); result[resultOff++] = _b64[_self.Bh[bi].H % 64]; /* No need to bother with FUZZY_FLAG_ELIMSEQ, because this @@ -435,14 +436,13 @@ namespace Aaru.Checksums /// Gets the hash of a file /// File path. - public static byte[] File(string filename) => - throw new NotImplementedException("SpamSum does not have a binary representation."); + public static byte[] File(string filename) => throw new NotImplementedException(Localization.Spamsum_no_binary); /// Gets the hash of a file in hexadecimal and as a byte array. /// File path. /// Byte array of the hash value. public static string File(string filename, out byte[] hash) => - throw new NotImplementedException("Not yet implemented."); + throw new NotImplementedException(Localization.Not_yet_implemented); /// Gets the hash of the specified data buffer. /// Data buffer. diff --git a/RomRepoMgr.Core/ForcedSeekStream.cs b/RomRepoMgr.Core/ForcedSeekStream.cs index c5c36b4..de5df0a 100644 --- a/RomRepoMgr.Core/ForcedSeekStream.cs +++ b/RomRepoMgr.Core/ForcedSeekStream.cs @@ -32,6 +32,7 @@ using System; using System.IO; +using RomRepoMgr.Core.Resources; namespace RomRepoMgr.Core { @@ -162,14 +163,14 @@ namespace RomRepoMgr.Core { case SeekOrigin.Begin: if(offset < 0) - throw new IOException("Cannot seek before stream start."); + throw new IOException(Localization.Cannot_seek_before_start); SetPosition(offset); break; case SeekOrigin.End: if(offset > 0) - throw new IOException("Cannot seek after stream end."); + throw new IOException(Localization.Cannot_seek_after_end); if(_streamLength == 0) CalculateLength(); diff --git a/RomRepoMgr.Core/Resources/Localization.Designer.cs b/RomRepoMgr.Core/Resources/Localization.Designer.cs new file mode 100644 index 0000000..34a31ab --- /dev/null +++ b/RomRepoMgr.Core/Resources/Localization.Designer.cs @@ -0,0 +1,495 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace RomRepoMgr.Core.Resources { + using System; + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Localization { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Localization() { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("RomRepoMgr.Core.Resources.Localization", typeof(Localization).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + + /// + /// Looks up a localized string similar to Adding DAT to database.... + /// + internal static string AddingDatToDatabase { + get { + return ResourceManager.GetString("AddingDatToDatabase", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Adding machines (games).... + /// + internal static string AddingMachines { + get { + return ResourceManager.GetString("AddingMachines", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Adding ROMs.... + /// + internal static string AddingRoms { + get { + return ResourceManager.GetString("AddingRoms", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Assertion failed. + /// + internal static string Assertion_failed { + get { + return ResourceManager.GetString("Assertion_failed", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Specified string is not valid Base32 format because character "{0}" does not exist in Base32 alphabet. + /// + internal static string Base32_Invalid_format { + get { + return ResourceManager.GetString("Base32_Invalid_format", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Specified string is not valid Base32 format because it doesn't have enough data to construct a complete byte array. + /// + internal static string Base32_Not_enought_data { + get { + return ResourceManager.GetString("Base32_Not_enought_data", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Cannot seek after stream end.. + /// + internal static string Cannot_seek_after_end { + get { + return ResourceManager.GetString("Cannot_seek_after_end", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Cannot seek before stream start.. + /// + internal static string Cannot_seek_before_start { + get { + return ResourceManager.GetString("Cannot_seek_before_start", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Cannot find file with hash {0} in the repository. + /// + internal static string CannotFindHashInRepository { + get { + return ResourceManager.GetString("CannotFindHashInRepository", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Cannot find lsar executable.. + /// + internal static string CannotFindLsAr { + get { + return ResourceManager.GetString("CannotFindLsAr", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Cannot find unar executable at {0}.. + /// + internal static string CannotFindUnArAtPath { + get { + return ResourceManager.GetString("CannotFindUnArAtPath", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Cannot find requested zip entry in hashes dictionary. + /// + internal static string CannotFindZipEntryInDictionary { + get { + return ResourceManager.GetString("CannotFindZipEntryInDictionary", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Cannot run lsar.. + /// + internal static string CannotRunLsAr { + get { + return ResourceManager.GetString("CannotRunLsAr", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Cannot run unar.. + /// + internal static string CannotRunUnAr { + get { + return ResourceManager.GetString("CannotRunUnAr", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Checking if file is an archive.... + /// + internal static string CheckingIfFIleIsAnArchive { + get { + return ResourceManager.GetString("CheckingIfFIleIsAnArchive", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Compressing {0}.... + /// + internal static string Compressing { + get { + return ResourceManager.GetString("Compressing", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Compressing DAT file.... + /// + internal static string CompressingDatFile { + get { + return ResourceManager.GetString("CompressingDatFile", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Compressing file.... + /// + internal static string CompressingFile { + get { + return ResourceManager.GetString("CompressingFile", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Could not find ROM set in database.. + /// + internal static string CouldNotFindRomSetInDatabase { + get { + return ResourceManager.GetString("CouldNotFindRomSetInDatabase", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to File exists. + /// + internal static string DatabaseFileExistsMsgBoxTitle { + get { + return ResourceManager.GetString("DatabaseFileExistsMsgBoxTitle", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to DAT file is already in database, not importing duplicates.. + /// + internal static string DatAlreadyInDatabase { + get { + return ResourceManager.GetString("DatAlreadyInDatabase", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Enumerating files.... + /// + internal static string EnumeratingFiles { + get { + return ResourceManager.GetString("EnumeratingFiles", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Error: {0}. + /// + internal static string ErrorWithMessage { + get { + return ResourceManager.GetString("ErrorWithMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Exporting ROMs.... + /// + internal static string ExportingRoms { + get { + return ResourceManager.GetString("ExportingRoms", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Extracted contents. + /// + internal static string ExtractedContents { + get { + return ResourceManager.GetString("ExtractedContents", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Extracting archive contents.... + /// + internal static string ExtractingArchive { + get { + return ResourceManager.GetString("ExtractingArchive", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Finished. + /// + internal static string Finished { + get { + return ResourceManager.GetString("Finished", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Finishing.... + /// + internal static string Finishing { + get { + return ResourceManager.GetString("Finishing", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Found a ROM with an unknown machine, this should not happen.. + /// + internal static string FoundRomWithoutMachine { + get { + return ResourceManager.GetString("FoundRomWithoutMachine", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Getting machine (game) names.... + /// + internal static string GettingMachineNames { + get { + return ResourceManager.GetString("GettingMachineNames", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Hashing DAT file.... + /// + internal static string HashingDatFile { + get { + return ResourceManager.GetString("HashingDatFile", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Hashing file.... + /// + internal static string HashingFile { + get { + return ResourceManager.GetString("HashingFile", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Importing {0}.... + /// + internal static string Importing { + get { + return ResourceManager.GetString("Importing", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Not yet implemented.. + /// + internal static string Not_yet_implemented { + get { + return ResourceManager.GetString("Not_yet_implemented", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Not the correct lsar executable. + /// + internal static string NotCorrectLsAr { + get { + return ResourceManager.GetString("NotCorrectLsAr", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Not the correct unar executable. + /// + internal static string NotCorrectUnAr { + get { + return ResourceManager.GetString("NotCorrectUnAr", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to OK. + /// + internal static string OK { + get { + return ResourceManager.GetString("OK", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Parsing DAT file.... + /// + internal static string ParsinDatFile { + get { + return ResourceManager.GetString("ParsinDatFile", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Removing temporary path.... + /// + internal static string RemovingTemporaryPath { + get { + return ResourceManager.GetString("RemovingTemporaryPath", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Retrieving ROMs and disks.... + /// + internal static string RetrievingRomsAndDisks { + get { + return ResourceManager.GetString("RetrievingRomsAndDisks", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Retrieving ROM set from database.. + /// + internal static string RetrievingRomSetFromDatabase { + get { + return ResourceManager.GetString("RetrievingRomSetFromDatabase", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Saving changes to database.... + /// + internal static string SavingChangesToDatabase { + get { + return ResourceManager.GetString("SavingChangesToDatabase", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The input exceeds data types.. + /// + internal static string Spamsum_Input_exceeds_data { + get { + return ResourceManager.GetString("Spamsum_Input_exceeds_data", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to SpamSum does not have a binary representation.. + /// + internal static string Spamsum_no_binary { + get { + return ResourceManager.GetString("Spamsum_no_binary", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to unar path is not set.. + /// + internal static string UnArPathNotSet { + get { + return ResourceManager.GetString("UnArPathNotSet", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Unhandled exception occurred.. + /// + internal static string UnhandledException { + get { + return ResourceManager.GetString("UnhandledException", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Unhandled exception when importing file.. + /// + internal static string UnhandledExceptionWhenImporting { + get { + return ResourceManager.GetString("UnhandledExceptionWhenImporting", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Unknown file.. + /// + internal static string UnknownFile { + get { + return ResourceManager.GetString("UnknownFile", resourceCulture); + } + } + } +} diff --git a/RomRepoMgr.Core/Resources/Localization.resx b/RomRepoMgr.Core/Resources/Localization.resx new file mode 100644 index 0000000..8d2a2bd --- /dev/null +++ b/RomRepoMgr.Core/Resources/Localization.resx @@ -0,0 +1,163 @@ + + + + + + + + text/microsoft-resx + + + 1.3 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Specified string is not valid Base32 format because it doesn't have enough data to construct a complete byte array + + + Specified string is not valid Base32 format because character "{0}" does not exist in Base32 alphabet + + + Cannot seek before stream start. + + + Cannot seek after stream end. + + + SpamSum does not have a binary representation. + + + Assertion failed + + + The input exceeds data types. + + + Not yet implemented. + + + File exists + + + unar path is not set. + + + Cannot find unar executable at {0}. + + + Cannot find lsar executable. + + + Cannot run unar. + + + Cannot run lsar. + + + Not the correct unar executable + + + Not the correct lsar executable + + + Parsing DAT file... + + + Hashing DAT file... + + + DAT file is already in database, not importing duplicates. + + + Adding DAT to database... + + + Compressing DAT file... + + + Getting machine (game) names... + + + Adding machines (games)... + + + Saving changes to database... + + + Retrieving ROMs and disks... + + + Adding ROMs... + + + Found a ROM with an unknown machine, this should not happen. + + + Unhandled exception occurred. + + + Retrieving ROM set from database. + + + Could not find ROM set in database. + + + Exporting ROMs... + + + Finished + + + Cannot find requested zip entry in hashes dictionary + + + Cannot find file with hash {0} in the repository + + + Compressing {0}... + + + Enumerating files... + + + Importing {0}... + + + Checking if file is an archive... + + + OK + + + Error: {0} + + + Extracting archive contents... + + + Removing temporary path... + + + Extracted contents + + + Hashing file... + + + Unknown file. + + + Compressing file... + + + Finishing... + + + Unhandled exception when importing file. + + \ No newline at end of file diff --git a/RomRepoMgr.Core/RomRepoMgr.Core.csproj b/RomRepoMgr.Core/RomRepoMgr.Core.csproj index f43a718..cdd50c6 100644 --- a/RomRepoMgr.Core/RomRepoMgr.Core.csproj +++ b/RomRepoMgr.Core/RomRepoMgr.Core.csproj @@ -2,6 +2,7 @@ netcoreapp3.1 + en @@ -17,4 +18,19 @@ + + + ResXFileCodeGenerator + Localization.Designer.cs + + + + + + True + True + Language.resx + + + diff --git a/RomRepoMgr.Core/Workers/Compression.cs b/RomRepoMgr.Core/Workers/Compression.cs index e80ae89..04c7772 100644 --- a/RomRepoMgr.Core/Workers/Compression.cs +++ b/RomRepoMgr.Core/Workers/Compression.cs @@ -27,6 +27,7 @@ using System; using System.Diagnostics; using System.IO; using RomRepoMgr.Core.EventArgs; +using RomRepoMgr.Core.Resources; using SharpCompress.Compressors; using SharpCompress.Compressors.LZMA; using ErrorEventArgs = RomRepoMgr.Core.EventArgs.ErrorEventArgs; @@ -96,13 +97,13 @@ namespace RomRepoMgr.Core.Workers inFs.Close(); } - public bool CheckUnar(string unArPath) + public bool CheckUnAr(string unArPath) { if(string.IsNullOrWhiteSpace(unArPath)) { FailedWithText?.Invoke(this, new ErrorEventArgs { - Message = "unar path is not set." + Message = Localization.UnArPathNotSet }); return false; @@ -119,7 +120,7 @@ namespace RomRepoMgr.Core.Workers { FailedWithText?.Invoke(this, new ErrorEventArgs { - Message = $"Cannot find unar executable at {unarPath}." + Message = string.Format(Localization.CannotFindUnArAtPath, unarPath) }); return false; @@ -129,7 +130,7 @@ namespace RomRepoMgr.Core.Workers { FailedWithText?.Invoke(this, new ErrorEventArgs { - Message = "Cannot find lsar executable." + Message = Localization.CannotFindLsAr }); return false; @@ -158,7 +159,7 @@ namespace RomRepoMgr.Core.Workers { FailedWithText?.Invoke(this, new ErrorEventArgs { - Message = "Cannot run unar." + Message = Localization.CannotRunUnAr }); return false; @@ -185,7 +186,7 @@ namespace RomRepoMgr.Core.Workers { FailedWithText?.Invoke(this, new ErrorEventArgs { - Message = "Cannot run lsar." + Message = Localization.CannotRunLsAr }); return false; @@ -195,7 +196,7 @@ namespace RomRepoMgr.Core.Workers { FailedWithText?.Invoke(this, new ErrorEventArgs { - Message = "Not the correct unar executable" + Message = Localization.NotCorrectUnAr }); return false; @@ -205,7 +206,7 @@ namespace RomRepoMgr.Core.Workers { FailedWithText?.Invoke(this, new ErrorEventArgs { - Message = "Not the correct lsar executable" + Message = Localization.NotCorrectLsAr }); return false; diff --git a/RomRepoMgr.Core/Workers/DatImporter.cs b/RomRepoMgr.Core/Workers/DatImporter.cs index 50be15e..dc0af32 100644 --- a/RomRepoMgr.Core/Workers/DatImporter.cs +++ b/RomRepoMgr.Core/Workers/DatImporter.cs @@ -31,6 +31,7 @@ using System.Linq; using Aaru.Checksums; using RomRepoMgr.Core.EventArgs; using RomRepoMgr.Core.Models; +using RomRepoMgr.Core.Resources; using RomRepoMgr.Database; using RomRepoMgr.Database.Models; using SabreTools.Library.DatFiles; @@ -60,14 +61,14 @@ namespace RomRepoMgr.Core.Workers SetMessage?.Invoke(this, new MessageEventArgs { - Message = "Parsing DAT file..." + Message = Localization.ParsinDatFile }); var datFile = DatFile.CreateAndParse(_datPath); SetMessage?.Invoke(this, new MessageEventArgs { - Message = "Hashing DAT file..." + Message = Localization.HashingDatFile }); string datHash = Sha384Context.File(_datPath, out byte[] datHashBinary); @@ -83,7 +84,7 @@ namespace RomRepoMgr.Core.Workers { ErrorOccurred?.Invoke(this, new ErrorEventArgs { - Message = "DAT file is already in database, not importing duplicates." + Message = Localization.DatAlreadyInDatabase }); return; @@ -91,7 +92,7 @@ namespace RomRepoMgr.Core.Workers SetMessage?.Invoke(this, new MessageEventArgs { - Message = "Adding DAT to database..." + Message = Localization.AddingDatToDatabase }); // TODO: Check if there is a hash in database but not in repo @@ -116,7 +117,7 @@ namespace RomRepoMgr.Core.Workers SetMessage?.Invoke(this, new MessageEventArgs { - Message = "Compressing DAT file..." + Message = Localization.CompressingDatFile }); var datCompress = new Compression(); @@ -126,7 +127,7 @@ namespace RomRepoMgr.Core.Workers SetMessage?.Invoke(this, new MessageEventArgs { - Message = "Getting machine (game) names..." + Message = Localization.GettingMachineNames }); List machineNames = @@ -135,7 +136,7 @@ namespace RomRepoMgr.Core.Workers SetMessage?.Invoke(this, new MessageEventArgs { - Message = "Adding machines (games)..." + Message = Localization.AddingMachines }); SetProgressBounds?.Invoke(this, new ProgressBoundsEventArgs @@ -170,7 +171,7 @@ namespace RomRepoMgr.Core.Workers SetMessage?.Invoke(this, new MessageEventArgs { - Message = "Saving changes to database..." + Message = Localization.SavingChangesToDatabase }); SetIndeterminateProgress?.Invoke(this, System.EventArgs.Empty); @@ -179,7 +180,7 @@ namespace RomRepoMgr.Core.Workers SetMessage?.Invoke(this, new MessageEventArgs { - Message = "Retrieving ROMs and disks..." + Message = Localization.RetrievingRomsAndDisks }); List roms = new List(); @@ -211,7 +212,7 @@ namespace RomRepoMgr.Core.Workers SetMessage?.Invoke(this, new MessageEventArgs { - Message = "Adding ROMs..." + Message = Localization.AddingRoms }); position = 0; @@ -237,7 +238,7 @@ namespace RomRepoMgr.Core.Workers { ErrorOccurred?.Invoke(this, new ErrorEventArgs { - Message = "Found a ROM with an unknown machine, this should not happen." + Message = Localization.FoundRomWithoutMachine }); return; @@ -437,7 +438,7 @@ namespace RomRepoMgr.Core.Workers SetMessage?.Invoke(this, new MessageEventArgs { - Message = "Saving changes to database..." + Message = Localization.SavingChangesToDatabase }); SetIndeterminateProgress?.Invoke(this, System.EventArgs.Empty); @@ -490,7 +491,7 @@ namespace RomRepoMgr.Core.Workers ErrorOccurred?.Invoke(this, new ErrorEventArgs { - Message = "Unhandled exception occurred." + Message = Localization.UnhandledException }); } } diff --git a/RomRepoMgr.Core/Workers/FileExporter.cs b/RomRepoMgr.Core/Workers/FileExporter.cs index 9769a4d..68e8bcc 100644 --- a/RomRepoMgr.Core/Workers/FileExporter.cs +++ b/RomRepoMgr.Core/Workers/FileExporter.cs @@ -7,6 +7,7 @@ using System.Threading.Tasks; using Ionic.Zip; using Ionic.Zlib; using RomRepoMgr.Core.EventArgs; +using RomRepoMgr.Core.Resources; using RomRepoMgr.Database; using RomRepoMgr.Database.Models; using SharpCompress.Compressors.LZMA; @@ -45,7 +46,7 @@ namespace RomRepoMgr.Core.Workers { SetMessage?.Invoke(this, new MessageEventArgs { - Message = "Retrieving ROM set from database." + Message = Localization.RetrievingRomSetFromDatabase }); RomSet romSet = Context.Singleton.RomSets.Find(_romSetId); @@ -54,7 +55,7 @@ namespace RomRepoMgr.Core.Workers { SetMessage?.Invoke(this, new MessageEventArgs { - Message = "Could not ROM set in database." + Message = Localization.CouldNotFindRomSetInDatabase }); WorkFinished?.Invoke(this, System.EventArgs.Empty); @@ -64,7 +65,7 @@ namespace RomRepoMgr.Core.Workers SetMessage?.Invoke(this, new MessageEventArgs { - Message = "Exporting ROMs..." + Message = Localization.ExportingRoms }); _machines = Context.Singleton.Machines.Where(m => m.RomSet.Id == _romSetId).ToArray(); @@ -90,7 +91,7 @@ namespace RomRepoMgr.Core.Workers { SetMessage?.Invoke(this, new MessageEventArgs { - Message = "Finished!" + Message = Localization.Finished }); WorkFinished?.Invoke(this, System.EventArgs.Empty); @@ -172,7 +173,7 @@ namespace RomRepoMgr.Core.Workers { if(!_filesByMachine.TryGetValue(entryName, out FileByMachine fileByMachine)) if(!_filesByMachine.TryGetValue(entryName.Replace('/', '\\'), out fileByMachine)) - throw new ArgumentException("Cannot find requested zip entry in hashes dictionary"); + throw new ArgumentException(Localization.CannotFindZipEntryInDictionary); DbFile file = fileByMachine.File; @@ -213,7 +214,7 @@ namespace RomRepoMgr.Core.Workers sha384B32[4].ToString(), sha384B32 + ".lz"); if(!File.Exists(repoPath)) - throw new ArgumentException($"Cannot find file with hash {file.Sha256} in the repository"); + throw new ArgumentException(string.Format(Localization.CannotFindHashInRepository, file.Sha256)); var inFs = new FileStream(repoPath, FileMode.Open, FileAccess.Read); @@ -237,13 +238,13 @@ namespace RomRepoMgr.Core.Workers if(!_filesByMachine.TryGetValue(e.CurrentEntry.FileName, out FileByMachine fileByMachine)) if(!_filesByMachine.TryGetValue(e.CurrentEntry.FileName.Replace('/', '\\'), out fileByMachine)) - throw new ArgumentException("Cannot find requested zip entry in hashes dictionary"); + throw new ArgumentException(Localization.CannotFindZipEntryInDictionary); DbFile currentFile = fileByMachine.File; SetMessage3?.Invoke(this, new MessageEventArgs { - Message = string.Format("Compressing {0}...", e.CurrentEntry.FileName) + Message = string.Format(Localization.Compressing, e.CurrentEntry.FileName) }); SetProgress3Bounds?.Invoke(this, new ProgressBoundsEventArgs diff --git a/RomRepoMgr.Core/Workers/FileImporter.cs b/RomRepoMgr.Core/Workers/FileImporter.cs index fb78636..8c48cb5 100644 --- a/RomRepoMgr.Core/Workers/FileImporter.cs +++ b/RomRepoMgr.Core/Workers/FileImporter.cs @@ -7,6 +7,7 @@ using Newtonsoft.Json; using RomRepoMgr.Core.Aaru; using RomRepoMgr.Core.EventArgs; using RomRepoMgr.Core.Models; +using RomRepoMgr.Core.Resources; using RomRepoMgr.Database; using RomRepoMgr.Database.Models; using SharpCompress.Compressors; @@ -53,7 +54,7 @@ namespace RomRepoMgr.Core.Workers SetMessage?.Invoke(this, new MessageEventArgs { - Message = "Enumerating files..." + Message = Localization.EnumeratingFiles }); string[] files = Directory.GetFiles(path, "*", SearchOption.AllDirectories); @@ -76,7 +77,7 @@ namespace RomRepoMgr.Core.Workers SetMessage?.Invoke(this, new MessageEventArgs { - Message = string.Format("Importing {0}...", Path.GetFileName(file)) + Message = string.Format(Localization.Importing, Path.GetFileName(file)) }); string archiveFormat = null; @@ -88,7 +89,7 @@ namespace RomRepoMgr.Core.Workers SetMessage2?.Invoke(this, new MessageEventArgs { - Message = "Checking if file is an archive..." + Message = Localization.CheckingIfFIleIsAnArchive }); archiveFormat = GetArchiveFormat(file, out archiveFiles); @@ -110,7 +111,7 @@ namespace RomRepoMgr.Core.Workers Item = new ImportRomItem { Filename = Path.GetFileName(file), - Status = "OK" + Status = Localization.OK } }); } @@ -121,7 +122,7 @@ namespace RomRepoMgr.Core.Workers Item = new ImportRomItem { Filename = Path.GetFileName(file), - Status = string.Format("Error: {0}", _lastMessage) + Status = string.Format(Localization.ErrorWithMessage, _lastMessage) } }); } @@ -144,7 +145,7 @@ namespace RomRepoMgr.Core.Workers SetMessage?.Invoke(this, new MessageEventArgs { - Message = "Extracting archive contents..." + Message = Localization.ExtractingArchive }); ExtractArchive(file, tmpFolder); @@ -155,7 +156,7 @@ namespace RomRepoMgr.Core.Workers SetMessage2?.Invoke(this, new MessageEventArgs { - Message = "Removing temporary path..." + Message = Localization.RemovingTemporaryPath }); Directory.Delete(tmpFolder, true); @@ -165,7 +166,7 @@ namespace RomRepoMgr.Core.Workers Item = new ImportRomItem { Filename = Path.GetFileName(file), - Status = "Extracted contents" + Status = Localization.ExtractedContents } }); } @@ -179,7 +180,7 @@ namespace RomRepoMgr.Core.Workers Item = new ImportRomItem { Filename = Path.GetFileName(file), - Status = "Unhandled exception occured" + Status = Localization.UnhandledException } }); } @@ -209,7 +210,7 @@ namespace RomRepoMgr.Core.Workers SetMessage2?.Invoke(this, new MessageEventArgs { - Message = "Hashing file..." + Message = Localization.HashingFile }); var checksumWorker = new Checksum(); @@ -279,7 +280,7 @@ namespace RomRepoMgr.Core.Workers { if(_onlyKnown) { - _lastMessage = "Unknown file."; + _lastMessage = Localization.UnknownFile; return false; } @@ -407,7 +408,7 @@ namespace RomRepoMgr.Core.Workers SetMessage2?.Invoke(this, new MessageEventArgs { - Message = "Compressing file..." + Message = Localization.CompressingFile }); byte[] buffer = new byte[BUFFER_SIZE]; @@ -437,7 +438,7 @@ namespace RomRepoMgr.Core.Workers SetMessage2?.Invoke(this, new MessageEventArgs { - Message = "Finishing..." + Message = Localization.Finishing }); inFs.Close(); @@ -457,7 +458,7 @@ namespace RomRepoMgr.Core.Workers } catch(Exception e) { - _lastMessage = "Unhandled exception when importing file."; + _lastMessage = Localization.UnhandledExceptionWhenImporting; return false; } @@ -469,7 +470,7 @@ namespace RomRepoMgr.Core.Workers SetMessage2?.Invoke(this, new MessageEventArgs { - Message = "Saving changes to database..." + Message = Localization.SavingChangesToDatabase }); Context.Singleton.SaveChanges(); @@ -486,9 +487,9 @@ namespace RomRepoMgr.Core.Workers { string unarFolder = Path.GetDirectoryName(Settings.Settings.Current.UnArchiverPath); string extension = Path.GetExtension(Settings.Settings.Current.UnArchiverPath); - string unarfilename = Path.GetFileNameWithoutExtension(Settings.Settings.Current.UnArchiverPath); - string lsarfilename = unarfilename?.Replace("unar", "lsar"); - string lsarPath = Path.Combine(unarFolder, lsarfilename + extension); + string unarFilename = Path.GetFileNameWithoutExtension(Settings.Settings.Current.UnArchiverPath); + string lsarFilename = unarFilename?.Replace("unar", "lsar"); + string lsarPath = Path.Combine(unarFolder, lsarFilename + extension); var lsarProcess = new Process { diff --git a/RomRepoMgr.Database/Context.cs b/RomRepoMgr.Database/Context.cs index 010511e..b8f05c2 100644 --- a/RomRepoMgr.Database/Context.cs +++ b/RomRepoMgr.Database/Context.cs @@ -27,6 +27,7 @@ using System; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.Logging; using RomRepoMgr.Database.Models; +using RomRepoMgr.Database.Resources; namespace RomRepoMgr.Database { @@ -45,7 +46,7 @@ namespace RomRepoMgr.Database if(Settings.Settings.Current?.DatabasePath is null) throw new ArgumentNullException(nameof(Settings.Settings.Current.DatabasePath), - "Settings are not initialized!"); + Localization.Settings_not_initialized); _singleton = Create(Settings.Settings.Current.DatabasePath); diff --git a/RomRepoMgr.Database/Resources/Localization.Designer.cs b/RomRepoMgr.Database/Resources/Localization.Designer.cs new file mode 100644 index 0000000..64b1ec2 --- /dev/null +++ b/RomRepoMgr.Database/Resources/Localization.Designer.cs @@ -0,0 +1,54 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace RomRepoMgr.Database.Resources { + using System; + + + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + [System.Diagnostics.DebuggerNonUserCodeAttribute()] + [System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Localization { + + private static System.Resources.ResourceManager resourceMan; + + private static System.Globalization.CultureInfo resourceCulture; + + [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Localization() { + } + + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)] + internal static System.Resources.ResourceManager ResourceManager { + get { + if (object.Equals(null, resourceMan)) { + System.Resources.ResourceManager temp = new System.Resources.ResourceManager("RomRepoMgr.Database.Resources.Localization", typeof(Localization).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)] + internal static System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + + internal static string Settings_not_initialized { + get { + return ResourceManager.GetString("Settings_not_initialized", resourceCulture); + } + } + } +} diff --git a/RomRepoMgr.Database/Resources/Localization.resx b/RomRepoMgr.Database/Resources/Localization.resx new file mode 100644 index 0000000..569eb36 --- /dev/null +++ b/RomRepoMgr.Database/Resources/Localization.resx @@ -0,0 +1,22 @@ + + + + + + + + text/microsoft-resx + + + 1.3 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Settings are not initialized! + + \ No newline at end of file diff --git a/RomRepoMgr.Database/RomRepoMgr.Database.csproj b/RomRepoMgr.Database/RomRepoMgr.Database.csproj index 2dfc0e2..af30eb3 100644 --- a/RomRepoMgr.Database/RomRepoMgr.Database.csproj +++ b/RomRepoMgr.Database/RomRepoMgr.Database.csproj @@ -23,4 +23,19 @@ + + + ResXFileCodeGenerator + Localization.Designer.cs + + + + + + True + True + Language.resx + + + diff --git a/RomRepoMgr.Settings/Interop/DetectOS.cs b/RomRepoMgr.Settings/Interop/DetectOS.cs index 3a23b56..93aa7b1 100644 --- a/RomRepoMgr.Settings/Interop/DetectOS.cs +++ b/RomRepoMgr.Settings/Interop/DetectOS.cs @@ -41,6 +41,7 @@ using System.Diagnostics; using System.IO; using System.Runtime.InteropServices; using System.Security.Principal; +using RomRepoMgr.Settings.Resources; namespace Aaru.CommonTypes.Interop { @@ -119,7 +120,7 @@ namespace Aaru.CommonTypes.Interop int error = uname(out utsname unixname); if(error != 0) - throw new Exception($"Unhandled exception calling uname: {Marshal.GetLastWin32Error()}"); + throw new Exception(string.Format(Localization.Unhandled_exception_uname, Marshal.GetLastWin32Error())); switch(unixname.sysname) { @@ -142,7 +143,8 @@ namespace Aaru.CommonTypes.Interop { Marshal.FreeHGlobal(pLen); - throw new Exception($"Unhandled exception calling uname: {Marshal.GetLastWin32Error()}"); + throw new Exception(string.Format(Localization.Unhandled_exception_uname, + Marshal.GetLastWin32Error())); } int length = Marshal.ReadInt32(pLen); @@ -154,7 +156,8 @@ namespace Aaru.CommonTypes.Interop Marshal.FreeHGlobal(pStr); Marshal.FreeHGlobal(pLen); - throw new Exception($"Unhandled exception calling uname: {Marshal.GetLastWin32Error()}"); + throw new Exception(string.Format(Localization.Unhandled_exception_uname, + Marshal.GetLastWin32Error())); } string machine = Marshal.PtrToStringAnsi(pStr); diff --git a/RomRepoMgr.Settings/Resources/Localization.Designer.cs b/RomRepoMgr.Settings/Resources/Localization.Designer.cs new file mode 100644 index 0000000..a050660 --- /dev/null +++ b/RomRepoMgr.Settings/Resources/Localization.Designer.cs @@ -0,0 +1,54 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace RomRepoMgr.Settings.Resources { + using System; + + + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + [System.Diagnostics.DebuggerNonUserCodeAttribute()] + [System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Localization { + + private static System.Resources.ResourceManager resourceMan; + + private static System.Globalization.CultureInfo resourceCulture; + + [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Localization() { + } + + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)] + internal static System.Resources.ResourceManager ResourceManager { + get { + if (object.Equals(null, resourceMan)) { + System.Resources.ResourceManager temp = new System.Resources.ResourceManager("RomRepoMgr.Settings.Resources.Localization", typeof(Localization).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)] + internal static System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + + internal static string Unhandled_exception_uname { + get { + return ResourceManager.GetString("Unhandled_exception_uname", resourceCulture); + } + } + } +} diff --git a/RomRepoMgr.Settings/Resources/Localization.resx b/RomRepoMgr.Settings/Resources/Localization.resx new file mode 100644 index 0000000..41339ec --- /dev/null +++ b/RomRepoMgr.Settings/Resources/Localization.resx @@ -0,0 +1,22 @@ + + + + + + + + text/microsoft-resx + + + 1.3 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Unhandled exception calling uname: {0} + + \ No newline at end of file diff --git a/RomRepoMgr.Settings/RomRepoMgr.Settings.csproj b/RomRepoMgr.Settings/RomRepoMgr.Settings.csproj index 3d40b44..a9aab5f 100644 --- a/RomRepoMgr.Settings/RomRepoMgr.Settings.csproj +++ b/RomRepoMgr.Settings/RomRepoMgr.Settings.csproj @@ -9,4 +9,19 @@ + + + ResXFileCodeGenerator + Localization.Designer.cs + + + + + + True + True + Localization.resx + + + diff --git a/RomRepoMgr.sln.DotSettings b/RomRepoMgr.sln.DotSettings index 7f43ebe..5b6eab1 100644 --- a/RomRepoMgr.sln.DotSettings +++ b/RomRepoMgr.sln.DotSettings @@ -1,5 +1,10 @@  True + True + True + True True + True True - True \ No newline at end of file + True + True \ No newline at end of file diff --git a/RomRepoMgr/Resources/Localization.Designer.cs b/RomRepoMgr/Resources/Localization.Designer.cs new file mode 100644 index 0000000..177c79b --- /dev/null +++ b/RomRepoMgr/Resources/Localization.Designer.cs @@ -0,0 +1,1047 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace RomRepoMgr.Resources { + using System; + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Localization { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Localization() { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("RomRepoMgr.Resources.Localization", typeof(Localization).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + + /// + /// Looks up a localized string similar to About. + /// + internal static string AboutLabel { + get { + return ResourceManager.GetString("AboutLabel", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to About ROM Repository Manager. + /// + internal static string AboutTitle { + get { + return ResourceManager.GetString("AboutTitle", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to All files. + /// + internal static string AllFilesDialogLabel { + get { + return ResourceManager.GetString("AllFilesDialogLabel", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Check all files.. + /// + internal static string AllFilesLabel { + get { + return ResourceManager.GetString("AllFilesLabel", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Library. + /// + internal static string AssembliesLibraryText { + get { + return ResourceManager.GetString("AssembliesLibraryText", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Version. + /// + internal static string AssembliesVersionText { + get { + return ResourceManager.GetString("AssembliesVersionText", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Authors. + /// + internal static string AuthorsLabel { + get { + return ResourceManager.GetString("AuthorsLabel", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Developers: + /// Natalia Portillo + ///. + /// + internal static string AuthorsText { + get { + return ResourceManager.GetString("AuthorsText", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Cancel. + /// + internal static string CancelLabel { + get { + return ResourceManager.GetString("CancelLabel", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Checking The Unarchiver.... + /// + internal static string CheckingUnArText { + get { + return ResourceManager.GetString("CheckingUnArText", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Choose database to open / create. + /// + internal static string ChooseDatabaseFile { + get { + return ResourceManager.GetString("ChooseDatabaseFile", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Choose.... + /// + internal static string ChooseLabel { + get { + return ResourceManager.GetString("ChooseLabel", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Choose repository folder. + /// + internal static string ChooseRepositoryFolder { + get { + return ResourceManager.GetString("ChooseRepositoryFolder", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Choose temporary folder. + /// + internal static string ChooseTemporaryFolder { + get { + return ResourceManager.GetString("ChooseTemporaryFolder", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Choose UnArchiver executable. + /// + internal static string ChooseUnArExecutable { + get { + return ResourceManager.GetString("ChooseUnArExecutable", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Close. + /// + internal static string CloseLabel { + get { + return ResourceManager.GetString("CloseLabel", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Complete games. + /// + internal static string CompleteMachinesLabel { + get { + return ResourceManager.GetString("CompleteMachinesLabel", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to An error occurred trying to delete the chosen.. + /// + internal static string DatabaseFileCannotDeleteCaption { + get { + return ResourceManager.GetString("DatabaseFileCannotDeleteCaption", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Could not delete file. + /// + internal static string DatabaseFileCannotDeleteTitle { + get { + return ResourceManager.GetString("DatabaseFileCannotDeleteTitle", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Do you want to delete the file?. + /// + internal static string DatabaseFileDeleteCaption { + get { + return ResourceManager.GetString("DatabaseFileDeleteCaption", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to File exists. + /// + internal static string DatabaseFileExistsMsgBoxTitle { + get { + return ResourceManager.GetString("DatabaseFileExistsMsgBoxTitle", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Database file. + /// + internal static string DatabaseFileLabel { + get { + return ResourceManager.GetString("DatabaseFileLabel", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Do you want to try to open the existing file as a database?. + /// + internal static string DatabaseFileMsgBoxTryOpen { + get { + return ResourceManager.GetString("DatabaseFileMsgBoxTryOpen", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Do you want to try to open the existing file as a database?. + /// + internal static string DatabaseFileTryOpenCaption { + get { + return ResourceManager.GetString("DatabaseFileTryOpenCaption", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to An error occurred trying to use the chosen file as a database. + ///Do you want to delete the file?. + /// + internal static string DatabaseFileUnusableDeleteMsgBoxCaption { + get { + return ResourceManager.GetString("DatabaseFileUnusableDeleteMsgBoxCaption", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to An error occurred trying to use the chosen file as a database.. + /// + internal static string DatabaseFileUnusableMsgBoxCaption { + get { + return ResourceManager.GetString("DatabaseFileUnusableMsgBoxCaption", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Could not use database. + /// + internal static string DatabaseFileUnusableMsgBoxTitle { + get { + return ResourceManager.GetString("DatabaseFileUnusableMsgBoxTitle", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to DAT files. + /// + internal static string DatFilesDialogLabel { + get { + return ResourceManager.GetString("DatFilesDialogLabel", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Decompressing DAT file.... + /// + internal static string DecompressingDat { + get { + return ResourceManager.GetString("DecompressingDat", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Are you sure you want to delete the ROM set {0}?. + /// + internal static string DeleteRomSetMsgBoxCaption { + get { + return ResourceManager.GetString("DeleteRomSetMsgBoxCaption", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Delete ROM set. + /// + internal static string DeleteRomSetMsgBoxTitle { + get { + return ResourceManager.GetString("DeleteRomSetMsgBoxTitle", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Edit DAT. + /// + internal static string EditDatTitle { + get { + return ResourceManager.GetString("EditDatTitle", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Error. + /// + internal static string Error { + get { + return ResourceManager.GetString("Error", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Exit. + /// + internal static string ExitButtonText { + get { + return ResourceManager.GetString("ExitButtonText", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Exporting DAT file.... + /// + internal static string ExportDatTitle { + get { + return ResourceManager.GetString("ExportDatTitle", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Export ROMs to folder.... + /// + internal static string ExportRomsDialogTitle { + get { + return ResourceManager.GetString("ExportRomsDialogTitle", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Exporting ROM files to folder.... + /// + internal static string ExportRomsTitle { + get { + return ResourceManager.GetString("ExportRomsTitle", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to E_xit. + /// + internal static string FileMenuExitText { + get { + return ResourceManager.GetString("FileMenuExitText", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Import DAT _file. + /// + internal static string FileMenuImportDatFileText { + get { + return ResourceManager.GetString("FileMenuImportDatFileText", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Import DAT f_older. + /// + internal static string FileMenuImportDatFolderText { + get { + return ResourceManager.GetString("FileMenuImportDatFolderText", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to _Settings. + /// + internal static string FileMenuSettingsText { + get { + return ResourceManager.GetString("FileMenuSettingsText", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to _File. + /// + internal static string FileMenuText { + get { + return ResourceManager.GetString("FileMenuText", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to _Mount. + /// + internal static string FilesystemMenuMountText { + get { + return ResourceManager.GetString("FilesystemMenuMountText", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to File_system. + /// + internal static string FilesystemMenuText { + get { + return ResourceManager.GetString("FilesystemMenuText", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Finished. + /// + internal static string Finished { + get { + return ResourceManager.GetString("Finished", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Found {0} files.... + /// + internal static string FoundFiles { + get { + return ResourceManager.GetString("FoundFiles", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Have ROMs. + /// + internal static string HaveRomsLabel { + get { + return ResourceManager.GetString("HaveRomsLabel", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to _About. + /// + internal static string HelpMenuAboutText { + get { + return ResourceManager.GetString("HelpMenuAboutText", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to _Help. + /// + internal static string HelpMenuText { + get { + return ResourceManager.GetString("HelpMenuText", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Homepage. + /// + internal static string HomepageLabel { + get { + return ResourceManager.GetString("HomepageLabel", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Import DAT file.... + /// + internal static string ImportDatFileDialogTitle { + get { + return ResourceManager.GetString("ImportDatFileDialogTitle", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Import DATs from folder.... + /// + internal static string ImportDatFolderDialogTitle { + get { + return ResourceManager.GetString("ImportDatFolderDialogTitle", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Import DAT files from folder.... + /// + internal static string ImportDatFolderTitle { + get { + return ResourceManager.GetString("ImportDatFolderTitle", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Importing DAT file.... + /// + internal static string ImportDatTitle { + get { + return ResourceManager.GetString("ImportDatTitle", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Importing {0}.... + /// + internal static string ImportingItem { + get { + return ResourceManager.GetString("ImportingItem", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Import ROM files from folder.... + /// + internal static string ImportRomFolderTitle { + get { + return ResourceManager.GetString("ImportRomFolderTitle", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Import ROMs from folder.... + /// + internal static string ImportRomsFolderDialogTitle { + get { + return ResourceManager.GetString("ImportRomsFolderDialogTitle", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Incomplete games. + /// + internal static string IncompleteMachinesLabel { + get { + return ResourceManager.GetString("IncompleteMachinesLabel", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Only import known files.. + /// + internal static string KnownOnlyLabel { + get { + return ResourceManager.GetString("KnownOnlyLabel", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Libraries. + /// + internal static string LibrariesLabel { + get { + return ResourceManager.GetString("LibrariesLabel", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to License: GNU General Public License Version 3. + /// + internal static string LicenseLabel { + get { + return ResourceManager.GetString("LicenseLabel", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Loading database.... + /// + internal static string LoadingDatabaseText { + get { + return ResourceManager.GetString("LoadingDatabaseText", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Loading ROM sets.... + /// + internal static string LoadingRomSetsText { + get { + return ResourceManager.GetString("LoadingRomSetsText", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Loading settings.... + /// + internal static string LoadingSettingsText { + get { + return ResourceManager.GetString("LoadingSettingsText", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Migrating database.... + /// + internal static string MigratingDatabaseText { + get { + return ResourceManager.GetString("MigratingDatabaseText", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Missing ROMs. + /// + internal static string MissRomsLabel { + get { + return ResourceManager.GetString("MissRomsLabel", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to OK. + /// + internal static string OK { + get { + return ResourceManager.GetString("OK", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Path:. + /// + internal static string PathLabel { + get { + return ResourceManager.GetString("PathLabel", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Try to detect archives and import their contents.. + /// + internal static string RecurseArchivesLabel { + get { + return ResourceManager.GetString("RecurseArchivesLabel", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Recurse subfolders.. + /// + internal static string RecursiveLabel { + get { + return ResourceManager.GetString("RecursiveLabel", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Removing ROM set.... + /// + internal static string RemoveDatTitle { + get { + return ResourceManager.GetString("RemoveDatTitle", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Remove files after import successful.. + /// + internal static string RemoveFilesLabel { + get { + return ResourceManager.GetString("RemoveFilesLabel", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Removing DAT file from repo.... + /// + internal static string RemovingDatFileFromRepo { + get { + return ResourceManager.GetString("RemovingDatFileFromRepo", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Removing ROM set from database.... + /// + internal static string RemovingRomSetFromDatabase { + get { + return ResourceManager.GetString("RemovingRomSetFromDatabase", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Repository folder. + /// + internal static string RepositoryFolderLabel { + get { + return ResourceManager.GetString("RepositoryFolderLabel", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Filename. + /// + internal static string ResultFilenameLabel { + get { + return ResourceManager.GetString("ResultFilenameLabel", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Status. + /// + internal static string ResultStatusLabel { + get { + return ResourceManager.GetString("ResultStatusLabel", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Retrieving ROM set from database.... + /// + internal static string RetrievingRomSetFromDatabase { + get { + return ResourceManager.GetString("RetrievingRomSetFromDatabase", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Author. + /// + internal static string RomSetAuthorLabel { + get { + return ResourceManager.GetString("RomSetAuthorLabel", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Comment. + /// + internal static string RomSetCommentLabel { + get { + return ResourceManager.GetString("RomSetCommentLabel", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Complete. + /// + internal static string RomSetCompleteMachinesLabel { + get { + return ResourceManager.GetString("RomSetCompleteMachinesLabel", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Date. + /// + internal static string RomSetDateLabel { + get { + return ResourceManager.GetString("RomSetDateLabel", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Description. + /// + internal static string RomSetDescriptionLabel { + get { + return ResourceManager.GetString("RomSetDescriptionLabel", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Have. + /// + internal static string RomSetHaveRomsLabel { + get { + return ResourceManager.GetString("RomSetHaveRomsLabel", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Incomplete. + /// + internal static string RomSetIncompleteMachinesLabel { + get { + return ResourceManager.GetString("RomSetIncompleteMachinesLabel", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Miss. + /// + internal static string RomSetMissRomsLabel { + get { + return ResourceManager.GetString("RomSetMissRomsLabel", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Name. + /// + internal static string RomSetNameLabel { + get { + return ResourceManager.GetString("RomSetNameLabel", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to ROM sets. + /// + internal static string RomSets { + get { + return ResourceManager.GetString("RomSets", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to _Delete. + /// + internal static string RomSetsMenuDeleteText { + get { + return ResourceManager.GetString("RomSetsMenuDeleteText", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to _Edit. + /// + internal static string RomSetsMenuEditText { + get { + return ResourceManager.GetString("RomSetsMenuEditText", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Save DAT _file. + /// + internal static string RomSetsMenuSaveDatText { + get { + return ResourceManager.GetString("RomSetsMenuSaveDatText", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to _Save ROMs to folder. + /// + internal static string RomSetsMenuSaveRomsText { + get { + return ResourceManager.GetString("RomSetsMenuSaveRomsText", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to ROM _sets. + /// + internal static string RomSetsMenuText { + get { + return ResourceManager.GetString("RomSetsMenuText", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Games. + /// + internal static string RomSetTotalMachinesLabel { + get { + return ResourceManager.GetString("RomSetTotalMachinesLabel", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to ROMs. + /// + internal static string RomSetTotalRomsLabel { + get { + return ResourceManager.GetString("RomSetTotalRomsLabel", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Version. + /// + internal static string RomSetVersionLabel { + get { + return ResourceManager.GetString("RomSetVersionLabel", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to _Import folder. + /// + internal static string RomsMenuImportText { + get { + return ResourceManager.GetString("RomsMenuImportText", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to _ROMs. + /// + internal static string RomsMenuText { + get { + return ResourceManager.GetString("RomsMenuText", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Save. + /// + internal static string SaveLabel { + get { + return ResourceManager.GetString("SaveLabel", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Saving changes to database.... + /// + internal static string SavingChangesToDatabase { + get { + return ResourceManager.GetString("SavingChangesToDatabase", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Searching for files.... + /// + internal static string SearchingForFiles { + get { + return ResourceManager.GetString("SearchingForFiles", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Select mount point.... + /// + internal static string SelectMountPointDialogTitle { + get { + return ResourceManager.GetString("SelectMountPointDialogTitle", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Settings. + /// + internal static string SettingsTitle { + get { + return ResourceManager.GetString("SettingsTitle", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Start. + /// + internal static string StartLabel { + get { + return ResourceManager.GetString("StartLabel", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Temporary folder. + /// + internal static string TemporaryFolderLabel { + get { + return ResourceManager.GetString("TemporaryFolderLabel", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The Unarchiver version {0}. + /// + internal static string TheUnarchiverVersionLabel { + get { + return ResourceManager.GetString("TheUnarchiverVersionLabel", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Total games. + /// + internal static string TotalMachinesLabel { + get { + return ResourceManager.GetString("TotalMachinesLabel", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Total ROMs. + /// + internal static string TotalRomsLabel { + get { + return ResourceManager.GetString("TotalRomsLabel", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Path to UnAr. + /// + internal static string UnArPathLabel { + get { + return ResourceManager.GetString("UnArPathLabel", resourceCulture); + } + } + } +} diff --git a/RomRepoMgr/Resources/Localization.resx b/RomRepoMgr/Resources/Localization.resx new file mode 100644 index 0000000..7811284 --- /dev/null +++ b/RomRepoMgr/Resources/Localization.resx @@ -0,0 +1,349 @@ + + + + + + + + text/microsoft-resx + + + 1.3 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + _File + + + ROM sets + + + Name + + + Version + + + Author + + + Date + + + Description + + + Comment + + + Games + + + Complete + + + Incomplete + + + ROMs + + + Have + + + Miss + + + Import DAT _file + + + Import DAT f_older + + + _Settings + + + E_xit + + + File_system + + + _Mount + + + _ROMs + + + _Import folder + + + ROM _sets + + + _Save ROMs to folder + + + Save DAT _file + + + _Edit + + + _Delete + + + _Help + + + _About + + + About + + + Libraries + + + Authors + + + About ROM Repository Manager + + + License: GNU General Public License Version 3 + + + Close + + + Library + + + Version + + + Developers: + Natalia Portillo + + + + Homepage + + + Total games + + + Complete games + + + Incomplete games + + + Total ROMs + + + Have ROMs + + + Missing ROMs + + + Edit DAT + + + Save + + + Cancel + + + Exporting DAT file... + + + Decompressing DAT file... + + + Finished + + + Exporting ROM files to folder... + + + Path: + + + Check all files. + + + Recurse subfolders. + + + Import DAT files from folder... + + + Filename + + + Status + + + Start + + + Searching for files... + + + Found {0} files... + + + Importing {0}... + + + OK + + + Importing DAT file... + + + Remove files after import successful. + + + Only import known files. + + + Try to detect archives and import their contents. + + + Import ROM files from folder... + + + Removing ROM set... + + + Retrieving ROM set from database... + + + Removing ROM set from database... + + + Saving changes to database... + + + Removing DAT file from repo... + + + Choose... + + + Settings + + + Database file + + + Repository folder + + + Temporary folder + + + Path to UnAr + + + Error + + + The Unarchiver version {0} + + + Choose UnArchiver executable + + + Choose temporary folder + + + Choose repository folder + + + Choose database to open / create + + + Do you want to try to open the existing file as a database? + + + Do you want to try to open the existing file as a database? + + + File exists + + + Could not use database + + + An error occurred trying to use the chosen file as a database. +Do you want to delete the file? + + + An error occurred trying to use the chosen file as a database. + + + Do you want to delete the file? + + + Could not delete file + + + An error occurred trying to delete the chosen. + + + Import DAT file... + + + DAT files + + + All files + + + Import DATs from folder... + + + Import ROMs from folder... + + + Delete ROM set + + + Are you sure you want to delete the ROM set {0}? + + + Export ROMs to folder... + + + Select mount point... + + + Loading settings... + + + Checking The Unarchiver... + + + Loading database... + + + Migrating database... + + + Loading ROM sets... + + + Exit + + \ No newline at end of file diff --git a/RomRepoMgr/RomRepoMgr.csproj b/RomRepoMgr/RomRepoMgr.csproj index 42f5720..d68509d 100644 --- a/RomRepoMgr/RomRepoMgr.csproj +++ b/RomRepoMgr/RomRepoMgr.csproj @@ -11,6 +11,11 @@ Designer + + True + True + Localization.resx + @@ -26,4 +31,10 @@ + + + ResXFileCodeGenerator + Localization.Designer.cs + + diff --git a/RomRepoMgr/ViewModels/AboutViewModel.cs b/RomRepoMgr/ViewModels/AboutViewModel.cs index dd0ba30..a8c0116 100644 --- a/RomRepoMgr/ViewModels/AboutViewModel.cs +++ b/RomRepoMgr/ViewModels/AboutViewModel.cs @@ -34,6 +34,7 @@ using JetBrains.Annotations; using Microsoft.DotNet.PlatformAbstractions; using ReactiveUI; using RomRepoMgr.Core.Models; +using RomRepoMgr.Resources; using RomRepoMgr.Views; namespace RomRepoMgr.ViewModels @@ -82,13 +83,13 @@ namespace RomRepoMgr.ViewModels } [NotNull] - public string AboutLabel => "About"; + public string AboutLabel => Localization.AboutLabel; [NotNull] - public string LibrariesLabel => "Libraries"; + public string LibrariesLabel => Localization.LibrariesLabel; [NotNull] - public string AuthorsLabel => "Authors"; + public string AuthorsLabel => Localization.AuthorsLabel; [NotNull] - public string Title => "About ROM Repository Manager"; + public string Title => Localization.AboutTitle; [NotNull] public string SoftwareName => "RomRepoMgr"; [NotNull] @@ -98,17 +99,15 @@ namespace RomRepoMgr.ViewModels [NotNull] public string Website => "https://www.claunia.com"; [NotNull] - public string License => "License: GNU General Public License Version 3"; + public string License => Localization.LicenseLabel; [NotNull] - public string CloseLabel => "Close"; + public string CloseLabel => Localization.CloseLabel; [NotNull] - public string AssembliesLibraryText => "Library"; + public string AssembliesLibraryText => Localization.AssembliesLibraryText; [NotNull] - public string AssembliesVersionText => "Version"; + public string AssembliesVersionText => Localization.AssembliesVersionText; [NotNull] - public string Authors => @"Developers: - Natalia Portillo -"; + public string Authors => Localization.AuthorsText; public ReactiveCommand WebsiteCommand { get; } public ReactiveCommand LicenseCommand { get; } public ReactiveCommand CloseCommand { get; } diff --git a/RomRepoMgr/ViewModels/EditDatViewModel.cs b/RomRepoMgr/ViewModels/EditDatViewModel.cs index 19bdd3b..55747a4 100644 --- a/RomRepoMgr/ViewModels/EditDatViewModel.cs +++ b/RomRepoMgr/ViewModels/EditDatViewModel.cs @@ -30,22 +30,22 @@ using RomRepoMgr.Core.EventArgs; using RomRepoMgr.Core.Models; using RomRepoMgr.Database; using RomRepoMgr.Database.Models; +using RomRepoMgr.Resources; using RomRepoMgr.Views; namespace RomRepoMgr.ViewModels { public class EditDatViewModel : ViewModelBase { - readonly EditDat _view; - string _author; - string _comment; - string _date; - string _description; - string _homepage; - + readonly RomSetModel _romSet; + readonly EditDat _view; + string _author; + string _comment; + string _date; + string _description; + string _homepage; bool _modified; string _name; - readonly RomSetModel _romSet; string _version; public EditDatViewModel(EditDat view, RomSetModel romSet) @@ -64,23 +64,23 @@ namespace RomRepoMgr.ViewModels CloseCommand = ReactiveCommand.Create(ExecuteCloseCommand); } - public string NameLabel => "Name"; - public string VersionLabel => "Version"; - public string AuthorLabel => "Author"; - public string CommentLabel => "Comment"; - public string DateLabel => "Date"; - public string DescriptionLabel => "Description"; - public string HomepageLabel => "Homepage"; - public string TotalMachinesLabel => "Total games"; - public string CompleteMachinesLabel => "Complete games"; - public string IncompleteMachinesLabel => "Incomplete games"; - public string TotalRomsLabel => "Total ROMs"; - public string HaveRomsLabel => "Have ROMs"; - public string MissRomsLabel => "Missing ROMs"; - public string Title => "Edit DAT"; - public string SaveLabel => "Save"; - public string CancelLabel => "Cancel"; - public string CloseLabel => "Close"; + public string NameLabel => Localization.RomSetNameLabel; + public string VersionLabel => Localization.RomSetVersionLabel; + public string AuthorLabel => Localization.RomSetAuthorLabel; + public string CommentLabel => Localization.RomSetCommentLabel; + public string DateLabel => Localization.RomSetDateLabel; + public string DescriptionLabel => Localization.RomSetDescriptionLabel; + public string HomepageLabel => Localization.HomepageLabel; + public string TotalMachinesLabel => Localization.TotalMachinesLabel; + public string CompleteMachinesLabel => Localization.CompleteMachinesLabel; + public string IncompleteMachinesLabel => Localization.IncompleteMachinesLabel; + public string TotalRomsLabel => Localization.TotalRomsLabel; + public string HaveRomsLabel => Localization.HaveRomsLabel; + public string MissRomsLabel => Localization.MissRomsLabel; + public string Title => Localization.EditDatTitle; + public string SaveLabel => Localization.SaveLabel; + public string CancelLabel => Localization.CancelLabel; + public string CloseLabel => Localization.CloseLabel; public ReactiveCommand SaveCommand { get; } public ReactiveCommand CancelCommand { get; } diff --git a/RomRepoMgr/ViewModels/ExportDatViewModel.cs b/RomRepoMgr/ViewModels/ExportDatViewModel.cs index 951fa76..15c71cb 100644 --- a/RomRepoMgr/ViewModels/ExportDatViewModel.cs +++ b/RomRepoMgr/ViewModels/ExportDatViewModel.cs @@ -32,6 +32,7 @@ using ReactiveUI; using RomRepoMgr.Core; using RomRepoMgr.Core.EventArgs; using RomRepoMgr.Core.Workers; +using RomRepoMgr.Resources; using RomRepoMgr.Views; using ErrorEventArgs = RomRepoMgr.Core.EventArgs.ErrorEventArgs; @@ -63,7 +64,7 @@ namespace RomRepoMgr.ViewModels } [NotNull] - public string Title => "Exporting DAT file..."; + public string Title => Localization.ExportDatTitle; public string StatusMessage { @@ -95,12 +96,12 @@ namespace RomRepoMgr.ViewModels set => this.RaiseAndSetIfChanged(ref _canClose, value); } - public string CloseLabel => "Close"; + public string CloseLabel => Localization.CloseLabel; public ReactiveCommand CloseCommand { get; } void OnWorkerOnFinishedWithText(object sender, MessageEventArgs args) => Dispatcher.UIThread.Post(() => { - StatusMessage = "Finished"; + StatusMessage = Localization.Finished; ProgressVisible = false; CanClose = true; }); @@ -118,7 +119,7 @@ namespace RomRepoMgr.ViewModels internal void OnOpened() { ProgressVisible = true; - StatusMessage = "Decompressing DAT file..."; + StatusMessage = Localization.DecompressingDat; byte[] sha384Bytes = new byte[48]; string sha384 = _datHash; @@ -153,10 +154,7 @@ namespace RomRepoMgr.ViewModels if(!File.Exists(compressedDatPath)) _view.Close(); - Task.Run(() => - { - _worker.DecompressFile(compressedDatPath, _outPath); - }); + Task.Run(() => _worker.DecompressFile(compressedDatPath, _outPath)); } } } \ No newline at end of file diff --git a/RomRepoMgr/ViewModels/ExportRomsViewModel.cs b/RomRepoMgr/ViewModels/ExportRomsViewModel.cs index 331cdba..a31603a 100644 --- a/RomRepoMgr/ViewModels/ExportRomsViewModel.cs +++ b/RomRepoMgr/ViewModels/ExportRomsViewModel.cs @@ -31,6 +31,7 @@ using JetBrains.Annotations; using ReactiveUI; using RomRepoMgr.Core.EventArgs; using RomRepoMgr.Core.Workers; +using RomRepoMgr.Resources; using RomRepoMgr.Views; namespace RomRepoMgr.ViewModels @@ -69,7 +70,7 @@ namespace RomRepoMgr.ViewModels } [NotNull] - public string PathLabel => "Path:"; + public string PathLabel => Localization.PathLabel; public string FolderPath { get; } public bool ProgressVisible @@ -181,9 +182,9 @@ namespace RomRepoMgr.ViewModels } [NotNull] - public string Title => "Exporting ROM files to folder..."; + public string Title => Localization.ExportRomsTitle; [NotNull] - public string CloseLabel => "Close"; + public string CloseLabel => Localization.CloseLabel; public bool CanClose { diff --git a/RomRepoMgr/ViewModels/ImportDatFolderViewModel.cs b/RomRepoMgr/ViewModels/ImportDatFolderViewModel.cs index dff5625..f884f4f 100644 --- a/RomRepoMgr/ViewModels/ImportDatFolderViewModel.cs +++ b/RomRepoMgr/ViewModels/ImportDatFolderViewModel.cs @@ -34,6 +34,7 @@ using JetBrains.Annotations; using ReactiveUI; using RomRepoMgr.Core.EventArgs; using RomRepoMgr.Core.Workers; +using RomRepoMgr.Resources; using RomRepoMgr.Views; using ErrorEventArgs = RomRepoMgr.Core.EventArgs.ErrorEventArgs; @@ -74,10 +75,10 @@ namespace RomRepoMgr.ViewModels StartCommand = ReactiveCommand.Create(ExecuteStartCommand); } - public string PathLabel => "Path:"; + public string PathLabel => Localization.PathLabel; public string FolderPath { get; } - public string AllFilesLabel => "Check all files."; - public string RecursiveLabel => "Recurse subfolders."; + public string AllFilesLabel => Localization.AllFilesLabel; + public string RecursiveLabel => Localization.RecursiveLabel; public bool AllFilesChecked { @@ -184,13 +185,13 @@ namespace RomRepoMgr.ViewModels } [NotNull] - public string Title => "Import DAT files from folder..."; + public string Title => Localization.ImportDatFolderTitle; public ObservableCollection ImportResults { get; } - public string ResultFilenameLabel => "Filename"; - public string ResultStatusLabel => "Status"; - public string CloseLabel => "Close"; - public string StartLabel => "Start"; + public string ResultFilenameLabel => Localization.ResultFilenameLabel; + public string ResultStatusLabel => Localization.ResultStatusLabel; + public string CloseLabel => Localization.CloseLabel; + public string StartLabel => Localization.StartLabel; public bool CanClose { @@ -217,7 +218,7 @@ namespace RomRepoMgr.ViewModels ProgressVisible = true; Progress2Visible = false; ProgressIsIndeterminate = true; - StatusMessage = "Searching for files..."; + StatusMessage = Localization.SearchingForFiles; }); if(_allFilesChecked) @@ -243,7 +244,7 @@ namespace RomRepoMgr.ViewModels { IsReady = true; ProgressVisible = false; - StatusMessage = string.Format("Found {0} files...", _datFiles.Length); + StatusMessage = string.Format(Localization.FoundFiles, _datFiles.Length); CanClose = true; CanStart = true; }); @@ -274,7 +275,7 @@ namespace RomRepoMgr.ViewModels { Progress2Visible = true; ProgressVisible = true; - StatusMessage = "Finished"; + StatusMessage = Localization.Finished; CanClose = true; CanStart = false; IsReady = true; @@ -282,7 +283,7 @@ namespace RomRepoMgr.ViewModels return; } - StatusMessage = string.Format("Importing {0}...", Path.GetFileName(_datFiles[_listPosition])); + StatusMessage = string.Format(Localization.ImportingItem, Path.GetFileName(_datFiles[_listPosition])); ProgressValue = _listPosition; var _worker = new DatImporter(_datFiles[_listPosition]); @@ -301,7 +302,7 @@ namespace RomRepoMgr.ViewModels ImportResults.Add(new ImportDatFolderItem { Filename = Path.GetFileName(_datFiles[_listPosition]), - Status = "OK" + Status = Localization.OK }); _listPosition++; diff --git a/RomRepoMgr/ViewModels/ImportDatViewModel.cs b/RomRepoMgr/ViewModels/ImportDatViewModel.cs index c0ec298..4d847bb 100644 --- a/RomRepoMgr/ViewModels/ImportDatViewModel.cs +++ b/RomRepoMgr/ViewModels/ImportDatViewModel.cs @@ -31,6 +31,7 @@ using JetBrains.Annotations; using ReactiveUI; using RomRepoMgr.Core.EventArgs; using RomRepoMgr.Core.Workers; +using RomRepoMgr.Resources; using RomRepoMgr.Views; namespace RomRepoMgr.ViewModels @@ -66,7 +67,7 @@ namespace RomRepoMgr.ViewModels } [NotNull] - public string Title => "Importing DAT file..."; + public string Title => Localization.ImportDatTitle; public string StatusMessage { @@ -122,12 +123,12 @@ namespace RomRepoMgr.ViewModels set => this.RaiseAndSetIfChanged(ref _canClose, value); } - public string CloseLabel => "Close"; + public string CloseLabel => Localization.CloseLabel; public ReactiveCommand CloseCommand { get; } void OnWorkerOnWorkFinished(object sender, EventArgs args) => Dispatcher.UIThread.Post(() => { - StatusMessage = "Finished"; + StatusMessage = Localization.Finished; ProgressVisible = false; CanClose = true; }); diff --git a/RomRepoMgr/ViewModels/ImportRomFolderViewModel.cs b/RomRepoMgr/ViewModels/ImportRomFolderViewModel.cs index 95504e1..094c63c 100644 --- a/RomRepoMgr/ViewModels/ImportRomFolderViewModel.cs +++ b/RomRepoMgr/ViewModels/ImportRomFolderViewModel.cs @@ -33,6 +33,7 @@ using ReactiveUI; using RomRepoMgr.Core.EventArgs; using RomRepoMgr.Core.Models; using RomRepoMgr.Core.Workers; +using RomRepoMgr.Resources; using RomRepoMgr.Views; namespace RomRepoMgr.ViewModels @@ -77,11 +78,11 @@ namespace RomRepoMgr.ViewModels _removeFilesEnabled = false; } - public string PathLabel => "Path:"; + public string PathLabel => Localization.PathLabel; public string FolderPath { get; } - public string RemoveFilesLabel => "Remove files after import successful."; - public string KnownOnlyLabel => "Only import known files."; - public string RecurseArchivesLabel => "Try to detect archives and import their contents."; + public string RemoveFilesLabel => Localization.RemoveFilesLabel; + public string KnownOnlyLabel => Localization.KnownOnlyLabel; + public string RecurseArchivesLabel => Localization.RecurseArchivesLabel; public bool RecurseArchivesEnabled => Settings.Settings.UnArUsable; public bool RemoveFilesChecked @@ -200,13 +201,13 @@ namespace RomRepoMgr.ViewModels } [NotNull] - public string Title => "Import ROM files from folder..."; + public string Title => Localization.ImportRomFolderTitle; public ObservableCollection ImportResults { get; } - public string ResultFilenameLabel => "Filename"; - public string ResultStatusLabel => "Status"; - public string CloseLabel => "Close"; - public string StartLabel => "Start"; + public string ResultFilenameLabel => Localization.ResultFilenameLabel; + public string ResultStatusLabel => Localization.ResultStatusLabel; + public string CloseLabel => Localization.CloseLabel; + public string StartLabel => Localization.StartLabel; public bool CanClose { @@ -249,13 +250,13 @@ namespace RomRepoMgr.ViewModels Task.Run(() => worker.ProcessPath(FolderPath, true, RecurseArchivesChecked)); } - void OnWorkerOnImportedRom(object? sender, ImportedRomItemEventArgs args) => + void OnWorkerOnImportedRom(object sender, ImportedRomItemEventArgs args) => Dispatcher.UIThread.Post(() => ImportResults.Add(args.Item)); - void OnWorkerOnFinished(object? sender, EventArgs args) => Dispatcher.UIThread.Post(() => + void OnWorkerOnFinished(object sender, EventArgs args) => Dispatcher.UIThread.Post(() => { ProgressVisible = false; - StatusMessage = "Finished!"; + StatusMessage = Localization.Finished; CanClose = true; Progress2Visible = false; }); diff --git a/RomRepoMgr/ViewModels/MainWindowViewModel.cs b/RomRepoMgr/ViewModels/MainWindowViewModel.cs index 13d3344..7ea8cae 100644 --- a/RomRepoMgr/ViewModels/MainWindowViewModel.cs +++ b/RomRepoMgr/ViewModels/MainWindowViewModel.cs @@ -37,6 +37,7 @@ using ReactiveUI; using RomRepoMgr.Core.EventArgs; using RomRepoMgr.Core.Filesystem; using RomRepoMgr.Core.Models; +using RomRepoMgr.Resources; using RomRepoMgr.Views; namespace RomRepoMgr.ViewModels @@ -64,20 +65,37 @@ namespace RomRepoMgr.ViewModels RomSets = new ObservableCollection(romSets); } - public ObservableCollection RomSets { get; } - public string RomSetLabel => "ROM sets"; - public string RomSetNameLabel => "Name"; - public string RomSetVersionLabel => "Version"; - public string RomSetAuthorLabel => "Author"; - public string RomSetDateLabel => "Date"; - public string RomSetDescriptionLabel => "Description"; - public string RomSetCommentLabel => "Comment"; - public string RomSetTotalMachinesLabel => "Games"; - public string RomSetCompleteMachinesLabel => "Complete"; - public string RomSetIncompleteMachinesLabel => "Incomplete"; - public string RomSetTotalRomsLabel => "ROMs"; - public string RomSetHaveRomsLabel => "Have"; - public string RomSetMissRomsLabel => "Miss"; + public ObservableCollection RomSets { get; } + public string RomSetLabel => Localization.RomSets; + public string RomSetNameLabel => Localization.RomSetNameLabel; + public string RomSetVersionLabel => Localization.RomSetVersionLabel; + public string RomSetAuthorLabel => Localization.RomSetAuthorLabel; + public string RomSetDateLabel => Localization.RomSetDateLabel; + public string RomSetDescriptionLabel => Localization.RomSetDescriptionLabel; + public string RomSetCommentLabel => Localization.RomSetCommentLabel; + public string RomSetTotalMachinesLabel => Localization.RomSetTotalMachinesLabel; + public string RomSetCompleteMachinesLabel => Localization.RomSetCompleteMachinesLabel; + public string RomSetIncompleteMachinesLabel => Localization.RomSetIncompleteMachinesLabel; + public string RomSetTotalRomsLabel => Localization.RomSetTotalRomsLabel; + public string RomSetHaveRomsLabel => Localization.RomSetHaveRomsLabel; + public string RomSetMissRomsLabel => Localization.RomSetMissRomsLabel; + public bool IsVfsAvailable => Fuse.IsAvailable; + public string FileMenuText => Localization.FileMenuText; + public string FileMenuImportDatFileText => Localization.FileMenuImportDatFileText; + public string FileMenuImportDatFolderText => Localization.FileMenuImportDatFolderText; + public string FileMenuSettingsText => Localization.FileMenuSettingsText; + public string FileMenuExitText => Localization.FileMenuExitText; + public string FilesystemMenuText => Localization.FilesystemMenuText; + public string FilesystemMenuMountText => Localization.FilesystemMenuMountText; + public string RomsMenuText => Localization.RomsMenuText; + public string RomsMenuImportText => Localization.RomsMenuImportText; + public string RomSetsMenuText => Localization.RomSetsMenuText; + public string RomSetsMenuSaveRomsText => Localization.RomSetsMenuSaveRomsText; + public string RomSetsMenuSaveDatText => Localization.RomSetsMenuSaveDatText; + public string RomSetsMenuEditText => Localization.RomSetsMenuEditText; + public string RomSetsMenuDeleteText => Localization.RomSetsMenuDeleteText; + public string HelpMenuText => Localization.HelpMenuText; + public string HelpMenuAboutText => Localization.HelpMenuAboutText; public bool NativeMenuSupported => NativeMenu.GetIsNativeMenuExported((Application.Current.ApplicationLifetime as @@ -101,8 +119,6 @@ namespace RomRepoMgr.ViewModels set => this.RaiseAndSetIfChanged(ref _selectedRomSet, value); } - public bool IsVfsAvailable => Fuse.IsAvailable; - internal async void ExecuteSettingsCommand() { var dialog = new SettingsDialog(); @@ -120,12 +136,12 @@ namespace RomRepoMgr.ViewModels dialog.ShowDialog(_view); } - internal async void ExecuteImportDatCommand() + async void ExecuteImportDatCommand() { var dlgOpen = new OpenFileDialog { AllowMultiple = false, - Title = "Import DAT file..." + Title = Localization.ImportDatFileDialogTitle }; dlgOpen.Filters.Add(new FileDialogFilter @@ -135,7 +151,7 @@ namespace RomRepoMgr.ViewModels "*.dat", "*.xml" }, - Name = "DAT files" + Name = Localization.DatFilesDialogLabel }); dlgOpen.Filters.Add(new FileDialogFilter @@ -144,7 +160,7 @@ namespace RomRepoMgr.ViewModels { "*.*" }, - Name = "All files" + Name = Localization.AllFilesDialogLabel }); string[] result = await dlgOpen.ShowAsync(_view); @@ -159,16 +175,14 @@ namespace RomRepoMgr.ViewModels await dialog.ShowDialog(_view); } - void ImportDatViewModelOnRomSetAdded(object sender, RomSetEventArgs e) => Dispatcher.UIThread.Post(() => - { - RomSets.Add(e.RomSet); - }); + void ImportDatViewModelOnRomSetAdded(object sender, RomSetEventArgs e) => + Dispatcher.UIThread.Post(() => RomSets.Add(e.RomSet)); - internal async void ExecuteImportDatFolderCommand() + async void ExecuteImportDatFolderCommand() { var dlgOpen = new OpenFolderDialog { - Title = "Import DATs from folder..." + Title = Localization.ImportDatFolderDialogTitle }; string result = await dlgOpen.ShowAsync(_view); @@ -183,11 +197,11 @@ namespace RomRepoMgr.ViewModels await dialog.ShowDialog(_view); } - internal async void ExecuteImportRomFolderCommand() + async void ExecuteImportRomFolderCommand() { var dlgOpen = new OpenFolderDialog { - Title = "Import ROMs from folder..." + Title = Localization.ImportRomsFolderDialogTitle }; string result = await dlgOpen.ShowAsync(_view); @@ -206,12 +220,12 @@ namespace RomRepoMgr.ViewModels if(SelectedRomSet == null) return; - ButtonResult result = await MessageBoxManager.GetMessageBoxStandardWindow("Delete ROM set", - string. - Format("Are you sure you want to delete the ROM set {0}?", - SelectedRomSet.Name), ButtonEnum.YesNo, - Icon.Database). - ShowDialog(_view); + ButtonResult result = await MessageBoxManager. + GetMessageBoxStandardWindow(Localization.DeleteRomSetMsgBoxTitle, + string. + Format(Localization.DeleteRomSetMsgBoxCaption, + SelectedRomSet.Name), ButtonEnum.YesNo, + Icon.Database).ShowDialog(_view); if(result == ButtonResult.No) return; @@ -274,7 +288,7 @@ namespace RomRepoMgr.ViewModels { var dlgOpen = new OpenFolderDialog { - Title = "Export ROMs to folder..." + Title = Localization.ExportRomsDialogTitle }; string result = await dlgOpen.ShowAsync(_view); @@ -292,7 +306,7 @@ namespace RomRepoMgr.ViewModels { var dlgOpen = new OpenFolderDialog { - Title = "Select mount point..." + Title = Localization.SelectMountPointDialogTitle }; string result = await dlgOpen.ShowAsync(_view); diff --git a/RomRepoMgr/ViewModels/RemoveDatViewModel.cs b/RomRepoMgr/ViewModels/RemoveDatViewModel.cs index 502403c..a1b9a82 100644 --- a/RomRepoMgr/ViewModels/RemoveDatViewModel.cs +++ b/RomRepoMgr/ViewModels/RemoveDatViewModel.cs @@ -31,6 +31,7 @@ using ReactiveUI; using RomRepoMgr.Core; using RomRepoMgr.Database; using RomRepoMgr.Database.Models; +using RomRepoMgr.Resources; using RomRepoMgr.Views; namespace RomRepoMgr.ViewModels @@ -48,7 +49,7 @@ namespace RomRepoMgr.ViewModels } [NotNull] - public string Title => "Removing ROM set..."; + public string Title => Localization.RemoveDatTitle; public string StatusMessage { @@ -58,22 +59,22 @@ namespace RomRepoMgr.ViewModels internal void OnOpened() => Task.Run(() => { - Dispatcher.UIThread.Post(() => StatusMessage = "Retrieving ROM set from database..."); + Dispatcher.UIThread.Post(() => StatusMessage = Localization.RetrievingRomSetFromDatabase); RomSet romSet = Context.Singleton.RomSets.Find(_romSetId); if(romSet == null) return; - Dispatcher.UIThread.Post(() => StatusMessage = "Removing ROM set from database..."); + Dispatcher.UIThread.Post(() => StatusMessage = Localization.RemovingRomSetFromDatabase); Context.Singleton.RomSets.Remove(romSet); - Dispatcher.UIThread.Post(() => StatusMessage = "Saving changes to database..."); + Dispatcher.UIThread.Post(() => StatusMessage = Localization.SavingChangesToDatabase); Context.Singleton.SaveChanges(); - Dispatcher.UIThread.Post(() => StatusMessage = "Removing DAT file from repo..."); + Dispatcher.UIThread.Post(() => StatusMessage = Localization.RemovingDatFileFromRepo); byte[] sha384Bytes = new byte[48]; string sha384 = romSet.Sha384; diff --git a/RomRepoMgr/ViewModels/SettingsViewModel.cs b/RomRepoMgr/ViewModels/SettingsViewModel.cs index f1d266f..bd76d9d 100644 --- a/RomRepoMgr/ViewModels/SettingsViewModel.cs +++ b/RomRepoMgr/ViewModels/SettingsViewModel.cs @@ -29,6 +29,7 @@ using System.Reactive; using System.Threading.Tasks; using Avalonia.Controls; using Avalonia.Threading; +using JetBrains.Annotations; using MessageBox.Avalonia; using MessageBox.Avalonia.Enums; using Microsoft.EntityFrameworkCore; @@ -36,6 +37,7 @@ using ReactiveUI; using RomRepoMgr.Core.EventArgs; using RomRepoMgr.Core.Workers; using RomRepoMgr.Database; +using RomRepoMgr.Resources; using RomRepoMgr.Views; using ErrorEventArgs = RomRepoMgr.Core.EventArgs.ErrorEventArgs; @@ -75,16 +77,16 @@ namespace RomRepoMgr.ViewModels UnArPath = Settings.Settings.Current.UnArchiverPath; if(!string.IsNullOrWhiteSpace(UnArPath)) - CheckUnar(); + CheckUnAr(); } - public string ChooseLabel => "Choose..."; - public string Title => "Settings"; - public string CloseLabel => "Close"; - public string DatabaseLabel => "Database file"; - public string RepositoryLabel => "Repository folder"; - public string TemporaryLabel => "Temporary folder"; - public string UnArPathLabel => "Path to UnAr"; + public string ChooseLabel => Localization.ChooseLabel; + public string Title => Localization.SettingsTitle; + public string CloseLabel => Localization.CloseLabel; + public string DatabaseLabel => Localization.DatabaseFileLabel; + public string RepositoryLabel => Localization.RepositoryFolderLabel; + public string TemporaryLabel => Localization.TemporaryFolderLabel; + public string UnArPathLabel => Localization.UnArPathLabel; public ReactiveCommand UnArCommand { get; } public ReactiveCommand TemporaryCommand { get; } @@ -137,30 +139,31 @@ namespace RomRepoMgr.ViewModels set => this.RaiseAndSetIfChanged(ref _unArVersion, value); } - public string SaveLabel => "Save"; + public string SaveLabel => Localization.SaveLabel; - void CheckUnar() + void CheckUnAr() { var worker = new Compression(); - worker.FinishedWithText += CheckUnarFinished; - worker.FailedWithText += CheckUnarFailed; + worker.FinishedWithText += CheckUnArFinished; + worker.FailedWithText += CheckUnArFailed; - Task.Run(() => worker.CheckUnar(UnArPath)); + Task.Run(() => worker.CheckUnAr(UnArPath)); } - async void CheckUnarFailed(object sender, ErrorEventArgs args) + async void CheckUnArFailed(object sender, [NotNull] ErrorEventArgs args) { UnArVersion = ""; UnArPath = ""; - await MessageBoxManager.GetMessageBoxStandardWindow("Error", $"{args.Message}", ButtonEnum.Ok, Icon.Error). - ShowDialog(_view); + await MessageBoxManager. + GetMessageBoxStandardWindow(Localization.Error, $"{args.Message}", ButtonEnum.Ok, Icon.Error). + ShowDialog(_view); } - void CheckUnarFinished(object? sender, MessageEventArgs args) => Dispatcher.UIThread.Post(() => + void CheckUnArFinished(object sender, MessageEventArgs args) => Dispatcher.UIThread.Post(() => { - UnArVersion = string.Format("The Unarchiver version {0}", args.Message); + UnArVersion = string.Format(Localization.TheUnarchiverVersionLabel, args.Message); _unArChanged = true; }); @@ -168,9 +171,11 @@ namespace RomRepoMgr.ViewModels async void ExecuteUnArCommand() { - var dlgFile = new OpenFileDialog(); - dlgFile.Title = "Choose UnArchiver executable"; - dlgFile.AllowMultiple = false; + var dlgFile = new OpenFileDialog + { + Title = Localization.ChooseUnArExecutable, + AllowMultiple = false + }; if(!string.IsNullOrWhiteSpace(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles))) dlgFile.Directory = Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles); @@ -181,13 +186,15 @@ namespace RomRepoMgr.ViewModels return; UnArPath = result[0]; - CheckUnar(); + CheckUnAr(); } async void ExecuteTemporaryCommand() { - var dlgFolder = new OpenFolderDialog(); - dlgFolder.Title = "Choose temporary folder"; + var dlgFolder = new OpenFolderDialog + { + Title = Localization.ChooseTemporaryFolder + }; string result = await dlgFolder.ShowAsync(_view); @@ -199,8 +206,10 @@ namespace RomRepoMgr.ViewModels async void ExecuteRepositoryCommand() { - var dlgFolder = new OpenFolderDialog(); - dlgFolder.Title = "Choose repository folder"; + var dlgFolder = new OpenFolderDialog + { + Title = Localization.ChooseRepositoryFolder + }; string result = await dlgFolder.ShowAsync(_view); @@ -212,10 +221,12 @@ namespace RomRepoMgr.ViewModels async void ExecuteDatabaseCommand() { - var dlgFile = new SaveFileDialog(); - dlgFile.InitialFileName = "romrepo.db"; - dlgFile.Directory = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments); - dlgFile.Title = "Choose database to open /create"; + var dlgFile = new SaveFileDialog + { + InitialFileName = "romrepo.db", + Directory = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), + Title = Localization.ChooseDatabaseFile + }; string result = await dlgFile.ShowAsync(_view); @@ -225,8 +236,8 @@ namespace RomRepoMgr.ViewModels if(File.Exists(result)) { ButtonResult btnResult = await MessageBoxManager. - GetMessageBoxStandardWindow("File exists", - "Do you want to try to open the existing file as a database?", + GetMessageBoxStandardWindow(Localization.DatabaseFileExistsMsgBoxTitle, + Localization.DatabaseFileTryOpenCaption, ButtonEnum.YesNo, Icon.Database). ShowDialog(_view); @@ -240,8 +251,9 @@ namespace RomRepoMgr.ViewModels catch(Exception) { btnResult = await MessageBoxManager. - GetMessageBoxStandardWindow("Could not use database", - "An error occurred trying to use the chosen file as a database.\nDo you want to delete the file?", + GetMessageBoxStandardWindow(Localization.DatabaseFileUnusableMsgBoxTitle, + Localization. + DatabaseFileUnusableDeleteMsgBoxCaption, ButtonEnum.YesNo, Icon.Error).ShowDialog(_view); if(btnResult == ButtonResult.No) @@ -254,8 +266,8 @@ namespace RomRepoMgr.ViewModels catch(Exception) { await MessageBoxManager. - GetMessageBoxStandardWindow("Could not delete file", - "An error occurred trying to delete the chosen.", + GetMessageBoxStandardWindow(Localization.DatabaseFileCannotDeleteTitle, + Localization.DatabaseFileCannotDeleteCaption, ButtonEnum.Ok, Icon.Error).ShowDialog(_view); return; @@ -265,7 +277,8 @@ namespace RomRepoMgr.ViewModels else { btnResult = await MessageBoxManager. - GetMessageBoxStandardWindow("File exists", "Do you want to delete the file?", + GetMessageBoxStandardWindow(Localization.DatabaseFileExistsMsgBoxTitle, + Localization.DatabaseFileDeleteCaption, ButtonEnum.YesNo, Icon.Error).ShowDialog(_view); if(btnResult == ButtonResult.No) @@ -278,9 +291,9 @@ namespace RomRepoMgr.ViewModels catch(Exception) { await MessageBoxManager. - GetMessageBoxStandardWindow("Could not delete file", - "An error occurred trying to delete the chosen.", - ButtonEnum.Ok, Icon.Error).ShowDialog(_view); + GetMessageBoxStandardWindow(Localization.DatabaseFileCannotDeleteTitle, + Localization.DatabaseFileCannotDeleteCaption, ButtonEnum.Ok, + Icon.Error).ShowDialog(_view); return; } @@ -295,9 +308,9 @@ namespace RomRepoMgr.ViewModels catch(Exception) { await MessageBoxManager. - GetMessageBoxStandardWindow("Could not use database", - "An error occurred trying to use the chosen file as a database.", - ButtonEnum.Ok, Icon.Error).ShowDialog(_view); + GetMessageBoxStandardWindow(Localization.DatabaseFileUnusableMsgBoxTitle, + Localization.DatabaseFileUnusableMsgBoxCaption, ButtonEnum.Ok, + Icon.Error).ShowDialog(_view); return; } diff --git a/RomRepoMgr/ViewModels/SplashWindowViewModel.cs b/RomRepoMgr/ViewModels/SplashWindowViewModel.cs index a55db75..68035c2 100644 --- a/RomRepoMgr/ViewModels/SplashWindowViewModel.cs +++ b/RomRepoMgr/ViewModels/SplashWindowViewModel.cs @@ -37,41 +37,33 @@ using RomRepoMgr.Core.EventArgs; using RomRepoMgr.Core.Models; using RomRepoMgr.Core.Workers; using RomRepoMgr.Database; +using RomRepoMgr.Resources; namespace RomRepoMgr.ViewModels { public sealed class SplashWindowViewModel : ViewModelBase { - bool _checkingUnArError; - bool _checkingUnArOk; - string _checkingUnArText; - bool _checkingUnArUnknown; - string _exitButtonText; - bool _exitVisible; - bool _loadingDatabaseError; - bool _loadingDatabaseOk; - string _loadingDatabaseText; - bool _loadingDatabaseUnknown; - bool _loadingRomSetsError; - bool _loadingRomSetsOk; - string _loadingRomSetsText; - bool _loadingRomSetsUnknown; - bool _loadingSettingsError; - bool _loadingSettingsOk; - string _loadingSettingsText; - bool _loadingSettingsUnknown; - string _loadingText; - bool _migratingDatabaseError; - bool _migratingDatabaseOk; - string _migratingDatabaseText; - bool _migratingDatabaseUnknown; + bool _checkingUnArError; + bool _checkingUnArOk; + bool _checkingUnArUnknown; + bool _exitVisible; + bool _loadingDatabaseError; + bool _loadingDatabaseOk; + bool _loadingDatabaseUnknown; + bool _loadingRomSetsError; + bool _loadingRomSetsOk; + bool _loadingRomSetsUnknown; + bool _loadingSettingsError; + bool _loadingSettingsOk; + bool _loadingSettingsUnknown; + bool _migratingDatabaseError; + bool _migratingDatabaseOk; + bool _migratingDatabaseUnknown; public SplashWindowViewModel() { ExitCommand = ReactiveCommand.Create(ExecuteExitCommand); - LoadStrings(); - LoadingSettingsOk = false; LoadingSettingsError = false; LoadingSettingsUnknown = true; @@ -92,18 +84,6 @@ namespace RomRepoMgr.ViewModels public ReactiveCommand ExitCommand { get; } - public string LoadingText - { - get => _loadingText; - set => this.RaiseAndSetIfChanged(ref _loadingText, value); - } - - public string LoadingSettingsText - { - get => _loadingSettingsText; - set => this.RaiseAndSetIfChanged(ref _loadingSettingsText, value); - } - public bool LoadingSettingsOk { get => _loadingSettingsOk; @@ -122,12 +102,6 @@ namespace RomRepoMgr.ViewModels set => this.RaiseAndSetIfChanged(ref _loadingSettingsUnknown, value); } - public string CheckingUnArText - { - get => _checkingUnArText; - set => this.RaiseAndSetIfChanged(ref _checkingUnArText, value); - } - public bool CheckingUnArOk { get => _checkingUnArOk; @@ -146,12 +120,6 @@ namespace RomRepoMgr.ViewModels set => this.RaiseAndSetIfChanged(ref _checkingUnArUnknown, value); } - public string LoadingDatabaseText - { - get => _loadingDatabaseText; - set => this.RaiseAndSetIfChanged(ref _loadingDatabaseText, value); - } - public bool LoadingDatabaseOk { get => _loadingDatabaseOk; @@ -170,12 +138,6 @@ namespace RomRepoMgr.ViewModels set => this.RaiseAndSetIfChanged(ref _loadingDatabaseUnknown, value); } - public string MigratingDatabaseText - { - get => _migratingDatabaseText; - set => this.RaiseAndSetIfChanged(ref _migratingDatabaseText, value); - } - public bool MigratingDatabaseOk { get => _migratingDatabaseOk; @@ -200,12 +162,6 @@ namespace RomRepoMgr.ViewModels set => this.RaiseAndSetIfChanged(ref _exitVisible, value); } - public string ExitButtonText - { - get => _exitButtonText; - set => this.RaiseAndSetIfChanged(ref _exitButtonText, value); - } - public bool LoadingRomSetsOk { get => _loadingRomSetsOk; @@ -224,26 +180,17 @@ namespace RomRepoMgr.ViewModels set => this.RaiseAndSetIfChanged(ref _loadingRomSetsUnknown, value); } - public string LoadingRomSetsText - { - get => _loadingRomSetsText; - set => this.RaiseAndSetIfChanged(ref _loadingRomSetsText, value); - } + public string LoadingText => "ROM Repository Manager"; + public string LoadingSettingsText => Localization.LoadingSettingsText; + public string CheckingUnArText => Localization.CheckingUnArText; + public string LoadingDatabaseText => Localization.LoadingDatabaseText; + public string MigratingDatabaseText => Localization.MigratingDatabaseText; + public string LoadingRomSetsText => Localization.LoadingRomSetsText; + public string ExitButtonText => Localization.ExitButtonText; - internal void ExecuteExitCommand() => + void ExecuteExitCommand() => (Application.Current.ApplicationLifetime as ClassicDesktopStyleApplicationLifetime)?.Shutdown(); - void LoadStrings() - { - LoadingText = "ROM Repository Manager"; - LoadingSettingsText = "Loading settings..."; - CheckingUnArText = "Checking The Unarchiver..."; - LoadingDatabaseText = "Loading database..."; - MigratingDatabaseText = "Migrating database..."; - LoadingRomSetsText = "Loading ROM sets..."; - ExitButtonText = "Exit"; - } - internal void OnOpened() => Dispatcher.UIThread.Post(LoadSettings); void LoadSettings() => Task.Run(() => @@ -252,7 +199,7 @@ namespace RomRepoMgr.ViewModels { Settings.Settings.LoadSettings(); - Dispatcher.UIThread.Post(CheckUnar); + Dispatcher.UIThread.Post(CheckUnAr); } catch(Exception e) { @@ -268,7 +215,7 @@ namespace RomRepoMgr.ViewModels ExitVisible = true; } - void CheckUnar() => Task.Run(() => + void CheckUnAr() => Task.Run(() => { LoadingSettingsUnknown = false; LoadingSettingsOk = true; @@ -276,18 +223,18 @@ namespace RomRepoMgr.ViewModels try { var worker = new Compression(); - Settings.Settings.UnArUsable = worker.CheckUnar(Settings.Settings.Current.UnArchiverPath); + Settings.Settings.UnArUsable = worker.CheckUnAr(Settings.Settings.Current.UnArchiverPath); Dispatcher.UIThread.Post(LoadDatabase); } catch(Exception e) { // TODO: Log error - Dispatcher.UIThread.Post(FailedCheckUnar); + Dispatcher.UIThread.Post(FailedCheckUnAr); } }); - void FailedCheckUnar() + void FailedCheckUnAr() { CheckingUnArUnknown = false; CheckingUnArError = true; diff --git a/RomRepoMgr/Views/MainWindow.xaml b/RomRepoMgr/Views/MainWindow.xaml index 5bb3bcb..2636ed2 100644 --- a/RomRepoMgr/Views/MainWindow.xaml +++ b/RomRepoMgr/Views/MainWindow.xaml @@ -8,30 +8,37 @@ - - - - + + + + + - + - - + + - - + + + - - - - - + + + + + + + - - + +