Add more passthrough DB methods

This commit is contained in:
Matt Nadareski
2025-01-14 22:34:58 -05:00
parent e7142a31ff
commit a1ad61f6da
4 changed files with 31 additions and 7 deletions

View File

@@ -467,7 +467,7 @@ namespace SabreTools.DatFiles
parents[key].Remove(machine); parents[key].Remove(machine);
// Remove the rest of the items from this key // Remove the rest of the items from this key
parents[key].ForEach(k => ItemsDB.RemoveMachine(k)); parents[key].ForEach(k => RemoveMachineDB(k));
} }
// Finally, strip out the parent tags // Finally, strip out the parent tags

View File

@@ -485,7 +485,7 @@ namespace SabreTools.DatFiles
} }
// Remove the current item // Remove the current item
ItemsDB.RemoveItem(item.Key); RemoveItemDB(item.Key);
} }
} }
} }
@@ -1059,12 +1059,12 @@ namespace SabreTools.DatFiles
{ {
foreach (var key in items.Keys) foreach (var key in items.Keys)
{ {
ItemsDB.RemoveItem(key); RemoveItemDB(key);
} }
} }
// Remove the machine // Remove the machine
ItemsDB.RemoveMachine(machine.Key); RemoveMachineDB(machine.Key);
} }
} }
@@ -1149,7 +1149,7 @@ namespace SabreTools.DatFiles
var matchedItems = items.Where(i => i.Value.Equals(item.Value)); var matchedItems = items.Where(i => i.Value.Equals(item.Value));
foreach (var match in matchedItems) foreach (var match in matchedItems)
{ {
ItemsDB.RemoveItem(match.Key); RemoveItemDB(match.Key);
} }
} }
@@ -1247,7 +1247,7 @@ namespace SabreTools.DatFiles
var matchedItems = items.Where(i => i.Value.Equals(item.Value)); var matchedItems = items.Where(i => i.Value.Equals(item.Value));
foreach (var match in matchedItems) foreach (var match in matchedItems)
{ {
ItemsDB.RemoveItem(match.Key); RemoveItemDB(match.Key);
} }
} }
} }

View File

@@ -282,6 +282,30 @@ namespace SabreTools.DatFiles
return Items.RemoveItem(key, value); return Items.RemoveItem(key, value);
} }
/// <summary>
/// Remove an item, returning if it could be removed
/// </summary>
public bool RemoveItemDB(long itemIndex)
{
return ItemsDB.RemoveItem(itemIndex);
}
/// <summary>
/// Remove a machine, returning if it could be removed
/// </summary>
public bool RemoveMachineDB(long machineIndex)
{
return ItemsDB.RemoveMachine(machineIndex);
}
/// <summary>
/// Remove a machine, returning if it could be removed
/// </summary>
public bool RemoveMachineDB(string machineName)
{
return ItemsDB.RemoveMachine(machineName);
}
/// <summary> /// <summary>
/// Reset the internal item dictionary /// Reset the internal item dictionary
/// </summary> /// </summary>

View File

@@ -1577,7 +1577,7 @@ namespace SabreTools.DatFiles
// Now remove the key from the source DAT // Now remove the key from the source DAT
if (delete) if (delete)
addFrom.ItemsDB.RemoveItem(item.Key); addFrom.RemoveItemDB(item.Key);
#if NET40_OR_GREATER || NETCOREAPP #if NET40_OR_GREATER || NETCOREAPP
}); });