diff --git a/SabreTools.DatFiles/ItemDictionary.cs b/SabreTools.DatFiles/ItemDictionary.cs index 54994f95..47c53fc4 100644 --- a/SabreTools.DatFiles/ItemDictionary.cs +++ b/SabreTools.DatFiles/ItemDictionary.cs @@ -118,46 +118,10 @@ namespace SabreTools.DatFiles public long TotalSize { get; private set; } = 0; /// - /// Number of items with a CRC hash + /// Number of hashes for each hash type /// [JsonIgnore, XmlIgnore] - public long CRCCount { get; private set; } = 0; - - /// - /// Number of items with an MD5 hash - /// - [JsonIgnore, XmlIgnore] - public long MD5Count { get; private set; } = 0; - - /// - /// Number of items with a SHA-1 hash - /// - [JsonIgnore, XmlIgnore] - public long SHA1Count { get; private set; } = 0; - - /// - /// Number of items with a SHA-256 hash - /// - [JsonIgnore, XmlIgnore] - public long SHA256Count { get; private set; } = 0; - - /// - /// Number of items with a SHA-384 hash - /// - [JsonIgnore, XmlIgnore] - public long SHA384Count { get; private set; } = 0; - - /// - /// Number of items with a SHA-512 hash - /// - [JsonIgnore, XmlIgnore] - public long SHA512Count { get; private set; } = 0; - - /// - /// Number of items with a SpamSum fuzzy hash - /// - [JsonIgnore, XmlIgnore] - public long SpamSumCount { get; private set; } = 0; + public Dictionary HashCounts { get; private set; } = []; /// /// Number of items with the baddump status @@ -282,8 +246,8 @@ namespace SabreTools.DatFiles case Disk disk: if (disk.ItemStatus != ItemStatus.Nodump) { - MD5Count += (string.IsNullOrEmpty(disk.MD5) ? 0 : 1); - SHA1Count += (string.IsNullOrEmpty(disk.SHA1) ? 0 : 1); + AddHashCount(Hash.MD5, string.IsNullOrEmpty(disk.MD5) ? 0 : 1); + AddHashCount(Hash.SHA1, string.IsNullOrEmpty(disk.SHA1) ? 0 : 1); } BaddumpCount += (disk.ItemStatus == ItemStatus.BadDump ? 1 : 0); @@ -292,22 +256,22 @@ namespace SabreTools.DatFiles VerifiedCount += (disk.ItemStatus == ItemStatus.Verified ? 1 : 0); break; case Media media: - MD5Count += (string.IsNullOrEmpty(media.MD5) ? 0 : 1); - SHA1Count += (string.IsNullOrEmpty(media.SHA1) ? 0 : 1); - SHA256Count += (string.IsNullOrEmpty(media.SHA256) ? 0 : 1); - SpamSumCount += (string.IsNullOrEmpty(media.SpamSum) ? 0 : 1); + AddHashCount(Hash.MD5, string.IsNullOrEmpty(media.MD5) ? 0 : 1); + AddHashCount(Hash.SHA1, string.IsNullOrEmpty(media.SHA1) ? 0 : 1); + AddHashCount(Hash.SHA256, string.IsNullOrEmpty(media.SHA256) ? 0 : 1); + AddHashCount(Hash.SpamSum, string.IsNullOrEmpty(media.SpamSum) ? 0 : 1); break; case Rom rom: if (rom.ItemStatus != ItemStatus.Nodump) { TotalSize += rom.Size ?? 0; - CRCCount += (string.IsNullOrEmpty(rom.CRC) ? 0 : 1); - MD5Count += (string.IsNullOrEmpty(rom.MD5) ? 0 : 1); - SHA1Count += (string.IsNullOrEmpty(rom.SHA1) ? 0 : 1); - SHA256Count += (string.IsNullOrEmpty(rom.SHA256) ? 0 : 1); - SHA384Count += (string.IsNullOrEmpty(rom.SHA384) ? 0 : 1); - SHA512Count += (string.IsNullOrEmpty(rom.SHA512) ? 0 : 1); - SpamSumCount += (string.IsNullOrEmpty(rom.SpamSum) ? 0 : 1); + AddHashCount(Hash.CRC, string.IsNullOrEmpty(rom.CRC) ? 0 : 1); + AddHashCount(Hash.MD5, string.IsNullOrEmpty(rom.MD5) ? 0 : 1); + AddHashCount(Hash.SHA1, string.IsNullOrEmpty(rom.SHA1) ? 0 : 1); + AddHashCount(Hash.SHA256, string.IsNullOrEmpty(rom.SHA256) ? 0 : 1); + AddHashCount(Hash.SHA384, string.IsNullOrEmpty(rom.SHA384) ? 0 : 1); + AddHashCount(Hash.SHA512, string.IsNullOrEmpty(rom.SHA512) ? 0 : 1); + AddHashCount(Hash.SpamSum, string.IsNullOrEmpty(rom.SpamSum) ? 0 : 1); } BaddumpCount += (rom.ItemStatus == ItemStatus.BadDump ? 1 : 0); @@ -366,13 +330,10 @@ namespace SabreTools.DatFiles TotalSize += stats.TotalSize; // Individual hash counts - CRCCount += stats.CRCCount; - MD5Count += stats.MD5Count; - SHA1Count += stats.SHA1Count; - SHA256Count += stats.SHA256Count; - SHA384Count += stats.SHA384Count; - SHA512Count += stats.SHA512Count; - SpamSumCount += stats.SpamSumCount; + foreach (var hashCountKvp in stats.HashCounts) + { + AddHashCount(hashCountKvp.Key, hashCountKvp.Value); + } // Individual status counts BaddumpCount += stats.BaddumpCount; @@ -565,8 +526,8 @@ namespace SabreTools.DatFiles case Disk disk: if (disk.ItemStatus != ItemStatus.Nodump) { - MD5Count -= (string.IsNullOrEmpty(disk.MD5) ? 0 : 1); - SHA1Count -= (string.IsNullOrEmpty(disk.SHA1) ? 0 : 1); + RemoveHashCount(Hash.MD5, string.IsNullOrEmpty(disk.MD5) ? 0 : 1); + RemoveHashCount(Hash.SHA1, string.IsNullOrEmpty(disk.SHA1) ? 0 : 1); } BaddumpCount -= (disk.ItemStatus == ItemStatus.BadDump ? 1 : 0); @@ -575,20 +536,22 @@ namespace SabreTools.DatFiles VerifiedCount -= (disk.ItemStatus == ItemStatus.Verified ? 1 : 0); break; case Media media: - MD5Count -= (string.IsNullOrEmpty(media.MD5) ? 0 : 1); - SHA1Count -= (string.IsNullOrEmpty(media.SHA1) ? 0 : 1); - SHA256Count -= (string.IsNullOrEmpty(media.SHA256) ? 0 : 1); + RemoveHashCount(Hash.MD5, string.IsNullOrEmpty(media.MD5) ? 0 : 1); + RemoveHashCount(Hash.SHA1, string.IsNullOrEmpty(media.SHA1) ? 0 : 1); + RemoveHashCount(Hash.SHA256, string.IsNullOrEmpty(media.SHA256) ? 0 : 1); + RemoveHashCount(Hash.SpamSum, string.IsNullOrEmpty(media.SpamSum) ? 0 : 1); break; case Rom rom: if (rom.ItemStatus != ItemStatus.Nodump) { TotalSize -= rom.Size ?? 0; - CRCCount -= (string.IsNullOrEmpty(rom.CRC) ? 0 : 1); - MD5Count -= (string.IsNullOrEmpty(rom.MD5) ? 0 : 1); - SHA1Count -= (string.IsNullOrEmpty(rom.SHA1) ? 0 : 1); - SHA256Count -= (string.IsNullOrEmpty(rom.SHA256) ? 0 : 1); - SHA384Count -= (string.IsNullOrEmpty(rom.SHA384) ? 0 : 1); - SHA512Count -= (string.IsNullOrEmpty(rom.SHA512) ? 0 : 1); + RemoveHashCount(Hash.CRC, string.IsNullOrEmpty(rom.CRC) ? 0 : 1); + RemoveHashCount(Hash.MD5, string.IsNullOrEmpty(rom.MD5) ? 0 : 1); + RemoveHashCount(Hash.SHA1, string.IsNullOrEmpty(rom.SHA1) ? 0 : 1); + RemoveHashCount(Hash.SHA256, string.IsNullOrEmpty(rom.SHA256) ? 0 : 1); + RemoveHashCount(Hash.SHA384, string.IsNullOrEmpty(rom.SHA384) ? 0 : 1); + RemoveHashCount(Hash.SHA512, string.IsNullOrEmpty(rom.SHA512) ? 0 : 1); + RemoveHashCount(Hash.SpamSum, string.IsNullOrEmpty(rom.SpamSum) ? 0 : 1); } BaddumpCount -= (rom.ItemStatus == ItemStatus.BadDump ? 1 : 0); @@ -600,6 +563,22 @@ namespace SabreTools.DatFiles } } + /// + /// Get the item count for a given hash type, defaulting to 0 if it does not exist + /// + /// Hash type to retrieve + /// The number of items with that hash, if it exists + public long GetHashCount(Hash hash) + { + lock (HashCounts) + { + if (!HashCounts.ContainsKey(hash)) + return 0; + + return HashCounts[hash]; + } + } + /// /// Get the item count for a given item type, defaulting to 0 if it does not exist /// @@ -616,6 +595,42 @@ namespace SabreTools.DatFiles } } + /// + /// Increment the hash count for a given hash type + /// + /// Hash type to increment + /// Amount to increment by, defaults to 1 + private void AddHashCount(Hash hash, long interval = 1) + { + lock (HashCounts) + { + if (!HashCounts.ContainsKey(hash)) + HashCounts[hash] = 0; + + HashCounts[hash] += interval; + if (HashCounts[hash] < 0) + HashCounts[hash] = 0; + } + } + + /// + /// Decrement the hash count for a given hash type + /// + /// Hash type to increment + /// Amount to increment by, defaults to 1 + private void RemoveHashCount(Hash hash, long interval = 1) + { + lock (HashCounts) + { + if (!HashCounts.ContainsKey(hash)) + return; + + HashCounts[hash] -= interval; + if (HashCounts[hash] < 0) + HashCounts[hash] = 0; + } + } + /// /// Increment the item count for a given item type /// @@ -965,20 +980,10 @@ namespace SabreTools.DatFiles public void ResetStatistics() { TotalCount = 0; - ItemCounts = []; - GameCount = 0; - TotalSize = 0; - - CRCCount = 0; - MD5Count = 0; - SHA1Count = 0; - SHA256Count = 0; - SHA384Count = 0; - SHA512Count = 0; - SpamSumCount = 0; + HashCounts = []; BaddumpCount = 0; GoodCount = 0; @@ -998,23 +1003,23 @@ namespace SabreTools.DatFiles long romCount = GetItemCount(ItemType.Rom); // If all items are supposed to have a SHA-512, we bucket by that - if (diskCount + mediaCount + romCount - NodumpCount == SHA512Count) + if (diskCount + mediaCount + romCount - NodumpCount == GetHashCount(Hash.SHA512)) return ItemKey.SHA512; // If all items are supposed to have a SHA-384, we bucket by that - else if (diskCount + mediaCount + romCount - NodumpCount == SHA384Count) + else if (diskCount + mediaCount + romCount - NodumpCount == GetHashCount(Hash.SHA384)) return ItemKey.SHA384; // If all items are supposed to have a SHA-256, we bucket by that - else if (diskCount + mediaCount + romCount - NodumpCount == SHA256Count) + else if (diskCount + mediaCount + romCount - NodumpCount == GetHashCount(Hash.SHA256)) return ItemKey.SHA256; // If all items are supposed to have a SHA-1, we bucket by that - else if (diskCount + mediaCount + romCount - NodumpCount == SHA1Count) + else if (diskCount + mediaCount + romCount - NodumpCount == GetHashCount(Hash.SHA1)) return ItemKey.SHA1; // If all items are supposed to have a MD5, we bucket by that - else if (diskCount + mediaCount + romCount - NodumpCount == MD5Count) + else if (diskCount + mediaCount + romCount - NodumpCount == GetHashCount(Hash.MD5)) return ItemKey.MD5; // Otherwise, we bucket by CRC diff --git a/SabreTools.DatFiles/ItemDictionaryDB.cs b/SabreTools.DatFiles/ItemDictionaryDB.cs index 122c9dbb..acf5f4d3 100644 --- a/SabreTools.DatFiles/ItemDictionaryDB.cs +++ b/SabreTools.DatFiles/ItemDictionaryDB.cs @@ -176,46 +176,10 @@ namespace SabreTools.DatFiles public long TotalSize { get; private set; } = 0; /// - /// Number of items with a CRC hash + /// Number of hashes for each hash type /// [JsonIgnore, XmlIgnore] - public long CRCCount { get; private set; } = 0; - - /// - /// Number of items with an MD5 hash - /// - [JsonIgnore, XmlIgnore] - public long MD5Count { get; private set; } = 0; - - /// - /// Number of items with a SHA-1 hash - /// - [JsonIgnore, XmlIgnore] - public long SHA1Count { get; private set; } = 0; - - /// - /// Number of items with a SHA-256 hash - /// - [JsonIgnore, XmlIgnore] - public long SHA256Count { get; private set; } = 0; - - /// - /// Number of items with a SHA-384 hash - /// - [JsonIgnore, XmlIgnore] - public long SHA384Count { get; private set; } = 0; - - /// - /// Number of items with a SHA-512 hash - /// - [JsonIgnore, XmlIgnore] - public long SHA512Count { get; private set; } = 0; - - /// - /// Number of items with a SpamSum fuzzy hash - /// - [JsonIgnore, XmlIgnore] - public long SpamSumCount { get; private set; } = 0; + public Dictionary HashCounts { get; private set; } = []; /// /// Number of items with the baddump status @@ -401,8 +365,8 @@ namespace SabreTools.DatFiles case Disk disk: if (disk.ItemStatus != ItemStatus.Nodump) { - MD5Count += (string.IsNullOrEmpty(disk.MD5) ? 0 : 1); - SHA1Count += (string.IsNullOrEmpty(disk.SHA1) ? 0 : 1); + AddHashCount(Hash.MD5, string.IsNullOrEmpty(disk.MD5) ? 0 : 1); + AddHashCount(Hash.SHA1, string.IsNullOrEmpty(disk.SHA1) ? 0 : 1); } BaddumpCount += (disk.ItemStatus == ItemStatus.BadDump ? 1 : 0); @@ -411,22 +375,22 @@ namespace SabreTools.DatFiles VerifiedCount += (disk.ItemStatus == ItemStatus.Verified ? 1 : 0); break; case Media media: - MD5Count += (string.IsNullOrEmpty(media.MD5) ? 0 : 1); - SHA1Count += (string.IsNullOrEmpty(media.SHA1) ? 0 : 1); - SHA256Count += (string.IsNullOrEmpty(media.SHA256) ? 0 : 1); - SpamSumCount += (string.IsNullOrEmpty(media.SpamSum) ? 0 : 1); + AddHashCount(Hash.MD5, string.IsNullOrEmpty(media.MD5) ? 0 : 1); + AddHashCount(Hash.SHA1, string.IsNullOrEmpty(media.SHA1) ? 0 : 1); + AddHashCount(Hash.SHA256, string.IsNullOrEmpty(media.SHA256) ? 0 : 1); + AddHashCount(Hash.SpamSum, string.IsNullOrEmpty(media.SpamSum) ? 0 : 1); break; case Rom rom: if (rom.ItemStatus != ItemStatus.Nodump) { TotalSize += rom.Size ?? 0; - CRCCount += (string.IsNullOrEmpty(rom.CRC) ? 0 : 1); - MD5Count += (string.IsNullOrEmpty(rom.MD5) ? 0 : 1); - SHA1Count += (string.IsNullOrEmpty(rom.SHA1) ? 0 : 1); - SHA256Count += (string.IsNullOrEmpty(rom.SHA256) ? 0 : 1); - SHA384Count += (string.IsNullOrEmpty(rom.SHA384) ? 0 : 1); - SHA512Count += (string.IsNullOrEmpty(rom.SHA512) ? 0 : 1); - SpamSumCount += (string.IsNullOrEmpty(rom.SpamSum) ? 0 : 1); + AddHashCount(Hash.CRC, string.IsNullOrEmpty(rom.CRC) ? 0 : 1); + AddHashCount(Hash.MD5, string.IsNullOrEmpty(rom.MD5) ? 0 : 1); + AddHashCount(Hash.SHA1, string.IsNullOrEmpty(rom.SHA1) ? 0 : 1); + AddHashCount(Hash.SHA256, string.IsNullOrEmpty(rom.SHA256) ? 0 : 1); + AddHashCount(Hash.SHA384, string.IsNullOrEmpty(rom.SHA384) ? 0 : 1); + AddHashCount(Hash.SHA512, string.IsNullOrEmpty(rom.SHA512) ? 0 : 1); + AddHashCount(Hash.SpamSum, string.IsNullOrEmpty(rom.SpamSum) ? 0 : 1); } BaddumpCount += (rom.ItemStatus == ItemStatus.BadDump ? 1 : 0); @@ -488,13 +452,10 @@ namespace SabreTools.DatFiles TotalSize += stats.TotalSize; // Individual hash counts - CRCCount += stats.CRCCount; - MD5Count += stats.MD5Count; - SHA1Count += stats.SHA1Count; - SHA256Count += stats.SHA256Count; - SHA384Count += stats.SHA384Count; - SHA512Count += stats.SHA512Count; - SpamSumCount += stats.SpamSumCount; + foreach (var hashCountKvp in stats.HashCounts) + { + AddHashCount(hashCountKvp.Key, hashCountKvp.Value); + } // Individual status counts BaddumpCount += stats.BaddumpCount; @@ -711,8 +672,8 @@ namespace SabreTools.DatFiles case Disk disk: if (disk.ItemStatus != ItemStatus.Nodump) { - MD5Count -= (string.IsNullOrEmpty(disk.MD5) ? 0 : 1); - SHA1Count -= (string.IsNullOrEmpty(disk.SHA1) ? 0 : 1); + RemoveHashCount(Hash.MD5, string.IsNullOrEmpty(disk.MD5) ? 0 : 1); + RemoveHashCount(Hash.SHA1, string.IsNullOrEmpty(disk.SHA1) ? 0 : 1); } BaddumpCount -= (disk.ItemStatus == ItemStatus.BadDump ? 1 : 0); @@ -721,20 +682,22 @@ namespace SabreTools.DatFiles VerifiedCount -= (disk.ItemStatus == ItemStatus.Verified ? 1 : 0); break; case Media media: - MD5Count -= (string.IsNullOrEmpty(media.MD5) ? 0 : 1); - SHA1Count -= (string.IsNullOrEmpty(media.SHA1) ? 0 : 1); - SHA256Count -= (string.IsNullOrEmpty(media.SHA256) ? 0 : 1); + RemoveHashCount(Hash.MD5, string.IsNullOrEmpty(media.MD5) ? 0 : 1); + RemoveHashCount(Hash.SHA1, string.IsNullOrEmpty(media.SHA1) ? 0 : 1); + RemoveHashCount(Hash.SHA256, string.IsNullOrEmpty(media.SHA256) ? 0 : 1); + RemoveHashCount(Hash.SpamSum, string.IsNullOrEmpty(media.SpamSum) ? 0 : 1); break; case Rom rom: if (rom.ItemStatus != ItemStatus.Nodump) { TotalSize -= rom.Size ?? 0; - CRCCount -= (string.IsNullOrEmpty(rom.CRC) ? 0 : 1); - MD5Count -= (string.IsNullOrEmpty(rom.MD5) ? 0 : 1); - SHA1Count -= (string.IsNullOrEmpty(rom.SHA1) ? 0 : 1); - SHA256Count -= (string.IsNullOrEmpty(rom.SHA256) ? 0 : 1); - SHA384Count -= (string.IsNullOrEmpty(rom.SHA384) ? 0 : 1); - SHA512Count -= (string.IsNullOrEmpty(rom.SHA512) ? 0 : 1); + RemoveHashCount(Hash.CRC, string.IsNullOrEmpty(rom.CRC) ? 0 : 1); + RemoveHashCount(Hash.MD5, string.IsNullOrEmpty(rom.MD5) ? 0 : 1); + RemoveHashCount(Hash.SHA1, string.IsNullOrEmpty(rom.SHA1) ? 0 : 1); + RemoveHashCount(Hash.SHA256, string.IsNullOrEmpty(rom.SHA256) ? 0 : 1); + RemoveHashCount(Hash.SHA384, string.IsNullOrEmpty(rom.SHA384) ? 0 : 1); + RemoveHashCount(Hash.SHA512, string.IsNullOrEmpty(rom.SHA512) ? 0 : 1); + RemoveHashCount(Hash.SpamSum, string.IsNullOrEmpty(rom.SpamSum) ? 0 : 1); } BaddumpCount -= (rom.ItemStatus == ItemStatus.BadDump ? 1 : 0); @@ -746,6 +709,22 @@ namespace SabreTools.DatFiles } } + /// + /// Get the item count for a given hash type, defaulting to 0 if it does not exist + /// + /// Hash type to retrieve + /// The number of items with that hash, if it exists + public long GetHashCount(Hash hash) + { + lock (HashCounts) + { + if (!HashCounts.ContainsKey(hash)) + return 0; + + return HashCounts[hash]; + } + } + /// /// Get the item count for a given item type, defaulting to 0 if it does not exist /// @@ -762,6 +741,42 @@ namespace SabreTools.DatFiles } } + /// + /// Increment the hash count for a given hash type + /// + /// Hash type to increment + /// Amount to increment by, defaults to 1 + private void AddHashCount(Hash hash, long interval = 1) + { + lock (HashCounts) + { + if (!HashCounts.ContainsKey(hash)) + HashCounts[hash] = 0; + + HashCounts[hash] += interval; + if (HashCounts[hash] < 0) + HashCounts[hash] = 0; + } + } + + /// + /// Decrement the hash count for a given hash type + /// + /// Hash type to increment + /// Amount to increment by, defaults to 1 + private void RemoveHashCount(Hash hash, long interval = 1) + { + lock (HashCounts) + { + if (!HashCounts.ContainsKey(hash)) + return; + + HashCounts[hash] -= interval; + if (HashCounts[hash] < 0) + HashCounts[hash] = 0; + } + } + /// /// Increment the item count for a given item type /// @@ -1136,20 +1151,10 @@ CREATE TABLE IF NOT EXISTS groups ( public void ResetStatistics() { TotalCount = 0; - ItemCounts = []; - GameCount = 0; - TotalSize = 0; - - CRCCount = 0; - MD5Count = 0; - SHA1Count = 0; - SHA256Count = 0; - SHA384Count = 0; - SHA512Count = 0; - SpamSumCount = 0; + HashCounts = []; BaddumpCount = 0; GoodCount = 0; @@ -1169,23 +1174,23 @@ CREATE TABLE IF NOT EXISTS groups ( long romCount = GetItemCount(ItemType.Rom); // If all items are supposed to have a SHA-512, we bucket by that - if (diskCount + mediaCount + romCount - NodumpCount == SHA512Count) + if (diskCount + mediaCount + romCount - NodumpCount == GetHashCount(Hash.SHA512)) return ItemKey.SHA512; // If all items are supposed to have a SHA-384, we bucket by that - else if (diskCount + mediaCount + romCount - NodumpCount == SHA384Count) + else if (diskCount + mediaCount + romCount - NodumpCount == GetHashCount(Hash.SHA384)) return ItemKey.SHA384; // If all items are supposed to have a SHA-256, we bucket by that - else if (diskCount + mediaCount + romCount - NodumpCount == SHA256Count) + else if (diskCount + mediaCount + romCount - NodumpCount == GetHashCount(Hash.SHA256)) return ItemKey.SHA256; // If all items are supposed to have a SHA-1, we bucket by that - else if (diskCount + mediaCount + romCount - NodumpCount == SHA1Count) + else if (diskCount + mediaCount + romCount - NodumpCount == GetHashCount(Hash.SHA1)) return ItemKey.SHA1; // If all items are supposed to have a MD5, we bucket by that - else if (diskCount + mediaCount + romCount - NodumpCount == MD5Count) + else if (diskCount + mediaCount + romCount - NodumpCount == GetHashCount(Hash.MD5)) return ItemKey.MD5; // Otherwise, we bucket by CRC diff --git a/SabreTools.Reports/Formats/Html.cs b/SabreTools.Reports/Formats/Html.cs index 8b0c1bcd..9e54f296 100644 --- a/SabreTools.Reports/Formats/Html.cs +++ b/SabreTools.Reports/Formats/Html.cs @@ -247,22 +247,22 @@ body { xtw.WriteStartElement("td"); xtw.WriteAttributeString("align", "right"); - xtw.WriteString(stat.Statistics.CRCCount.ToString()); + xtw.WriteString(stat.Statistics.GetHashCount(Core.Hash.CRC).ToString()); xtw.WriteEndElement(); // td xtw.WriteStartElement("td"); xtw.WriteAttributeString("align", "right"); - xtw.WriteString(stat.Statistics.MD5Count.ToString()); + xtw.WriteString(stat.Statistics.GetHashCount(Core.Hash.MD5).ToString()); xtw.WriteEndElement(); // td xtw.WriteStartElement("td"); xtw.WriteAttributeString("align", "right"); - xtw.WriteString(stat.Statistics.SHA1Count.ToString()); + xtw.WriteString(stat.Statistics.GetHashCount(Core.Hash.SHA1).ToString()); xtw.WriteEndElement(); // td xtw.WriteStartElement("td"); xtw.WriteAttributeString("align", "right"); - xtw.WriteString(stat.Statistics.SHA256Count.ToString()); + xtw.WriteString(stat.Statistics.GetHashCount(Core.Hash.SHA256).ToString()); xtw.WriteEndElement(); // td if (baddumpCol) diff --git a/SabreTools.Reports/Formats/SeparatedValue.cs b/SabreTools.Reports/Formats/SeparatedValue.cs index 5f58db2f..23fac8de 100644 --- a/SabreTools.Reports/Formats/SeparatedValue.cs +++ b/SabreTools.Reports/Formats/SeparatedValue.cs @@ -133,12 +133,12 @@ namespace SabreTools.Reports.Formats stat.MachineCount.ToString(), stat.Statistics.GetItemCount(Core.ItemType.Rom).ToString(), stat.Statistics.GetItemCount(Core.ItemType.Disk).ToString(), - stat.Statistics.CRCCount.ToString(), - stat.Statistics.MD5Count.ToString(), - stat.Statistics.SHA1Count.ToString(), - stat.Statistics.SHA256Count.ToString(), - stat.Statistics.SHA384Count.ToString(), - stat.Statistics.SHA512Count.ToString(), + stat.Statistics.GetHashCount(Core.Hash.CRC).ToString(), + stat.Statistics.GetHashCount(Core.Hash.MD5).ToString(), + stat.Statistics.GetHashCount(Core.Hash.SHA1).ToString(), + stat.Statistics.GetHashCount(Core.Hash.SHA256).ToString(), + stat.Statistics.GetHashCount(Core.Hash.SHA384).ToString(), + stat.Statistics.GetHashCount(Core.Hash.SHA512).ToString(), baddumpCol ? stat.Statistics.BaddumpCount.ToString() : string.Empty, nodumpCol ? stat.Statistics.NodumpCount.ToString() : string.Empty, ]; diff --git a/SabreTools.Reports/Formats/Textfile.cs b/SabreTools.Reports/Formats/Textfile.cs index 32e5a447..82151941 100644 --- a/SabreTools.Reports/Formats/Textfile.cs +++ b/SabreTools.Reports/Formats/Textfile.cs @@ -95,12 +95,12 @@ namespace SabreTools.Reports.Formats Games found: " + stat.MachineCount + @" Roms found: " + stat.Statistics.GetItemCount(Core.ItemType.Rom) + @" Disks found: " + stat.Statistics.GetItemCount(Core.ItemType.Disk) + @" - Roms with CRC: " + stat.Statistics.CRCCount + @" - Roms with MD5: " + stat.Statistics.MD5Count + @" - Roms with SHA-1: " + stat.Statistics.SHA1Count + @" - Roms with SHA-256: " + stat.Statistics.SHA256Count + @" - Roms with SHA-384: " + stat.Statistics.SHA384Count + @" - Roms with SHA-512: " + stat.Statistics.SHA512Count + "\n"; + Roms with CRC: " + stat.Statistics.GetHashCount(Core.Hash.CRC) + @" + Roms with MD5: " + stat.Statistics.GetHashCount(Core.Hash.MD5) + @" + Roms with SHA-1: " + stat.Statistics.GetHashCount(Core.Hash.SHA1) + @" + Roms with SHA-256: " + stat.Statistics.GetHashCount(Core.Hash.SHA256) + @" + Roms with SHA-384: " + stat.Statistics.GetHashCount(Core.Hash.SHA384) + @" + Roms with SHA-512: " + stat.Statistics.GetHashCount(Core.Hash.SHA512) + "\n"; if (baddumpCol) line += " Roms with BadDump status: " + stat.Statistics.BaddumpCount + "\n";