mirror of
https://github.com/claunia/romrepomgr.git
synced 2025-12-16 11:14:45 +00:00
Do not import files that are already in the repository.
This commit is contained in:
@@ -327,6 +327,9 @@ public partial class ImportRoms : ComponentBase
|
||||
|
||||
if(!archiveImporter.IsCrcInDb(reader.Entry.Crc) && KnownOnlyChecked) continue;
|
||||
|
||||
// Do not import files that are already in the repository
|
||||
if(archiveImporter.IsInRepo(reader.Entry.Crc)) continue;
|
||||
|
||||
var worker = new FileImporter(_ctx,
|
||||
_newFiles,
|
||||
_newDisks,
|
||||
|
||||
@@ -556,6 +556,14 @@ public sealed class FileImporter
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsInRepo(long crc32)
|
||||
{
|
||||
lock(DbLock)
|
||||
{
|
||||
return _ctx.Files.Any(f => f.Crc32 == crc32.ToString("x8") && f.IsInRepo);
|
||||
}
|
||||
}
|
||||
|
||||
public void ImportAndHashRom(Stream stream, string filename, string tempPath, long size)
|
||||
{
|
||||
try
|
||||
|
||||
@@ -410,6 +410,9 @@ public sealed partial class ImportRomFolderViewModel : ViewModelBase
|
||||
|
||||
if(!archiveImporter.IsCrcInDb(reader.Entry.Crc) && KnownOnlyChecked) continue;
|
||||
|
||||
// Do not import files that are already in the repository
|
||||
if(archiveImporter.IsInRepo(reader.Entry.Crc)) continue;
|
||||
|
||||
var model = new RomImporter
|
||||
{
|
||||
Filename = Path.GetFileName(reader.Entry.Key),
|
||||
|
||||
Reference in New Issue
Block a user