Fix RemoveTagsFromChildImplDB

This commit is contained in:
Matt Nadareski
2025-01-13 00:29:39 -05:00
parent 47b618be16
commit 9e76e9e033

View File

@@ -1125,7 +1125,7 @@ namespace SabreTools.DatFiles
} }
} }
/// <summary> /// <summary>
/// Remove all romof and cloneof tags from all games /// Remove all romof and cloneof tags from all games
/// </summary> /// </summary>
private void RemoveTagsFromChildImpl() private void RemoveTagsFromChildImpl()
@@ -1154,24 +1154,15 @@ namespace SabreTools.DatFiles
/// </summary> /// </summary>
private void RemoveTagsFromChildImplDB() private void RemoveTagsFromChildImplDB()
{ {
List<string> games = [.. ItemsDB.SortedKeys]; var machines = ItemsDB.GetMachines();
foreach (string game in games) foreach (var machine in machines)
{ {
// If the game has no items in it, we want to continue if (machine.Value == null)
var items = GetItemsForBucketDB(game);
if (items == null || items.Count == 0)
continue; continue;
foreach (long id in items.Keys) machine.Value.SetFieldValue<string?>(Models.Metadata.Machine.CloneOfKey, null);
{ machine.Value.SetFieldValue<string?>(Models.Metadata.Machine.RomOfKey, null);
var machine = ItemsDB.GetMachineForItem(id); machine.Value.SetFieldValue<string?>(Models.Metadata.Machine.SampleOfKey, null);
if (machine.Value == null)
continue;
machine.Value.SetFieldValue<string?>(Models.Metadata.Machine.CloneOfKey, null);
machine.Value.SetFieldValue<string?>(Models.Metadata.Machine.RomOfKey, null);
machine.Value.SetFieldValue<string?>(Models.Metadata.Machine.SampleOfKey, null);
}
} }
} }