Move strings to resources.

This commit is contained in:
2020-08-30 03:00:14 +01:00
parent 8e3b5fee6a
commit 9daf59f78e
34 changed files with 2597 additions and 339 deletions

View File

@@ -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 =

View File

@@ -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
/// <inheritdoc />
/// <summary>Returns a byte array of the hash value.</summary>
public byte[] Final() => throw new NotImplementedException("SpamSum does not have a binary representation.");
public byte[] Final() => throw new NotImplementedException(Localization.Spamsum_no_binary);
/// <inheritdoc />
/// <summary>Returns a base64 representation of the hash value.</summary>
@@ -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
/// <summary>Gets the hash of a file</summary>
/// <param name="filename">File path.</param>
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);
/// <summary>Gets the hash of a file in hexadecimal and as a byte array.</summary>
/// <param name="filename">File path.</param>
/// <param name="hash">Byte array of the hash value.</param>
public static string File(string filename, out byte[] hash) =>
throw new NotImplementedException("Not yet implemented.");
throw new NotImplementedException(Localization.Not_yet_implemented);
/// <summary>Gets the hash of the specified data buffer.</summary>
/// <param name="data">Data buffer.</param>

View File

@@ -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();

View File

@@ -0,0 +1,495 @@
//------------------------------------------------------------------------------
// <auto-generated>
// 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.
// </auto-generated>
//------------------------------------------------------------------------------
namespace RomRepoMgr.Core.Resources {
using System;
/// <summary>
/// A strongly-typed resource class, for looking up localized strings, etc.
/// </summary>
// 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() {
}
/// <summary>
/// Returns the cached ResourceManager instance used by this class.
/// </summary>
[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;
}
}
/// <summary>
/// Overrides the current thread's CurrentUICulture property for all
/// resource lookups using this strongly typed resource class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set {
resourceCulture = value;
}
}
/// <summary>
/// Looks up a localized string similar to Adding DAT to database....
/// </summary>
internal static string AddingDatToDatabase {
get {
return ResourceManager.GetString("AddingDatToDatabase", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Adding machines (games)....
/// </summary>
internal static string AddingMachines {
get {
return ResourceManager.GetString("AddingMachines", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Adding ROMs....
/// </summary>
internal static string AddingRoms {
get {
return ResourceManager.GetString("AddingRoms", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Assertion failed.
/// </summary>
internal static string Assertion_failed {
get {
return ResourceManager.GetString("Assertion_failed", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Specified string is not valid Base32 format because character &quot;{0}&quot; does not exist in Base32 alphabet.
/// </summary>
internal static string Base32_Invalid_format {
get {
return ResourceManager.GetString("Base32_Invalid_format", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Specified string is not valid Base32 format because it doesn&apos;t have enough data to construct a complete byte array.
/// </summary>
internal static string Base32_Not_enought_data {
get {
return ResourceManager.GetString("Base32_Not_enought_data", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Cannot seek after stream end..
/// </summary>
internal static string Cannot_seek_after_end {
get {
return ResourceManager.GetString("Cannot_seek_after_end", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Cannot seek before stream start..
/// </summary>
internal static string Cannot_seek_before_start {
get {
return ResourceManager.GetString("Cannot_seek_before_start", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Cannot find file with hash {0} in the repository.
/// </summary>
internal static string CannotFindHashInRepository {
get {
return ResourceManager.GetString("CannotFindHashInRepository", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Cannot find lsar executable..
/// </summary>
internal static string CannotFindLsAr {
get {
return ResourceManager.GetString("CannotFindLsAr", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Cannot find unar executable at {0}..
/// </summary>
internal static string CannotFindUnArAtPath {
get {
return ResourceManager.GetString("CannotFindUnArAtPath", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Cannot find requested zip entry in hashes dictionary.
/// </summary>
internal static string CannotFindZipEntryInDictionary {
get {
return ResourceManager.GetString("CannotFindZipEntryInDictionary", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Cannot run lsar..
/// </summary>
internal static string CannotRunLsAr {
get {
return ResourceManager.GetString("CannotRunLsAr", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Cannot run unar..
/// </summary>
internal static string CannotRunUnAr {
get {
return ResourceManager.GetString("CannotRunUnAr", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Checking if file is an archive....
/// </summary>
internal static string CheckingIfFIleIsAnArchive {
get {
return ResourceManager.GetString("CheckingIfFIleIsAnArchive", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Compressing {0}....
/// </summary>
internal static string Compressing {
get {
return ResourceManager.GetString("Compressing", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Compressing DAT file....
/// </summary>
internal static string CompressingDatFile {
get {
return ResourceManager.GetString("CompressingDatFile", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Compressing file....
/// </summary>
internal static string CompressingFile {
get {
return ResourceManager.GetString("CompressingFile", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Could not find ROM set in database..
/// </summary>
internal static string CouldNotFindRomSetInDatabase {
get {
return ResourceManager.GetString("CouldNotFindRomSetInDatabase", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to File exists.
/// </summary>
internal static string DatabaseFileExistsMsgBoxTitle {
get {
return ResourceManager.GetString("DatabaseFileExistsMsgBoxTitle", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to DAT file is already in database, not importing duplicates..
/// </summary>
internal static string DatAlreadyInDatabase {
get {
return ResourceManager.GetString("DatAlreadyInDatabase", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Enumerating files....
/// </summary>
internal static string EnumeratingFiles {
get {
return ResourceManager.GetString("EnumeratingFiles", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Error: {0}.
/// </summary>
internal static string ErrorWithMessage {
get {
return ResourceManager.GetString("ErrorWithMessage", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Exporting ROMs....
/// </summary>
internal static string ExportingRoms {
get {
return ResourceManager.GetString("ExportingRoms", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Extracted contents.
/// </summary>
internal static string ExtractedContents {
get {
return ResourceManager.GetString("ExtractedContents", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Extracting archive contents....
/// </summary>
internal static string ExtractingArchive {
get {
return ResourceManager.GetString("ExtractingArchive", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Finished.
/// </summary>
internal static string Finished {
get {
return ResourceManager.GetString("Finished", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Finishing....
/// </summary>
internal static string Finishing {
get {
return ResourceManager.GetString("Finishing", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Found a ROM with an unknown machine, this should not happen..
/// </summary>
internal static string FoundRomWithoutMachine {
get {
return ResourceManager.GetString("FoundRomWithoutMachine", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Getting machine (game) names....
/// </summary>
internal static string GettingMachineNames {
get {
return ResourceManager.GetString("GettingMachineNames", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Hashing DAT file....
/// </summary>
internal static string HashingDatFile {
get {
return ResourceManager.GetString("HashingDatFile", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Hashing file....
/// </summary>
internal static string HashingFile {
get {
return ResourceManager.GetString("HashingFile", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Importing {0}....
/// </summary>
internal static string Importing {
get {
return ResourceManager.GetString("Importing", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Not yet implemented..
/// </summary>
internal static string Not_yet_implemented {
get {
return ResourceManager.GetString("Not_yet_implemented", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Not the correct lsar executable.
/// </summary>
internal static string NotCorrectLsAr {
get {
return ResourceManager.GetString("NotCorrectLsAr", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Not the correct unar executable.
/// </summary>
internal static string NotCorrectUnAr {
get {
return ResourceManager.GetString("NotCorrectUnAr", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to OK.
/// </summary>
internal static string OK {
get {
return ResourceManager.GetString("OK", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Parsing DAT file....
/// </summary>
internal static string ParsinDatFile {
get {
return ResourceManager.GetString("ParsinDatFile", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Removing temporary path....
/// </summary>
internal static string RemovingTemporaryPath {
get {
return ResourceManager.GetString("RemovingTemporaryPath", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Retrieving ROMs and disks....
/// </summary>
internal static string RetrievingRomsAndDisks {
get {
return ResourceManager.GetString("RetrievingRomsAndDisks", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Retrieving ROM set from database..
/// </summary>
internal static string RetrievingRomSetFromDatabase {
get {
return ResourceManager.GetString("RetrievingRomSetFromDatabase", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Saving changes to database....
/// </summary>
internal static string SavingChangesToDatabase {
get {
return ResourceManager.GetString("SavingChangesToDatabase", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to The input exceeds data types..
/// </summary>
internal static string Spamsum_Input_exceeds_data {
get {
return ResourceManager.GetString("Spamsum_Input_exceeds_data", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to SpamSum does not have a binary representation..
/// </summary>
internal static string Spamsum_no_binary {
get {
return ResourceManager.GetString("Spamsum_no_binary", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to unar path is not set..
/// </summary>
internal static string UnArPathNotSet {
get {
return ResourceManager.GetString("UnArPathNotSet", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Unhandled exception occurred..
/// </summary>
internal static string UnhandledException {
get {
return ResourceManager.GetString("UnhandledException", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Unhandled exception when importing file..
/// </summary>
internal static string UnhandledExceptionWhenImporting {
get {
return ResourceManager.GetString("UnhandledExceptionWhenImporting", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Unknown file..
/// </summary>
internal static string UnknownFile {
get {
return ResourceManager.GetString("UnknownFile", resourceCulture);
}
}
}
}

View File

@@ -0,0 +1,163 @@
<?xml version="1.0" encoding="utf-8" ?>
<root>
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:element name="root" msdata:IsDataSet="true"></xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>1.3</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="Base32_Not_enought_data" xml:space="preserve">
<value>Specified string is not valid Base32 format because it doesn't have enough data to construct a complete byte array</value>
</data>
<data name="Base32_Invalid_format" xml:space="preserve">
<value>Specified string is not valid Base32 format because character "{0}" does not exist in Base32 alphabet</value>
</data>
<data name="Cannot_seek_before_start" xml:space="preserve">
<value>Cannot seek before stream start.</value>
</data>
<data name="Cannot_seek_after_end" xml:space="preserve">
<value>Cannot seek after stream end.</value>
</data>
<data name="Spamsum_no_binary" xml:space="preserve">
<value>SpamSum does not have a binary representation.</value>
</data>
<data name="Assertion_failed" xml:space="preserve">
<value>Assertion failed</value>
</data>
<data name="Spamsum_Input_exceeds_data" xml:space="preserve">
<value>The input exceeds data types.</value>
</data>
<data name="Not_yet_implemented" xml:space="preserve">
<value>Not yet implemented.</value>
</data>
<data name="DatabaseFileExistsMsgBoxTitle" xml:space="preserve">
<value>File exists</value>
</data>
<data name="UnArPathNotSet" xml:space="preserve">
<value>unar path is not set.</value>
</data>
<data name="CannotFindUnArAtPath" xml:space="preserve">
<value>Cannot find unar executable at {0}.</value>
</data>
<data name="CannotFindLsAr" xml:space="preserve">
<value>Cannot find lsar executable.</value>
</data>
<data name="CannotRunUnAr" xml:space="preserve">
<value>Cannot run unar.</value>
</data>
<data name="CannotRunLsAr" xml:space="preserve">
<value>Cannot run lsar.</value>
</data>
<data name="NotCorrectUnAr" xml:space="preserve">
<value>Not the correct unar executable</value>
</data>
<data name="NotCorrectLsAr" xml:space="preserve">
<value>Not the correct lsar executable</value>
</data>
<data name="ParsinDatFile" xml:space="preserve">
<value>Parsing DAT file...</value>
</data>
<data name="HashingDatFile" xml:space="preserve">
<value>Hashing DAT file...</value>
</data>
<data name="DatAlreadyInDatabase" xml:space="preserve">
<value>DAT file is already in database, not importing duplicates.</value>
</data>
<data name="AddingDatToDatabase" xml:space="preserve">
<value>Adding DAT to database...</value>
</data>
<data name="CompressingDatFile" xml:space="preserve">
<value>Compressing DAT file...</value>
</data>
<data name="GettingMachineNames" xml:space="preserve">
<value>Getting machine (game) names...</value>
</data>
<data name="AddingMachines" xml:space="preserve">
<value>Adding machines (games)...</value>
</data>
<data name="SavingChangesToDatabase" xml:space="preserve">
<value>Saving changes to database...</value>
</data>
<data name="RetrievingRomsAndDisks" xml:space="preserve">
<value>Retrieving ROMs and disks...</value>
</data>
<data name="AddingRoms" xml:space="preserve">
<value>Adding ROMs...</value>
</data>
<data name="FoundRomWithoutMachine" xml:space="preserve">
<value>Found a ROM with an unknown machine, this should not happen.</value>
</data>
<data name="UnhandledException" xml:space="preserve">
<value>Unhandled exception occurred.</value>
</data>
<data name="RetrievingRomSetFromDatabase" xml:space="preserve">
<value>Retrieving ROM set from database.</value>
</data>
<data name="CouldNotFindRomSetInDatabase" xml:space="preserve">
<value>Could not find ROM set in database.</value>
</data>
<data name="ExportingRoms" xml:space="preserve">
<value>Exporting ROMs...</value>
</data>
<data name="Finished" xml:space="preserve">
<value>Finished</value>
</data>
<data name="CannotFindZipEntryInDictionary" xml:space="preserve">
<value>Cannot find requested zip entry in hashes dictionary</value>
</data>
<data name="CannotFindHashInRepository" xml:space="preserve">
<value>Cannot find file with hash {0} in the repository</value>
</data>
<data name="Compressing" xml:space="preserve">
<value>Compressing {0}...</value>
</data>
<data name="EnumeratingFiles" xml:space="preserve">
<value>Enumerating files...</value>
</data>
<data name="Importing" xml:space="preserve">
<value>Importing {0}...</value>
</data>
<data name="CheckingIfFIleIsAnArchive" xml:space="preserve">
<value>Checking if file is an archive...</value>
</data>
<data name="OK" xml:space="preserve">
<value>OK</value>
</data>
<data name="ErrorWithMessage" xml:space="preserve">
<value>Error: {0}</value>
</data>
<data name="ExtractingArchive" xml:space="preserve">
<value>Extracting archive contents...</value>
</data>
<data name="RemovingTemporaryPath" xml:space="preserve">
<value>Removing temporary path...</value>
</data>
<data name="ExtractedContents" xml:space="preserve">
<value>Extracted contents</value>
</data>
<data name="HashingFile" xml:space="preserve">
<value>Hashing file...</value>
</data>
<data name="UnknownFile" xml:space="preserve">
<value>Unknown file.</value>
</data>
<data name="CompressingFile" xml:space="preserve">
<value>Compressing file...</value>
</data>
<data name="Finishing" xml:space="preserve">
<value>Finishing...</value>
</data>
<data name="UnhandledExceptionWhenImporting" xml:space="preserve">
<value>Unhandled exception when importing file.</value>
</data>
</root>

View File

@@ -2,6 +2,7 @@
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<NeutralLanguage>en</NeutralLanguage>
</PropertyGroup>
<ItemGroup>
@@ -17,4 +18,19 @@
<ProjectReference Include="..\SabreTools\SabreTools.Library\SabreTools.Library.csproj" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Update="Resources\Localization.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Localization.Designer.cs</LastGenOutput>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<Compile Update="Resources\Localization.Designer.cs">
<DesignTime>True</DesignTime>
<AutoGen>True</AutoGen>
<DependentUpon>Language.resx</DependentUpon>
</Compile>
</ItemGroup>
</Project>

View File

@@ -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;

View File

@@ -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<string> 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<Rom> roms = new List<Rom>();
@@ -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
});
}
}

View File

@@ -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

View File

@@ -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
{

View File

@@ -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);

View File

@@ -0,0 +1,54 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
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);
}
}
}
}

View File

@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8" ?>
<root>
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:element name="root" msdata:IsDataSet="true"></xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>1.3</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="Settings_not_initialized" xml:space="preserve">
<value>Settings are not initialized!</value>
</data>
</root>

View File

@@ -23,4 +23,19 @@
<ProjectReference Include="..\RomRepoMgr.Settings\RomRepoMgr.Settings.csproj" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Update="Resources\Localization.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Localization.Designer.cs</LastGenOutput>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<Compile Update="Resources\Localization.Designer.cs">
<DesignTime>True</DesignTime>
<AutoGen>True</AutoGen>
<DependentUpon>Language.resx</DependentUpon>
</Compile>
</ItemGroup>
</Project>

View File

@@ -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);

View File

@@ -0,0 +1,54 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
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);
}
}
}
}

View File

@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8" ?>
<root>
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:element name="root" msdata:IsDataSet="true"></xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>1.3</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="Unhandled_exception_uname" xml:space="preserve">
<value>Unhandled exception calling uname: {0}</value>
</data>
</root>

View File

@@ -9,4 +9,19 @@
<PackageReference Include="plist-cil" Version="2.1.0" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Update="Resources\Localization.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Localization.Designer.cs</LastGenOutput>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<Compile Update="Resources\Localization.Designer.cs">
<DesignTime>True</DesignTime>
<AutoGen>True</AutoGen>
<DependentUpon>Localization.resx</DependentUpon>
</Compile>
</ItemGroup>
</Project>

View File

@@ -1,5 +1,10 @@
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<s:Boolean x:Key="/Default/UserDictionary/Words/=Aaru/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=datfiles/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=lsar/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=romrepo/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=romrepombgrfs/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=unar/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=xattr/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=xattrs/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>
<s:Boolean x:Key="/Default/UserDictionary/Words/=xattrs/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=_0020_007B_000A_0020_0020_0020_0020/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,349 @@
<?xml version="1.0" encoding="utf-8" ?>
<root>
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:element name="root" msdata:IsDataSet="true"></xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>1.3</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="FileMenuText" xml:space="preserve">
<value>_File</value>
</data>
<data name="RomSets" xml:space="preserve">
<value>ROM sets</value>
</data>
<data name="RomSetNameLabel" xml:space="preserve">
<value>Name</value>
</data>
<data name="RomSetVersionLabel" xml:space="preserve">
<value>Version</value>
</data>
<data name="RomSetAuthorLabel" xml:space="preserve">
<value>Author</value>
</data>
<data name="RomSetDateLabel" xml:space="preserve">
<value>Date</value>
</data>
<data name="RomSetDescriptionLabel" xml:space="preserve">
<value>Description</value>
</data>
<data name="RomSetCommentLabel" xml:space="preserve">
<value>Comment</value>
</data>
<data name="RomSetTotalMachinesLabel" xml:space="preserve">
<value>Games</value>
</data>
<data name="RomSetCompleteMachinesLabel" xml:space="preserve">
<value>Complete</value>
</data>
<data name="RomSetIncompleteMachinesLabel" xml:space="preserve">
<value>Incomplete</value>
</data>
<data name="RomSetTotalRomsLabel" xml:space="preserve">
<value>ROMs</value>
</data>
<data name="RomSetHaveRomsLabel" xml:space="preserve">
<value>Have</value>
</data>
<data name="RomSetMissRomsLabel" xml:space="preserve">
<value>Miss</value>
</data>
<data name="FileMenuImportDatFileText" xml:space="preserve">
<value>Import DAT _file</value>
</data>
<data name="FileMenuImportDatFolderText" xml:space="preserve">
<value>Import DAT f_older</value>
</data>
<data name="FileMenuSettingsText" xml:space="preserve">
<value>_Settings</value>
</data>
<data name="FileMenuExitText" xml:space="preserve">
<value>E_xit</value>
</data>
<data name="FilesystemMenuText" xml:space="preserve">
<value>File_system</value>
</data>
<data name="FilesystemMenuMountText" xml:space="preserve">
<value>_Mount</value>
</data>
<data name="RomsMenuText" xml:space="preserve">
<value>_ROMs</value>
</data>
<data name="RomsMenuImportText" xml:space="preserve">
<value>_Import folder</value>
</data>
<data name="RomSetsMenuText" xml:space="preserve">
<value>ROM _sets</value>
</data>
<data name="RomSetsMenuSaveRomsText" xml:space="preserve">
<value>_Save ROMs to folder</value>
</data>
<data name="RomSetsMenuSaveDatText" xml:space="preserve">
<value>Save DAT _file</value>
</data>
<data name="RomSetsMenuEditText" xml:space="preserve">
<value>_Edit</value>
</data>
<data name="RomSetsMenuDeleteText" xml:space="preserve">
<value>_Delete</value>
</data>
<data name="HelpMenuText" xml:space="preserve">
<value>_Help</value>
</data>
<data name="HelpMenuAboutText" xml:space="preserve">
<value>_About</value>
</data>
<data name="AboutLabel" xml:space="preserve">
<value>About</value>
</data>
<data name="LibrariesLabel" xml:space="preserve">
<value>Libraries</value>
</data>
<data name="AuthorsLabel" xml:space="preserve">
<value>Authors</value>
</data>
<data name="AboutTitle" xml:space="preserve">
<value>About ROM Repository Manager</value>
</data>
<data name="LicenseLabel" xml:space="preserve">
<value>License: GNU General Public License Version 3</value>
</data>
<data name="CloseLabel" xml:space="preserve">
<value>Close</value>
</data>
<data name="AssembliesLibraryText" xml:space="preserve">
<value>Library</value>
</data>
<data name="AssembliesVersionText" xml:space="preserve">
<value>Version</value>
</data>
<data name="AuthorsText" xml:space="preserve">
<value>Developers:
Natalia Portillo
</value>
</data>
<data name="HomepageLabel" xml:space="preserve">
<value>Homepage</value>
</data>
<data name="TotalMachinesLabel" xml:space="preserve">
<value>Total games</value>
</data>
<data name="CompleteMachinesLabel" xml:space="preserve">
<value>Complete games</value>
</data>
<data name="IncompleteMachinesLabel" xml:space="preserve">
<value>Incomplete games</value>
</data>
<data name="TotalRomsLabel" xml:space="preserve">
<value>Total ROMs</value>
</data>
<data name="HaveRomsLabel" xml:space="preserve">
<value>Have ROMs</value>
</data>
<data name="MissRomsLabel" xml:space="preserve">
<value>Missing ROMs</value>
</data>
<data name="EditDatTitle" xml:space="preserve">
<value>Edit DAT</value>
</data>
<data name="SaveLabel" xml:space="preserve">
<value>Save</value>
</data>
<data name="CancelLabel" xml:space="preserve">
<value>Cancel</value>
</data>
<data name="ExportDatTitle" xml:space="preserve">
<value>Exporting DAT file...</value>
</data>
<data name="DecompressingDat" xml:space="preserve">
<value>Decompressing DAT file...</value>
</data>
<data name="Finished" xml:space="preserve">
<value>Finished</value>
</data>
<data name="ExportRomsTitle" xml:space="preserve">
<value>Exporting ROM files to folder...</value>
</data>
<data name="PathLabel" xml:space="preserve">
<value>Path:</value>
</data>
<data name="AllFilesLabel" xml:space="preserve">
<value>Check all files.</value>
</data>
<data name="RecursiveLabel" xml:space="preserve">
<value>Recurse subfolders.</value>
</data>
<data name="ImportDatFolderTitle" xml:space="preserve">
<value>Import DAT files from folder...</value>
</data>
<data name="ResultFilenameLabel" xml:space="preserve">
<value>Filename</value>
</data>
<data name="ResultStatusLabel" xml:space="preserve">
<value>Status</value>
</data>
<data name="StartLabel" xml:space="preserve">
<value>Start</value>
</data>
<data name="SearchingForFiles" xml:space="preserve">
<value>Searching for files...</value>
</data>
<data name="FoundFiles" xml:space="preserve">
<value>Found {0} files...</value>
</data>
<data name="ImportingItem" xml:space="preserve">
<value>Importing {0}...</value>
</data>
<data name="OK" xml:space="preserve">
<value>OK</value>
</data>
<data name="ImportDatTitle" xml:space="preserve">
<value>Importing DAT file...</value>
</data>
<data name="RemoveFilesLabel" xml:space="preserve">
<value>Remove files after import successful.</value>
</data>
<data name="KnownOnlyLabel" xml:space="preserve">
<value>Only import known files.</value>
</data>
<data name="RecurseArchivesLabel" xml:space="preserve">
<value>Try to detect archives and import their contents.</value>
</data>
<data name="ImportRomFolderTitle" xml:space="preserve">
<value>Import ROM files from folder...</value>
</data>
<data name="RemoveDatTitle" xml:space="preserve">
<value>Removing ROM set...</value>
</data>
<data name="RetrievingRomSetFromDatabase" xml:space="preserve">
<value>Retrieving ROM set from database...</value>
</data>
<data name="RemovingRomSetFromDatabase" xml:space="preserve">
<value>Removing ROM set from database...</value>
</data>
<data name="SavingChangesToDatabase" xml:space="preserve">
<value>Saving changes to database...</value>
</data>
<data name="RemovingDatFileFromRepo" xml:space="preserve">
<value>Removing DAT file from repo...</value>
</data>
<data name="ChooseLabel" xml:space="preserve">
<value>Choose...</value>
</data>
<data name="SettingsTitle" xml:space="preserve">
<value>Settings</value>
</data>
<data name="DatabaseFileLabel" xml:space="preserve">
<value>Database file</value>
</data>
<data name="RepositoryFolderLabel" xml:space="preserve">
<value>Repository folder</value>
</data>
<data name="TemporaryFolderLabel" xml:space="preserve">
<value>Temporary folder</value>
</data>
<data name="UnArPathLabel" xml:space="preserve">
<value>Path to UnAr</value>
</data>
<data name="Error" xml:space="preserve">
<value>Error</value>
</data>
<data name="TheUnarchiverVersionLabel" xml:space="preserve">
<value>The Unarchiver version {0}</value>
</data>
<data name="ChooseUnArExecutable" xml:space="preserve">
<value>Choose UnArchiver executable</value>
</data>
<data name="ChooseTemporaryFolder" xml:space="preserve">
<value>Choose temporary folder</value>
</data>
<data name="ChooseRepositoryFolder" xml:space="preserve">
<value>Choose repository folder</value>
</data>
<data name="ChooseDatabaseFile" xml:space="preserve">
<value>Choose database to open / create</value>
</data>
<data name="DatabaseFileMsgBoxTryOpen" xml:space="preserve">
<value>Do you want to try to open the existing file as a database?</value>
</data>
<data name="DatabaseFileTryOpenCaption" xml:space="preserve">
<value>Do you want to try to open the existing file as a database?</value>
</data>
<data name="DatabaseFileExistsMsgBoxTitle" xml:space="preserve">
<value>File exists</value>
</data>
<data name="DatabaseFileUnusableMsgBoxTitle" xml:space="preserve">
<value>Could not use database</value>
</data>
<data name="DatabaseFileUnusableDeleteMsgBoxCaption" xml:space="preserve">
<value>An error occurred trying to use the chosen file as a database.
Do you want to delete the file?</value>
</data>
<data name="DatabaseFileUnusableMsgBoxCaption" xml:space="preserve">
<value>An error occurred trying to use the chosen file as a database.</value>
</data>
<data name="DatabaseFileDeleteCaption" xml:space="preserve">
<value>Do you want to delete the file?</value>
</data>
<data name="DatabaseFileCannotDeleteTitle" xml:space="preserve">
<value>Could not delete file</value>
</data>
<data name="DatabaseFileCannotDeleteCaption" xml:space="preserve">
<value>An error occurred trying to delete the chosen.</value>
</data>
<data name="ImportDatFileDialogTitle" xml:space="preserve">
<value>Import DAT file...</value>
</data>
<data name="DatFilesDialogLabel" xml:space="preserve">
<value>DAT files</value>
</data>
<data name="AllFilesDialogLabel" xml:space="preserve">
<value>All files</value>
</data>
<data name="ImportDatFolderDialogTitle" xml:space="preserve">
<value>Import DATs from folder...</value>
</data>
<data name="ImportRomsFolderDialogTitle" xml:space="preserve">
<value>Import ROMs from folder...</value>
</data>
<data name="DeleteRomSetMsgBoxTitle" xml:space="preserve">
<value>Delete ROM set</value>
</data>
<data name="DeleteRomSetMsgBoxCaption" xml:space="preserve">
<value>Are you sure you want to delete the ROM set {0}?</value>
</data>
<data name="ExportRomsDialogTitle" xml:space="preserve">
<value>Export ROMs to folder...</value>
</data>
<data name="SelectMountPointDialogTitle" xml:space="preserve">
<value>Select mount point...</value>
</data>
<data name="LoadingSettingsText" xml:space="preserve">
<value>Loading settings...</value>
</data>
<data name="CheckingUnArText" xml:space="preserve">
<value>Checking The Unarchiver...</value>
</data>
<data name="LoadingDatabaseText" xml:space="preserve">
<value>Loading database...</value>
</data>
<data name="MigratingDatabaseText" xml:space="preserve">
<value>Migrating database...</value>
</data>
<data name="LoadingRomSetsText" xml:space="preserve">
<value>Loading ROM sets...</value>
</data>
<data name="ExitButtonText" xml:space="preserve">
<value>Exit</value>
</data>
</root>

View File

@@ -11,6 +11,11 @@
<SubType>Designer</SubType>
</AvaloniaResource>
<AvaloniaResource Include="Assets\**" />
<Compile Update="Resources\Localization.Designer.cs">
<DesignTime>True</DesignTime>
<AutoGen>True</AutoGen>
<DependentUpon>Localization.resx</DependentUpon>
</Compile>
</ItemGroup>
<ItemGroup>
<PackageReference Include="Avalonia" Version="0.10.0-preview3" />
@@ -26,4 +31,10 @@
<ProjectReference Include="..\RomRepoMgr.Settings\RomRepoMgr.Settings.csproj" />
<ProjectReference Include="..\RomRepoMgr.Core\RomRepoMgr.Core.csproj" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Update="Resources\Localization.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Localization.Designer.cs</LastGenOutput>
</EmbeddedResource>
</ItemGroup>
</Project>

View File

@@ -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<Unit, Unit> WebsiteCommand { get; }
public ReactiveCommand<Unit, Unit> LicenseCommand { get; }
public ReactiveCommand<Unit, Unit> CloseCommand { get; }

View File

@@ -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<Unit, Unit> SaveCommand { get; }
public ReactiveCommand<Unit, Unit> CancelCommand { get; }

View File

@@ -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<Unit, Unit> 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));
}
}
}

View File

@@ -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
{

View File

@@ -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<ImportDatFolderItem> 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++;

View File

@@ -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<Unit, Unit> CloseCommand { get; }
void OnWorkerOnWorkFinished(object sender, EventArgs args) => Dispatcher.UIThread.Post(() =>
{
StatusMessage = "Finished";
StatusMessage = Localization.Finished;
ProgressVisible = false;
CanClose = true;
});

View File

@@ -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<ImportRomItem> 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;
});

View File

@@ -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<RomSetModel>(romSets);
}
public ObservableCollection<RomSetModel> 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<RomSetModel> 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);

View File

@@ -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;

View File

@@ -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<Unit, Unit> UnArCommand { get; }
public ReactiveCommand<Unit, Unit> 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;
}

View File

@@ -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<Unit, Unit> 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;

View File

@@ -8,30 +8,37 @@
</Design.DataContext>
<DockPanel>
<Menu DockPanel.Dock="Top">
<MenuItem Header="_File">
<MenuItem Header="_Import DAT file" Command="{Binding ImportDatCommand}" /> <Separator />
<MenuItem Header="_Import DAT folder" Command="{Binding ImportDatFolderCommand}" /> <Separator />
<MenuItem Header="_Settings" IsVisible="{Binding !NativeMenuSupported}"
<MenuItem Header="{Binding FileMenuText}">
<MenuItem Header="{Binding FileMenuImportDatFileText}" Command="{Binding ImportDatCommand}" />
<Separator />
<MenuItem Header="{Binding FileMenuImportDatFolderText}" Command="{Binding ImportDatFolderCommand}" />
<Separator />
<MenuItem Header="{Binding FileMenuSettingsText}" IsVisible="{Binding !NativeMenuSupported}"
Command="{Binding SettingsCommand}" />
<Separator />
<MenuItem Header="E_xit" IsVisible="{Binding !NativeMenuSupported}" Command="{Binding ExitCommand}" />
<MenuItem Header="{Binding FileMenuExitText}" IsVisible="{Binding !NativeMenuSupported}"
Command="{Binding ExitCommand}" />
</MenuItem>
<MenuItem Header="File_system" IsEnabled="{Binding IsVfsAvailable}">
<MenuItem Header="_Mount" Command="{Binding MountCommand}" /> <Separator />
<MenuItem Header="{Binding FilesystemMenuText}" IsEnabled="{Binding IsVfsAvailable}">
<MenuItem Header="{Binding FilesystemMenuMountText}" Command="{Binding MountCommand}" /> <Separator />
</MenuItem>
<MenuItem Header="_ROMs">
<MenuItem Header="_Import folder" Command="{Binding ImportRomFolderCommand}" /> <Separator />
<MenuItem Header="{Binding RomsMenuText}">
<MenuItem Header="{Binding RomsMenuImportText}" Command="{Binding ImportRomFolderCommand}" />
<Separator />
</MenuItem>
<MenuItem Header="ROM _sets"
<MenuItem Header="{Binding RomSetsMenuText}"
IsEnabled="{Binding SelectedRomSet, Converter={x:Static ObjectConverters.IsNotNull}}">
<MenuItem Header="_Save ROMs to folder" Command="{Binding ExportRomsCommand}" /> <Separator />
<MenuItem Header="_Save DAT file" Command="{Binding ExportDatCommand}" /> <Separator />
<MenuItem Header="_Edit" Command="{Binding EditRomSetCommand}" /> <Separator />
<MenuItem Header="_Delete" Command="{Binding DeleteRomSetCommand}" /> <Separator />
<MenuItem Header="{Binding RomSetsMenuSaveRomsText}" Command="{Binding ExportRomsCommand}" />
<Separator />
<MenuItem Header="{Binding RomSetsMenuSaveDatText}" Command="{Binding ExportDatCommand}" />
<Separator /> <MenuItem Header="{Binding RomSetsMenuEditText}" Command="{Binding EditRomSetCommand}" />
<Separator />
<MenuItem Header="{Binding RomSetsMenuDeleteText}" Command="{Binding DeleteRomSetCommand}" />
<Separator />
</MenuItem>
<MenuItem Header="_Help">
<MenuItem Header="_About" Name="AboutMenuItem" IsVisible="{Binding !NativeMenuSupported}"
Command="{Binding AboutCommand}" />
<MenuItem Header="{Binding HelpMenuText}">
<MenuItem Header="{Binding HelpMenuAboutText}" Name="AboutMenuItem"
IsVisible="{Binding !NativeMenuSupported}" Command="{Binding AboutCommand}" />
</MenuItem>
</Menu>
<TabControl HorizontalAlignment="Stretch" VerticalAlignment="Stretch">