2024-03-12 19:54:43 -04:00
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
using SabreTools.DatItems;
|
|
|
|
|
|
using SabreTools.DatItems.Formats;
|
|
|
|
|
|
|
|
|
|
|
|
namespace SabreTools.DatFiles.Formats
|
2017-10-09 18:04:49 -07:00
|
|
|
|
{
|
2019-01-11 13:43:15 -08:00
|
|
|
|
/// <summary>
|
2023-07-30 11:50:09 -04:00
|
|
|
|
/// Represents a RomCenter INI file
|
2019-01-11 13:43:15 -08:00
|
|
|
|
/// </summary>
|
2024-04-24 13:45:38 -04:00
|
|
|
|
internal sealed class RomCenter : SerializableDatFile<Models.RomCenter.MetadataFile, Serialization.Deserializers.RomCenter, Serialization.Serializers.RomCenter, Serialization.CrossModel.RomCenter>
|
2019-01-11 13:43:15 -08:00
|
|
|
|
{
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Constructor designed for casting a base DatFile
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="datFile">Parent DatFile to copy from</param>
|
2024-10-24 04:48:21 -04:00
|
|
|
|
public RomCenter(DatFile? datFile) : base(datFile)
|
2019-01-11 13:43:15 -08:00
|
|
|
|
{
|
|
|
|
|
|
}
|
2024-03-12 19:54:43 -04:00
|
|
|
|
|
|
|
|
|
|
/// <inheritdoc/>
|
|
|
|
|
|
protected override ItemType[] GetSupportedTypes()
|
|
|
|
|
|
{
|
|
|
|
|
|
return
|
|
|
|
|
|
[
|
|
|
|
|
|
ItemType.Rom
|
|
|
|
|
|
];
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <inheritdoc/>
|
|
|
|
|
|
protected override List<string>? GetMissingRequiredFields(DatItem datItem)
|
|
|
|
|
|
{
|
2024-12-06 23:16:09 -05:00
|
|
|
|
List<string> missingFields = [];
|
2024-03-12 19:54:43 -04:00
|
|
|
|
|
|
|
|
|
|
// Check item name
|
|
|
|
|
|
if (string.IsNullOrEmpty(datItem.GetName()))
|
|
|
|
|
|
missingFields.Add(Models.Metadata.Rom.NameKey);
|
|
|
|
|
|
|
|
|
|
|
|
switch (datItem)
|
|
|
|
|
|
{
|
|
|
|
|
|
case Rom rom:
|
|
|
|
|
|
if (string.IsNullOrEmpty(rom.GetStringFieldValue(Models.Metadata.Rom.CRCKey)))
|
|
|
|
|
|
missingFields.Add(Models.Metadata.Rom.CRCKey);
|
|
|
|
|
|
if (rom.GetInt64FieldValue(Models.Metadata.Rom.SizeKey) == null || rom.GetInt64FieldValue(Models.Metadata.Rom.SizeKey) < 0)
|
|
|
|
|
|
missingFields.Add(Models.Metadata.Rom.SizeKey);
|
|
|
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return missingFields;
|
|
|
|
|
|
}
|
2019-01-11 13:43:15 -08:00
|
|
|
|
}
|
2017-10-09 18:04:49 -07:00
|
|
|
|
}
|