DatItems don't know about removing fields or ORPG

This commit is contained in:
Matt Nadareski
2020-12-13 23:09:24 -08:00
parent 8286fa6eb5
commit 8a354e9156
44 changed files with 1392 additions and 1924 deletions

View File

@@ -1,5 +1,4 @@
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Xml.Serialization;
@@ -262,75 +261,6 @@ namespace SabreTools.DatItems
#endregion
#region Filtering
/// <inheritdoc/>
public override void RemoveFields(
List<DatItemField> datItemFields,
List<MachineField> machineFields)
{
// Remove common fields first
base.RemoveFields(datItemFields, machineFields);
// Remove the fields
#region Common
if (datItemFields.Contains(DatItemField.Name))
Name = null;
if (datItemFields.Contains(DatItemField.Tag))
Tag = null;
if (datItemFields.Contains(DatItemField.Mask))
Mask = null;
if (ConditionsSpecified)
{
foreach (Condition condition in Conditions)
{
condition.RemoveFields(datItemFields, machineFields, true);
}
}
if (LocationsSpecified)
{
foreach (Location location in Locations)
{
location.RemoveFields(datItemFields, machineFields);
}
}
if (ValuesSpecified)
{
foreach (Setting value in Values)
{
value.RemoveFields(datItemFields, machineFields);
}
}
#endregion
#region SoftwareList
if (PartSpecified)
Part.RemoveFields(datItemFields, machineFields);
#endregion
}
/// <summary>
/// Set internal names to match One Rom Per Game (ORPG) logic
/// </summary>
public override void SetOneRomPerGame()
{
string[] splitname = Name.Split('.');
Machine.Name += $"/{string.Join(".", splitname.Take(splitname.Length > 1 ? splitname.Length - 1 : 1))}";
Name = Path.GetFileName(Name);
}
#endregion
#region Sorting and Merging
/// <inheritdoc/>