mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
Add Listxml required fields checks
This commit is contained in:
@@ -47,8 +47,138 @@ namespace SabreTools.DatFiles.Formats
|
|||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
protected override List<DatItemField> GetMissingRequiredFields(DatItem datItem)
|
protected override List<DatItemField> GetMissingRequiredFields(DatItem datItem)
|
||||||
{
|
{
|
||||||
// TODO: Check required fields
|
var missingFields = new List<DatItemField>();
|
||||||
return null;
|
switch (datItem)
|
||||||
|
{
|
||||||
|
case BiosSet biosset:
|
||||||
|
if (string.IsNullOrWhiteSpace(biosset.Name))
|
||||||
|
missingFields.Add(DatItemField.Name);
|
||||||
|
if (string.IsNullOrWhiteSpace(biosset.Description))
|
||||||
|
missingFields.Add(DatItemField.Description);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Rom rom:
|
||||||
|
if (string.IsNullOrWhiteSpace(rom.Name))
|
||||||
|
missingFields.Add(DatItemField.Name);
|
||||||
|
if (rom.Size == null || rom.Size < 0)
|
||||||
|
missingFields.Add(DatItemField.Size);
|
||||||
|
if (string.IsNullOrWhiteSpace(rom.CRC)
|
||||||
|
&& string.IsNullOrWhiteSpace(rom.SHA1))
|
||||||
|
{
|
||||||
|
missingFields.Add(DatItemField.SHA1);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Disk disk:
|
||||||
|
if (string.IsNullOrWhiteSpace(disk.Name))
|
||||||
|
missingFields.Add(DatItemField.Name);
|
||||||
|
if (string.IsNullOrWhiteSpace(disk.MD5)
|
||||||
|
&& string.IsNullOrWhiteSpace(disk.SHA1))
|
||||||
|
{
|
||||||
|
missingFields.Add(DatItemField.SHA1);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case DeviceReference deviceref:
|
||||||
|
if (string.IsNullOrWhiteSpace(deviceref.Name))
|
||||||
|
missingFields.Add(DatItemField.Name);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Sample sample:
|
||||||
|
if (string.IsNullOrWhiteSpace(sample.Name))
|
||||||
|
missingFields.Add(DatItemField.Name);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Chip chip:
|
||||||
|
if (string.IsNullOrWhiteSpace(chip.Name))
|
||||||
|
missingFields.Add(DatItemField.Name);
|
||||||
|
if (!chip.ChipTypeSpecified)
|
||||||
|
missingFields.Add(DatItemField.ChipType);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Display display:
|
||||||
|
if (!display.DisplayTypeSpecified)
|
||||||
|
missingFields.Add(DatItemField.DisplayType);
|
||||||
|
if (display.Refresh == null)
|
||||||
|
missingFields.Add(DatItemField.Refresh);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Sound sound:
|
||||||
|
if (sound.Channels == null)
|
||||||
|
missingFields.Add(DatItemField.Channels);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Input input:
|
||||||
|
if (input.Players == null)
|
||||||
|
missingFields.Add(DatItemField.Players);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case DipSwitch dipswitch:
|
||||||
|
if (string.IsNullOrWhiteSpace(dipswitch.Name))
|
||||||
|
missingFields.Add(DatItemField.Name);
|
||||||
|
if (string.IsNullOrWhiteSpace(dipswitch.Tag))
|
||||||
|
missingFields.Add(DatItemField.Tag);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Configuration configuration:
|
||||||
|
if (string.IsNullOrWhiteSpace(configuration.Name))
|
||||||
|
missingFields.Add(DatItemField.Name);
|
||||||
|
if (string.IsNullOrWhiteSpace(configuration.Tag))
|
||||||
|
missingFields.Add(DatItemField.Tag);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Port port:
|
||||||
|
if (string.IsNullOrWhiteSpace(port.Tag))
|
||||||
|
missingFields.Add(DatItemField.Tag);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Adjuster adjuster:
|
||||||
|
if (string.IsNullOrWhiteSpace(adjuster.Name))
|
||||||
|
missingFields.Add(DatItemField.Name);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Driver driver:
|
||||||
|
if (!driver.StatusSpecified)
|
||||||
|
missingFields.Add(DatItemField.SupportStatus);
|
||||||
|
if (!driver.EmulationSpecified)
|
||||||
|
missingFields.Add(DatItemField.EmulationStatus);
|
||||||
|
if (!driver.CocktailSpecified)
|
||||||
|
missingFields.Add(DatItemField.CocktailStatus);
|
||||||
|
if (!driver.SaveStateSpecified)
|
||||||
|
missingFields.Add(DatItemField.SaveStateStatus);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Feature feature:
|
||||||
|
if (!feature.TypeSpecified)
|
||||||
|
missingFields.Add(DatItemField.FeatureType);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Device device:
|
||||||
|
if (!device.DeviceTypeSpecified)
|
||||||
|
missingFields.Add(DatItemField.DeviceType);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Slot slot:
|
||||||
|
if (string.IsNullOrWhiteSpace(slot.Name))
|
||||||
|
missingFields.Add(DatItemField.Name);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case DatItems.Formats.SoftwareList softwarelist:
|
||||||
|
if (string.IsNullOrWhiteSpace(softwarelist.Tag))
|
||||||
|
missingFields.Add(DatItemField.Tag);
|
||||||
|
if (string.IsNullOrWhiteSpace(softwarelist.Name))
|
||||||
|
missingFields.Add(DatItemField.Name);
|
||||||
|
if (!softwarelist.StatusSpecified)
|
||||||
|
missingFields.Add(DatItemField.SoftwareListStatus);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case RamOption ramoption:
|
||||||
|
if (string.IsNullOrWhiteSpace(ramoption.Name))
|
||||||
|
missingFields.Add(DatItemField.Name);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return missingFields;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ namespace SabreTools.Models.Listxml
|
|||||||
|
|
||||||
/// <remarks>(yes|no) "no"</remarks>
|
/// <remarks>(yes|no) "no"</remarks>
|
||||||
[XmlAttribute("default")]
|
[XmlAttribute("default")]
|
||||||
public string Default { get; set; }
|
public string? Default { get; set; }
|
||||||
|
|
||||||
[XmlElement("condition")]
|
[XmlElement("condition")]
|
||||||
public Condition? Condition { get; set; }
|
public Condition? Condition { get; set; }
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ namespace SabreTools.Models.Listxml
|
|||||||
|
|
||||||
/// <remarks>Only present in older versions</remarks>
|
/// <remarks>Only present in older versions</remarks>
|
||||||
[XmlAttribute("soundonly")]
|
[XmlAttribute("soundonly")]
|
||||||
public string SoundOnly { get; set; }
|
public string? SoundOnly { get; set; }
|
||||||
|
|
||||||
[XmlAttribute("clock")]
|
[XmlAttribute("clock")]
|
||||||
public string? Clock { get; set; }
|
public string? Clock { get; set; }
|
||||||
|
|||||||
@@ -12,15 +12,15 @@ namespace SabreTools.Models.Listxml
|
|||||||
|
|
||||||
/// <remarks>(good|imperfect|preliminary), Only present in older versions</remarks>
|
/// <remarks>(good|imperfect|preliminary), Only present in older versions</remarks>
|
||||||
[XmlAttribute("color")]
|
[XmlAttribute("color")]
|
||||||
public string Color { get; set; }
|
public string? Color { get; set; }
|
||||||
|
|
||||||
/// <remarks>(good|imperfect|preliminary), Only present in older versions</remarks>
|
/// <remarks>(good|imperfect|preliminary), Only present in older versions</remarks>
|
||||||
[XmlAttribute("sound")]
|
[XmlAttribute("sound")]
|
||||||
public string Sound { get; set; }
|
public string? Sound { get; set; }
|
||||||
|
|
||||||
/// <remarks>Only present in older versions</remarks>
|
/// <remarks>Only present in older versions</remarks>
|
||||||
[XmlAttribute("palettesize")]
|
[XmlAttribute("palettesize")]
|
||||||
public string PaletteSize { get; set; }
|
public string? PaletteSize { get; set; }
|
||||||
|
|
||||||
/// <remarks>(good|imperfect|preliminary)</remarks>
|
/// <remarks>(good|imperfect|preliminary)</remarks>
|
||||||
[XmlAttribute("emulation")]
|
[XmlAttribute("emulation")]
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ namespace SabreTools.Models.Listxml
|
|||||||
|
|
||||||
/// <remarks>Only present in older versions, Numeric?</remarks>
|
/// <remarks>Only present in older versions, Numeric?</remarks>
|
||||||
[XmlAttribute("buttons")]
|
[XmlAttribute("buttons")]
|
||||||
public string Buttons { get; set; }
|
public string? Buttons { get; set; }
|
||||||
|
|
||||||
/// <remarks>Numeric?</remarks>
|
/// <remarks>Numeric?</remarks>
|
||||||
[XmlAttribute("coins")]
|
[XmlAttribute("coins")]
|
||||||
|
|||||||
Reference in New Issue
Block a user