From 9e76e9e033cf67c5a3b867baa231e620b8800e6e Mon Sep 17 00:00:00 2001 From: Matt Nadareski Date: Mon, 13 Jan 2025 00:29:39 -0500 Subject: [PATCH] Fix RemoveTagsFromChildImplDB --- SabreTools.DatFiles/DatFile.Splitting.cs | 23 +++++++---------------- 1 file changed, 7 insertions(+), 16 deletions(-) diff --git a/SabreTools.DatFiles/DatFile.Splitting.cs b/SabreTools.DatFiles/DatFile.Splitting.cs index a715a3ce..bd34f1d6 100644 --- a/SabreTools.DatFiles/DatFile.Splitting.cs +++ b/SabreTools.DatFiles/DatFile.Splitting.cs @@ -1125,7 +1125,7 @@ namespace SabreTools.DatFiles } } - /// + /// /// Remove all romof and cloneof tags from all games /// private void RemoveTagsFromChildImpl() @@ -1154,24 +1154,15 @@ namespace SabreTools.DatFiles /// private void RemoveTagsFromChildImplDB() { - List games = [.. ItemsDB.SortedKeys]; - foreach (string game in games) + var machines = ItemsDB.GetMachines(); + foreach (var machine in machines) { - // If the game has no items in it, we want to continue - var items = GetItemsForBucketDB(game); - if (items == null || items.Count == 0) + if (machine.Value == null) continue; - foreach (long id in items.Keys) - { - var machine = ItemsDB.GetMachineForItem(id); - if (machine.Value == null) - continue; - - machine.Value.SetFieldValue(Models.Metadata.Machine.CloneOfKey, null); - machine.Value.SetFieldValue(Models.Metadata.Machine.RomOfKey, null); - machine.Value.SetFieldValue(Models.Metadata.Machine.SampleOfKey, null); - } + machine.Value.SetFieldValue(Models.Metadata.Machine.CloneOfKey, null); + machine.Value.SetFieldValue(Models.Metadata.Machine.RomOfKey, null); + machine.Value.SetFieldValue(Models.Metadata.Machine.SampleOfKey, null); } }