diff --git a/SabreTools.DatFiles/DatFile.cs b/SabreTools.DatFiles/DatFile.cs index dceb091b..ea312d02 100644 --- a/SabreTools.DatFiles/DatFile.cs +++ b/SabreTools.DatFiles/DatFile.cs @@ -1,16 +1,14 @@ using System; -using System.Collections.Generic; using System.IO; using System.Linq; using System.Xml.Serialization; - +using Newtonsoft.Json; using SabreTools.Core; using SabreTools.Core.Tools; using SabreTools.DatFiles.Formats; using SabreTools.DatItems; using SabreTools.DatItems.Formats; using SabreTools.Logging; -using Newtonsoft.Json; namespace SabreTools.DatFiles { @@ -251,7 +249,7 @@ namespace SabreTools.DatFiles /// /// String to get value from /// Date as a string, if possible - protected string CleanDate(string input) + protected static string CleanDate(string input) { // Null in, null out if (input == null) @@ -274,7 +272,7 @@ namespace SabreTools.DatFiles /// /// Hash string to sanitize /// Cleaned string - protected string CleanListromHashData(string hash) + protected static string CleanListromHashData(string hash) { if (hash.StartsWith("CRC")) return hash.Substring(4, 8).ToLowerInvariant(); @@ -533,7 +531,7 @@ namespace SabreTools.DatFiles /// Get if an item should be ignored on write /// /// DatItem to check - /// True if blank roms should be skipped on output, false otherwise + /// True if blank roms should be skipped on output, false otherwise /// True if the item should be skipped on write, false otherwise protected bool ShouldIgnore(DatItem datItem, bool ignoreBlanks) { @@ -559,12 +557,23 @@ namespace SabreTools.DatFiles if (!GetSupportedTypes().Contains(datItem.ItemType)) return true; - // TODO: Add code to filter out items missing fields - // Maybe it should be an abstract method that's overridden per type? + // If we have an item with missing required fields + if (!HasRequiredFields(datItem)) + return true; return false; } + /// + /// Determine if an item has all required fields to write out + /// + /// DatItem to check + /// True if the item has all required fields, false otherwise + /// + /// TODO: Implement this in all relevant DatFile types + /// + protected virtual bool HasRequiredFields(DatItem datItem) => true; + #endregion } }