Add clear marked items method to IDDB

This commit is contained in:
Matt Nadareski
2024-03-13 11:11:59 -04:00
parent 70214bfbdf
commit cf23bb9c2d

View File

@@ -116,6 +116,22 @@ namespace SabreTools.DatFiles
return _machineIndex - 1;
}
/// <summary>
/// Remove all items marked for removal
/// </summary>
public void ClearMarked()
{
var itemIndices = _items.Keys;
foreach (long itemIndex in itemIndices)
{
var datItem = _items[itemIndex];
if (datItem == null || datItem.GetBoolFieldValue(DatItem.RemoveKey) != true)
continue;
RemoveItem(itemIndex);
}
}
/// <summary>
/// Get an item based on the index
/// </summary>