Ensure machine has writable items

This commit is contained in:
Matt Nadareski
2020-09-25 20:25:29 -07:00
parent d66e2a57cf
commit 80f5b69513
17 changed files with 85 additions and 0 deletions

View File

@@ -3793,6 +3793,27 @@ namespace SabreTools.Library.DatFiles
return Enum.GetValues(typeof(ItemType)) as ItemType[];
}
/// <summary>
/// Get if a machine contains any writable items
/// </summary>
/// <param name="datItems">DatItems to check</param>
/// <returns>True if the machine contains at least one writable item, false otherwise</returns>
/// <remarks>Empty machines are kept with this</remarks>
protected bool ContainsWritable(List<DatItem> datItems)
{
// Empty machines are considered writable
if (datItems == null || datItems.Count == 0)
return true;
foreach (DatItem datItem in datItems)
{
if (GetSupportedTypes().Contains(datItem.ItemType))
return true;
}
return false;
}
/// <summary>
/// Get if an item should be ignored on write
/// </summary>