[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);
} }
} }
@@ -1328,9 +1328,6 @@ namespace SabreTools.Library.DatFiles
} }
lock (_items) 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 // Remove the statistics first
_datStats.RemoveItem(value); _datStats.RemoveItem(value);
@@ -1338,7 +1335,6 @@ namespace SabreTools.Library.DatFiles
_items[key].Remove(value); _items[key].Remove(value);
} }
} }
}
/// <summary> /// <summary>
/// Remove a range of values from the file dictionary if they exists /// Remove a range of values from the file dictionary if they exists
@@ -3004,8 +3000,11 @@ namespace SabreTools.Library.DatFiles
foreach (DatItem item in parentItems) foreach (DatItem item in parentItems)
{ {
DatItem datItem = (DatItem)item.Clone(); DatItem datItem = (DatItem)item.Clone();
while (this[game].Contains(datItem))
{
Remove(game, 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
List<DatItem> items = this[game]; List<DatItem> items = this[game];