diff --git a/SabreTools.DatFiles/ItemDictionary.cs b/SabreTools.DatFiles/ItemDictionary.cs index a7e083cb..12f6bbd5 100644 --- a/SabreTools.DatFiles/ItemDictionary.cs +++ b/SabreTools.DatFiles/ItemDictionary.cs @@ -692,39 +692,39 @@ namespace SabreTools.DatFiles #elif NET40_OR_GREATER Parallel.For(0, oldkeys.Count, k => #else - for (int k = 0; k < oldkeys.Count; k++) + for (int k = 0; k < oldkeys.Count; k++) #endif - { - string key = oldkeys[k]; - if (this[key] == null) - Remove(key); - - // Now add each of the roms to their respective keys - for (int i = 0; i < this[key]!.Count; i++) { - DatItem item = this[key]![i]; - if (item == null) - continue; + string key = oldkeys[k]; + if (this[key] == null) + Remove(key); - // We want to get the key most appropriate for the given sorting type - string newkey = item.GetKey(bucketBy, lower, norename); - - // If the key is different, move the item to the new key - if (newkey != key) + // Now add each of the roms to their respective keys + for (int i = 0; i < this[key]!.Count; i++) { - Add(newkey, item); - Remove(key, item); - i--; // This make sure that the pointer stays on the correct since one was removed - } - } + DatItem item = this[key]![i]; + if (item == null) + continue; - // If the key is now empty, remove it - if (this[key]!.Count == 0) - Remove(key); -#if NET40_OR_GREATER || NETCOREAPP - }); -#else + // We want to get the key most appropriate for the given sorting type + string newkey = item.GetKey(bucketBy, lower, norename); + + // If the key is different, move the item to the new key + if (newkey != key) + { + Add(newkey, item); + Remove(key, item); + i--; // This make sure that the pointer stays on the correct since one was removed + } } + + // If the key is now empty, remove it + if (this[key]!.Count == 0) + Remove(key); +#if NET40_OR_GREATER || NETCOREAPP + }); +#else + } #endif } diff --git a/SabreTools.DatItems/Formats/Blank.cs b/SabreTools.DatItems/Formats/Blank.cs index 4f11f2db..43f553e2 100644 --- a/SabreTools.DatItems/Formats/Blank.cs +++ b/SabreTools.DatItems/Formats/Blank.cs @@ -20,7 +20,7 @@ namespace SabreTools.DatItems.Formats #region Constructors /// - /// Create a default, empty Archive object + /// Create a default, empty Blank object /// public Blank() { diff --git a/SabreTools.DatTools/DatFromDir.cs b/SabreTools.DatTools/DatFromDir.cs index a743b8c8..f6388d73 100644 --- a/SabreTools.DatTools/DatFromDir.cs +++ b/SabreTools.DatTools/DatFromDir.cs @@ -378,7 +378,7 @@ namespace SabreTools.DatTools var blankMachine = new Machine(); blankMachine.SetFieldValue(Models.Metadata.Machine.NameKey, gamename); - var blankRom = new Rom(); + var blankRom = new Blank(); blankRom.SetName(romname); blankRom.SetFieldValue(DatItem.MachineKey, blankMachine); diff --git a/SabreTools/Features/DatFromDir.cs b/SabreTools/Features/DatFromDir.cs index 261bf502..5eed43ba 100644 --- a/SabreTools/Features/DatFromDir.cs +++ b/SabreTools/Features/DatFromDir.cs @@ -73,6 +73,10 @@ namespace SabreTools.Features DatFile basedat = DatFile.Create(Header!); basedat.Header.SetFieldValue(Models.Metadata.Header.DateKey, DateTime.Now.ToString("yyyy-MM-dd")); + // Update the cleaner based on certain flags + if (addBlankFiles) + Cleaner!.KeepEmptyGames = true; + // For each input directory, create a DAT foreach (string path in Inputs) {