diff --git a/SabreTools.Helper/Tools/DatTools.cs b/SabreTools.Helper/Tools/DatTools.cs index ef08fb73..9efc04cc 100644 --- a/SabreTools.Helper/Tools/DatTools.cs +++ b/SabreTools.Helper/Tools/DatTools.cs @@ -1621,14 +1621,23 @@ namespace SabreTools.Helper /// Take an arbitrarily bucketed Dictionary and return one sorted by Game /// /// Input unsorted dictionary - /// True if roms should be deduped, false otherwise + /// True if roms should be deduped, false otherwise /// True if games should only be compared on game and file name, false if system and source are counted /// Logger object for file and console output + /// True if the number of hashes counted is to be output (default), false otherwise /// SortedDictionary bucketed by game name - public static SortedDictionary> BucketByGame(Dictionary> dict, bool mergeroms, bool norename, Logger logger) + public static SortedDictionary> BucketByGame(Dictionary> dict, bool mergeroms, bool norename, Logger logger, bool output = true) { SortedDictionary> sortable = new SortedDictionary>(); long count = 0; + + // If we have a null dict or an empty one, output a new dictionary + if (dict == null || dict.Count == 0) + { + return sortable; + } + + // Process each all of the roms foreach (List roms in dict.Values) { List newroms = roms; @@ -1654,7 +1663,12 @@ namespace SabreTools.Helper } } - logger.User("A total of " + count + " file hashes will be written out to file"); + // Output the count if told to + if (output) + { + logger.User("A total of " + count + " file hashes will be written out to file"); + } + return sortable; } diff --git a/SabreTools.Helper/Tools/Stats.cs b/SabreTools.Helper/Tools/Stats.cs index afbb45b3..8b39ab6e 100644 --- a/SabreTools.Helper/Tools/Stats.cs +++ b/SabreTools.Helper/Tools/Stats.cs @@ -51,7 +51,7 @@ namespace SabreTools List games = new List(); DatData datdata = new DatData(); datdata = DatTools.Parse(filename, 0, 0, datdata, _logger); - SortedDictionary> newroms = DatTools.BucketByGame(datdata.Roms, false, true, _logger); + SortedDictionary> newroms = DatTools.BucketByGame(datdata.Roms, false, true, _logger, false); // Output single DAT stats (if asked) if (_single) @@ -62,7 +62,7 @@ namespace SabreTools } else { - _logger.User("\nAdding stats for file '" + filename + "'"); + _logger.User("Adding stats for file '" + filename + "'\n"); } // Add single DAT stats to totals diff --git a/SabreTools/Partials/SabreTools_Inits.cs b/SabreTools/Partials/SabreTools_Inits.cs index c1349a99..9f35fc44 100644 --- a/SabreTools/Partials/SabreTools_Inits.cs +++ b/SabreTools/Partials/SabreTools_Inits.cs @@ -510,7 +510,6 @@ namespace SabreTools /// Old-current missing DAT with merged and deduped values /// New-current DAT with merged and deduped values /// True if all values should be replaced with default 0-byte values, false otherwise - /// private static void InitOfflineMerge(string currentAllMerged, string currentMissingMerged, string currentNewMerged, bool fake) { // Sanitize the inputs