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

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