From e30cfd3ff231e07e45e12f2bb643072dea87cd37 Mon Sep 17 00:00:00 2001 From: Matt Nadareski Date: Fri, 22 Dec 2017 12:13:08 -0800 Subject: [PATCH] [DatFile] Fix contains, split --- SabreTools.Library/DatFiles/DatFile.cs | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/SabreTools.Library/DatFiles/DatFile.cs b/SabreTools.Library/DatFiles/DatFile.cs index 0b775ad8..28afef34 100644 --- a/SabreTools.Library/DatFiles/DatFile.cs +++ b/SabreTools.Library/DatFiles/DatFile.cs @@ -1258,7 +1258,7 @@ namespace SabreTools.Library.DatFiles { if (_items.ContainsKey(key)) { - contains = _items.ContainsKey(key); + contains = _items[key].Contains(value); } } @@ -1329,14 +1329,10 @@ namespace SabreTools.Library.DatFiles lock (_items) { - // While the key is in the dictionary and the item is there, remove it - if (_items.ContainsKey(key) && _items[key].Contains(value)) - { - // Remove the statistics first - _datStats.RemoveItem(value); + // Remove the statistics first + _datStats.RemoveItem(value); - _items[key].Remove(value); - } + _items[key].Remove(value); } } @@ -3004,7 +3000,10 @@ namespace SabreTools.Library.DatFiles foreach (DatItem item in parentItems) { DatItem datItem = (DatItem)item.Clone(); - Remove(game, datItem); + while (this[game].Contains(datItem)) + { + Remove(game, datItem); + } } // Now we want to get the parent romof tag and put it in each of the items