From f6500da3ffd9ba5f458da58f5869b52488402012 Mon Sep 17 00:00:00 2001 From: Natalia Portillo Date: Thu, 31 Jul 2025 04:22:53 +0100 Subject: [PATCH] [App] Be more verbose about what is happening when a file is not imported because not known, or duplicate. --- RomRepoMgr/Program.cs | 9 +++-- RomRepoMgr/Resources/Localization.Designer.cs | 12 +++++++ RomRepoMgr/Resources/Localization.es.resx | 6 ++++ RomRepoMgr/Resources/Localization.resx | 6 ++++ .../ViewModels/ImportRomFolderViewModel.cs | 33 +++++++++++++++++-- 5 files changed, 58 insertions(+), 8 deletions(-) diff --git a/RomRepoMgr/Program.cs b/RomRepoMgr/Program.cs index 55106d3..88dcd4e 100644 --- a/RomRepoMgr/Program.cs +++ b/RomRepoMgr/Program.cs @@ -66,10 +66,9 @@ internal static class Program public static AppBuilder BuildAvaloniaApp() => AppBuilder.Configure() .UsePlatformDetect() -//#if DEBUG -// .LogToSerilog(LogEventLevel.Debug); -//#else +#if DEBUG + .LogToSerilog(LogEventLevel.Debug); +#else .LogToSerilog(LogEventLevel.Information); - -//#endif +#endif } \ No newline at end of file diff --git a/RomRepoMgr/Resources/Localization.Designer.cs b/RomRepoMgr/Resources/Localization.Designer.cs index 8aa4db1..58bd228 100644 --- a/RomRepoMgr/Resources/Localization.Designer.cs +++ b/RomRepoMgr/Resources/Localization.Designer.cs @@ -794,5 +794,17 @@ namespace RomRepoMgr.Resources { return ResourceManager.GetString("ErrorProcessingArchive", resourceCulture); } } + + public static string UnknownFile { + get { + return ResourceManager.GetString("UnknownFile", resourceCulture); + } + } + + public static string FileAlreadyInRepository { + get { + return ResourceManager.GetString("FileAlreadyInRepository", resourceCulture); + } + } } } diff --git a/RomRepoMgr/Resources/Localization.es.resx b/RomRepoMgr/Resources/Localization.es.resx index a5ee519..459ac72 100644 --- a/RomRepoMgr/Resources/Localization.es.resx +++ b/RomRepoMgr/Resources/Localization.es.resx @@ -393,4 +393,10 @@ TardarĂ¡ mucho tiempo... Error procesando archivo. + + Fichero desconocido. + + + Fichero ya en el repositorio. + \ No newline at end of file diff --git a/RomRepoMgr/Resources/Localization.resx b/RomRepoMgr/Resources/Localization.resx index c97bb5b..023e7fc 100644 --- a/RomRepoMgr/Resources/Localization.resx +++ b/RomRepoMgr/Resources/Localization.resx @@ -401,4 +401,10 @@ This will take a long time... Error processing archive. + + Unknown file. + + + File already in repository. + \ No newline at end of file diff --git a/RomRepoMgr/ViewModels/ImportRomFolderViewModel.cs b/RomRepoMgr/ViewModels/ImportRomFolderViewModel.cs index 910fab2..2198438 100644 --- a/RomRepoMgr/ViewModels/ImportRomFolderViewModel.cs +++ b/RomRepoMgr/ViewModels/ImportRomFolderViewModel.cs @@ -404,14 +404,41 @@ public sealed partial class ImportRomFolderViewModel : ViewModelBase // Process files in archive while(reader.MoveToNextEntry()) { + string filename = Path.GetFileName(reader.Entry.Key); + if(reader.Entry.IsDirectory) continue; - if(reader.Entry.Crc == 0 && KnownOnlyChecked) continue; + if(reader.Entry.Crc == 0 && KnownOnlyChecked || + !archiveImporter.IsCrcInDb(reader.Entry.Crc) && KnownOnlyChecked) + { + Dispatcher.UIThread.Post(() => Importers.Add(new RomImporter + { + Filename = filename, + Indeterminate = false, + Progress = 1, + Maximum = 1, + Minimum = 0, + StatusMessage = Localization.UnknownFile + })); - if(!archiveImporter.IsCrcInDb(reader.Entry.Crc) && KnownOnlyChecked) continue; + continue; + } // Do not import files that are already in the repository - if(archiveImporter.IsInRepo(reader.Entry.Crc)) continue; + if(archiveImporter.IsInRepo(reader.Entry.Crc)) + { + Dispatcher.UIThread.Post(() => Importers.Add(new RomImporter + { + Filename = filename, + Indeterminate = false, + Progress = 1, + Maximum = 1, + Minimum = 0, + StatusMessage = Localization.FileAlreadyInRepository + })); + + continue; + } var model = new RomImporter {