[DatFile] Fix contains, split

This commit is contained in:
Matt Nadareski
2017-12-22 12:13:08 -08:00
parent 46b17ab97a
commit e30cfd3ff2

View File

@@ -1258,7 +1258,7 @@ namespace SabreTools.Library.DatFiles
{ {
if (_items.ContainsKey(key)) if (_items.ContainsKey(key))
{ {
contains = _items.ContainsKey(key); contains = _items[key].Contains(value);
} }
} }
@@ -1329,14 +1329,10 @@ namespace SabreTools.Library.DatFiles
lock (_items) lock (_items)
{ {
// While the key is in the dictionary and the item is there, remove it // Remove the statistics first
if (_items.ContainsKey(key) && _items[key].Contains(value)) _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) foreach (DatItem item in parentItems)
{ {
DatItem datItem = (DatItem)item.Clone(); 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 // Now we want to get the parent romof tag and put it in each of the items