diff --git a/SabreTools.Library/DatFiles/DatFile.cs b/SabreTools.Library/DatFiles/DatFile.cs index 77cdcac1..fb38df15 100644 --- a/SabreTools.Library/DatFiles/DatFile.cs +++ b/SabreTools.Library/DatFiles/DatFile.cs @@ -3495,7 +3495,7 @@ namespace SabreTools.Library.DatFiles Items.BucketBy(Field.Machine_Name, DedupeType.None, norename: norename); // Output the number of items we're going to be writing - Globals.Logger.User($"A total of {Items.TotalCount} items will be written out to '{Header.FileName}'"); + Globals.Logger.User($"A total of {Items.TotalCount - Items.RemovedCount} items will be written out to '{Header.FileName}'"); // Get the outfile names Dictionary outfiles = Header.CreateOutFileNames(outDir, overwrite); diff --git a/SabreTools.Library/DatFiles/ItemDictionary.cs b/SabreTools.Library/DatFiles/ItemDictionary.cs index 7f3a6c31..262f0bb6 100644 --- a/SabreTools.Library/DatFiles/ItemDictionary.cs +++ b/SabreTools.Library/DatFiles/ItemDictionary.cs @@ -199,6 +199,12 @@ namespace SabreTools.Library.DatFiles [JsonIgnore] public long NodumpCount { get; private set; } = 0; + /// + /// Number of items with the remove flag + /// + [JsonIgnore] + public long RemovedCount { get; private set; } = 0; + /// /// Number of items with the verified status /// @@ -233,6 +239,7 @@ namespace SabreTools.Library.DatFiles } set { + Remove(key); AddRange(key, value); } } @@ -434,23 +441,27 @@ namespace SabreTools.Library.DatFiles /// Item to add info from private void AddItemStatistics(DatItem item) { - // No matter what the item is, we increate the count - TotalCount += 1; + // No matter what the item is, we increment the count + TotalCount++; + + // Increment removal count + if (item.Remove) + RemovedCount++; // Now we do different things for each item type switch (item.ItemType) { case ItemType.Archive: - ArchiveCount += 1; + ArchiveCount++; break; case ItemType.BiosSet: - BiosSetCount += 1; + BiosSetCount++; break; case ItemType.Chip: - ChipCount += 1; + ChipCount++; break; case ItemType.Disk: - DiskCount += 1; + DiskCount++; if ((item as Disk).ItemStatus != ItemStatus.Nodump) { MD5Count += (string.IsNullOrWhiteSpace((item as Disk).MD5) ? 0 : 1); @@ -463,16 +474,16 @@ namespace SabreTools.Library.DatFiles VerifiedCount += ((item as Disk).ItemStatus == ItemStatus.Verified ? 1 : 0); break; case ItemType.Media: - MediaCount += 1; + MediaCount++; MD5Count += (string.IsNullOrWhiteSpace((item as Media).MD5) ? 0 : 1); SHA1Count += (string.IsNullOrWhiteSpace((item as Media).SHA1) ? 0 : 1); SHA256Count += (string.IsNullOrWhiteSpace((item as Media).SHA256) ? 0 : 1); break; case ItemType.Release: - ReleaseCount += 1; + ReleaseCount++; break; case ItemType.Rom: - RomCount += 1; + RomCount++; if ((item as Rom).ItemStatus != ItemStatus.Nodump) { TotalSize += (item as Rom).Size; @@ -493,7 +504,7 @@ namespace SabreTools.Library.DatFiles VerifiedCount += ((item as Rom).ItemStatus == ItemStatus.Verified ? 1 : 0); break; case ItemType.Sample: - SampleCount += 1; + SampleCount++; break; } } @@ -534,6 +545,7 @@ namespace SabreTools.Library.DatFiles BaddumpCount += stats.BaddumpCount; GoodCount += stats.GoodCount; NodumpCount += stats.NodumpCount; + RemovedCount += stats.RemovedCount; VerifiedCount += stats.VerifiedCount; } @@ -558,24 +570,27 @@ namespace SabreTools.Library.DatFiles if (item == null) return; - // No matter what the item is, we increate the count - TotalCount -= 1; + // No matter what the item is, we decrease the count + TotalCount--; + + // Decrement removal count + if (item.Remove) + RemovedCount--; // Now we do different things for each item type - switch (item.ItemType) { case ItemType.Archive: - ArchiveCount -= 1; + ArchiveCount--; break; case ItemType.BiosSet: - BiosSetCount -= 1; + BiosSetCount--; break; case ItemType.Chip: - ChipCount -= 1; + ChipCount--; break; case ItemType.Disk: - DiskCount -= 1; + DiskCount--; if ((item as Disk).ItemStatus != ItemStatus.Nodump) { MD5Count -= (string.IsNullOrWhiteSpace((item as Disk).MD5) ? 0 : 1); @@ -588,16 +603,16 @@ namespace SabreTools.Library.DatFiles VerifiedCount -= ((item as Disk).ItemStatus == ItemStatus.Verified ? 1 : 0); break; case ItemType.Media: - MediaCount -= 1; + MediaCount--; MD5Count -= (string.IsNullOrWhiteSpace((item as Media).MD5) ? 0 : 1); SHA1Count -= (string.IsNullOrWhiteSpace((item as Media).SHA1) ? 0 : 1); SHA256Count -= (string.IsNullOrWhiteSpace((item as Media).SHA256) ? 0 : 1); break; case ItemType.Release: - ReleaseCount -= 1; + ReleaseCount--; break; case ItemType.Rom: - RomCount -= 1; + RomCount--; if ((item as Rom).ItemStatus != ItemStatus.Nodump) { TotalSize -= (item as Rom).Size; @@ -618,7 +633,7 @@ namespace SabreTools.Library.DatFiles VerifiedCount -= ((item as Rom).ItemStatus == ItemStatus.Verified ? 1 : 0); break; case ItemType.Sample: - SampleCount -= 1; + SampleCount--; break; } } @@ -864,14 +879,14 @@ namespace SabreTools.Library.DatFiles return; // Loop through and add - Parallel.ForEach(items.Keys, Globals.ParallelOptions, key => + foreach (string key in items.Keys) { List datItems = items[key]; foreach (DatItem item in datItems) { AddItemStatistics(item); } - }); + } } /// @@ -943,6 +958,7 @@ namespace SabreTools.Library.DatFiles BaddumpCount = 0; GoodCount = 0; NodumpCount = 0; + RemovedCount = 0; VerifiedCount = 0; }