diff --git a/SabreTools.DatFiles/ItemDictionary.cs b/SabreTools.DatFiles/ItemDictionary.cs
index c5409899..70b94667 100644
--- a/SabreTools.DatFiles/ItemDictionary.cs
+++ b/SabreTools.DatFiles/ItemDictionary.cs
@@ -27,12 +27,12 @@ namespace SabreTools.DatFiles
///
/// Determine the bucketing key for all items
///
- private ItemKey _bucketedBy;
+ private ItemKey _bucketedBy = ItemKey.NULL;
///
/// Determine merging type for all items
///
- private DedupeType _mergedBy;
+ private DedupeType _mergedBy = DedupeType.None;
///
/// Internal dictionary for the class
@@ -82,8 +82,6 @@ namespace SabreTools.DatFiles
///
public ItemDictionary()
{
- _bucketedBy = ItemKey.NULL;
- _mergedBy = DedupeType.None;
_logger = new Logger(this);
}
diff --git a/SabreTools.DatFiles/ItemDictionaryDB.cs b/SabreTools.DatFiles/ItemDictionaryDB.cs
index c21234ae..8fa338f2 100644
--- a/SabreTools.DatFiles/ItemDictionaryDB.cs
+++ b/SabreTools.DatFiles/ItemDictionaryDB.cs
@@ -15,6 +15,7 @@ using SabreTools.Core.Tools;
using SabreTools.DatItems;
using SabreTools.DatItems.Formats;
using SabreTools.Hashing;
+using SabreTools.IO.Logging;
using SabreTools.Matching.Compare;
/*
@@ -128,6 +129,11 @@ namespace SabreTools.DatFiles
///
private ItemKey _bucketedBy = ItemKey.NULL;
+ ///
+ /// Logging object
+ ///
+ private readonly Logger _logger;
+
#endregion
#region Fields
@@ -155,10 +161,17 @@ namespace SabreTools.DatFiles
#endregion
+ #region Constructors
+
///
/// Generic constructor
///
- public ItemDictionaryDB() { }
+ public ItemDictionaryDB()
+ {
+ _logger = new Logger(this);
+ }
+
+ #endregion
#region Accessors
@@ -180,6 +193,7 @@ namespace SabreTools.DatFiles
&& string.IsNullOrEmpty(disk.GetStringFieldValue(Models.Metadata.Disk.MD5Key))
&& string.IsNullOrEmpty(disk.GetStringFieldValue(Models.Metadata.Disk.SHA1Key)))
{
+ _logger.Verbose($"Incomplete entry for '{disk.GetName()}' will be output as nodump");
disk.SetFieldValue(Models.Metadata.Disk.StatusKey, ItemStatus.Nodump.AsStringValue());
}
@@ -193,7 +207,7 @@ namespace SabreTools.DatFiles
&& string.IsNullOrEmpty(media.GetStringFieldValue(Models.Metadata.Media.SHA256Key))
&& string.IsNullOrEmpty(media.GetStringFieldValue(Models.Metadata.Media.SpamSumKey)))
{
- // No-op as there is no status key for Media
+ _logger.Verbose($"Incomplete entry for '{media.GetName()}' will be output as nodump");
}
item = media;
@@ -206,6 +220,7 @@ namespace SabreTools.DatFiles
if (size == null && !rom.HasHashes())
{
// No-op, just catch it so it doesn't go further
+ //logger.Verbose($"{Header.GetStringFieldValue(DatHeader.FileNameKey)}: Entry with only SHA-1 found - '{rom.GetName()}'");
}
// If we have a rom and it's missing size AND the hashes match a 0-byte file, fill in the rest of the info
@@ -227,6 +242,7 @@ namespace SabreTools.DatFiles
// If the file has no size and it's not the above case, skip and log
else if (rom.GetStringFieldValue(Models.Metadata.Rom.StatusKey).AsEnumValue() != ItemStatus.Nodump && (size == 0 || size == null))
{
+ //logger.Verbose($"{Header.GetStringFieldValue(DatHeader.FileNameKey)}: Incomplete entry for '{rom.GetName()}' will be output as nodump");
rom.SetFieldValue(Models.Metadata.Rom.StatusKey, ItemStatus.Nodump.AsStringValue());
}
@@ -235,6 +251,7 @@ namespace SabreTools.DatFiles
&& size != null && size > 0
&& !rom.HasHashes())
{
+ //logger.Verbose($"{Header.GetStringFieldValue(DatHeader.FileNameKey)}: Incomplete entry for '{rom.GetName()}' will be output as nodump");
rom.SetFieldValue(Models.Metadata.Rom.StatusKey, ItemStatus.Nodump.AsStringValue());
}
@@ -684,16 +701,21 @@ namespace SabreTools.DatFiles
{
// If the sorted type isn't the same, we want to sort the dictionary accordingly
if (_bucketedBy != bucketBy && bucketBy != ItemKey.NULL)
+ {
+ _logger.User($"Organizing roms by {bucketBy}");
PerformBucketing(bucketBy, lower, norename);
+ }
// If the merge type isn't the same, we want to merge the dictionary accordingly
if (dedupeType != DedupeType.None)
{
+ _logger.User($"Deduping roms by {dedupeType}");
PerformDeduplication(bucketBy, dedupeType);
}
// If the merge type is the same, we want to sort the dictionary to be consistent
else
{
+ _logger.User($"Sorting roms by {bucketBy}");
PerformSorting(norename);
}
}