mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
DatItems don't know about removing fields or ORPG
This commit is contained in:
@@ -64,7 +64,7 @@ in -old DAT file. Ignores those entries in -old that are not in -new.";
|
||||
|
||||
// Diff against the new datfile
|
||||
DatFile intDat = Parser.CreateAndParse(newdat);
|
||||
DatTool.DiffAgainst(datfile, intDat, false);
|
||||
DatFileTool.DiffAgainst(datfile, intDat, false);
|
||||
Writer.Write(intDat, outdat);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -56,7 +56,7 @@ namespace RombaSharp.Features
|
||||
|
||||
// Diff against the new datfile
|
||||
DatFile intDat = Parser.CreateAndParse(newdat);
|
||||
DatTool.DiffAgainst(datfile, intDat, false);
|
||||
DatFileTool.DiffAgainst(datfile, intDat, false);
|
||||
Writer.Write(intDat, outdat);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
@@ -151,44 +150,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
|
||||
if (datItemFields.Contains(DatItemField.Name))
|
||||
Name = null;
|
||||
|
||||
if (datItemFields.Contains(DatItemField.Default))
|
||||
Default = null;
|
||||
|
||||
if (ConditionsSpecified)
|
||||
{
|
||||
foreach (Condition condition in Conditions)
|
||||
{
|
||||
condition.RemoveFields(datItemFields, machineFields, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <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/>
|
||||
|
||||
@@ -89,23 +89,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
|
||||
if (datItemFields.Contains(DatItemField.Analog_Mask))
|
||||
Mask = null;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Sorting and Merging
|
||||
|
||||
/// <inheritdoc/>
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
@@ -103,33 +102,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
|
||||
if (datItemFields.Contains(DatItemField.Name))
|
||||
Name = null;
|
||||
}
|
||||
|
||||
/// <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/>
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
@@ -131,39 +130,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
|
||||
if (datItemFields.Contains(DatItemField.Name))
|
||||
Name = null;
|
||||
|
||||
if (datItemFields.Contains(DatItemField.Description))
|
||||
Description = null;
|
||||
|
||||
if (datItemFields.Contains(DatItemField.Default))
|
||||
Default = null;
|
||||
}
|
||||
|
||||
/// <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/>
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
@@ -149,42 +148,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
|
||||
if (datItemFields.Contains(DatItemField.Name))
|
||||
Name = null;
|
||||
|
||||
if (datItemFields.Contains(DatItemField.Tag))
|
||||
Tag = null;
|
||||
|
||||
if (datItemFields.Contains(DatItemField.ChipType))
|
||||
ChipType = ChipType.NULL;
|
||||
|
||||
if (datItemFields.Contains(DatItemField.Clock))
|
||||
Clock = null;
|
||||
}
|
||||
|
||||
/// <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/>
|
||||
|
||||
@@ -162,63 +162,6 @@ namespace SabreTools.DatItems
|
||||
|
||||
#endregion
|
||||
|
||||
#region Filtering
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override void RemoveFields(
|
||||
List<DatItemField> datItemFields,
|
||||
List<MachineField> machineFields)
|
||||
{
|
||||
RemoveFields(datItemFields, machineFields, false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Remove fields from the DatItem
|
||||
/// </summary>
|
||||
/// <param name="datItemMappings">DatItem fields to remove</param>
|
||||
/// <param name="machineMappings">Machine fields to remove</param>
|
||||
/// <param name="sub">True if this is a subitem, false otherwise</param>
|
||||
public void RemoveFields(
|
||||
List<DatItemField> datItemFields,
|
||||
List<MachineField> machineFields,
|
||||
bool sub)
|
||||
{
|
||||
// Remove common fields first
|
||||
base.RemoveFields(datItemFields, machineFields);
|
||||
|
||||
// Remove the fields
|
||||
if (sub)
|
||||
{
|
||||
if (datItemFields.Contains(DatItemField.Condition_Tag))
|
||||
Tag = null;
|
||||
|
||||
if (datItemFields.Contains(DatItemField.Condition_Mask))
|
||||
Mask = null;
|
||||
|
||||
if (datItemFields.Contains(DatItemField.Condition_Relation))
|
||||
Relation = Relation.NULL;
|
||||
|
||||
if (datItemFields.Contains(DatItemField.Condition_Value))
|
||||
Value = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (datItemFields.Contains(DatItemField.Tag))
|
||||
Tag = null;
|
||||
|
||||
if (datItemFields.Contains(DatItemField.Mask))
|
||||
Mask = null;
|
||||
|
||||
if (datItemFields.Contains(DatItemField.Relation))
|
||||
Relation = Relation.NULL;
|
||||
|
||||
if (datItemFields.Contains(DatItemField.Value))
|
||||
Value = null;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Sorting and Merging
|
||||
|
||||
/// <inheritdoc/>
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
@@ -215,63 +214,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
|
||||
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 (SettingsSpecified)
|
||||
{
|
||||
foreach (Setting setting in Settings)
|
||||
{
|
||||
setting.RemoveFields(datItemFields, machineFields);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <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/>
|
||||
|
||||
@@ -252,56 +252,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
|
||||
if (datItemFields.Contains(DatItemField.Control_Type))
|
||||
ControlType = ControlType.NULL;
|
||||
|
||||
if (datItemFields.Contains(DatItemField.Control_Player))
|
||||
Player = null;
|
||||
|
||||
if (datItemFields.Contains(DatItemField.Control_Buttons))
|
||||
Buttons = null;
|
||||
|
||||
if (datItemFields.Contains(DatItemField.Control_RequiredButtons))
|
||||
RequiredButtons = null;
|
||||
|
||||
if (datItemFields.Contains(DatItemField.Control_Minimum))
|
||||
Minimum = null;
|
||||
|
||||
if (datItemFields.Contains(DatItemField.Control_Maximum))
|
||||
Maximum = null;
|
||||
|
||||
if (datItemFields.Contains(DatItemField.Control_Sensitivity))
|
||||
Sensitivity = null;
|
||||
|
||||
if (datItemFields.Contains(DatItemField.Control_KeyDelta))
|
||||
KeyDelta = null;
|
||||
|
||||
if (datItemFields.Contains(DatItemField.Control_Reverse))
|
||||
Reverse = null;
|
||||
|
||||
if (datItemFields.Contains(DatItemField.Control_Ways))
|
||||
Ways = null;
|
||||
|
||||
if (datItemFields.Contains(DatItemField.Control_Ways2))
|
||||
Ways2 = null;
|
||||
|
||||
if (datItemFields.Contains(DatItemField.Control_Ways3))
|
||||
Ways3 = null;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Sorting and Merging
|
||||
|
||||
/// <inheritdoc/>
|
||||
|
||||
@@ -455,25 +455,6 @@ namespace SabreTools.DatItems
|
||||
|
||||
#region Filtering
|
||||
|
||||
/// <summary>
|
||||
/// Remove fields from the DatItem
|
||||
/// </summary>
|
||||
/// <param name="datItemFields">DatItem fields to remove</param>
|
||||
/// <param name="machineFields">Machine fields to remove</param>
|
||||
/// TODO: Fix case where datItemFields is null
|
||||
public virtual void RemoveFields(
|
||||
List<DatItemField> datItemFields,
|
||||
List<MachineField> machineFields)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set internal names to match One Rom Per Game (ORPG) logic
|
||||
/// </summary>
|
||||
public virtual void SetOneRomPerGame()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Clean a CRC32 string and pad to the correct size
|
||||
/// </summary>
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
@@ -151,42 +150,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
|
||||
if (datItemFields.Contains(DatItemField.AreaName))
|
||||
Name = null;
|
||||
|
||||
if (datItemFields.Contains(DatItemField.AreaSize))
|
||||
Size = null;
|
||||
|
||||
if (datItemFields.Contains(DatItemField.AreaWidth))
|
||||
Width = null;
|
||||
|
||||
if (datItemFields.Contains(DatItemField.AreaEndianness))
|
||||
Endianness = Endianness.NULL;
|
||||
}
|
||||
|
||||
/// <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/>
|
||||
|
||||
@@ -207,51 +207,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
|
||||
if (datItemFields.Contains(DatItemField.DeviceType))
|
||||
DeviceType = DeviceType.NULL;
|
||||
|
||||
if (datItemFields.Contains(DatItemField.Tag))
|
||||
Tag = null;
|
||||
|
||||
if (datItemFields.Contains(DatItemField.FixedImage))
|
||||
FixedImage = null;
|
||||
|
||||
if (datItemFields.Contains(DatItemField.Mandatory))
|
||||
Mandatory = null;
|
||||
|
||||
if (datItemFields.Contains(DatItemField.Interface))
|
||||
Interface = null;
|
||||
|
||||
if (InstancesSpecified)
|
||||
{
|
||||
foreach (Instance instance in Instances)
|
||||
{
|
||||
instance.RemoveFields(datItemFields, machineFields);
|
||||
}
|
||||
}
|
||||
|
||||
if (ExtensionsSpecified)
|
||||
{
|
||||
foreach (Extension extension in Extensions)
|
||||
{
|
||||
extension.RemoveFields(datItemFields, machineFields);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Sorting and Merging
|
||||
|
||||
/// <inheritdoc/>
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
@@ -103,33 +102,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
|
||||
if (datItemFields.Contains(DatItemField.Name))
|
||||
Name = null;
|
||||
}
|
||||
|
||||
/// <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/>
|
||||
|
||||
@@ -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/>
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
@@ -422,72 +421,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.MD5))
|
||||
MD5 = null;
|
||||
|
||||
if (datItemFields.Contains(DatItemField.SHA1))
|
||||
SHA1 = null;
|
||||
|
||||
if (datItemFields.Contains(DatItemField.Merge))
|
||||
MergeTag = null;
|
||||
|
||||
if (datItemFields.Contains(DatItemField.Region))
|
||||
Region = null;
|
||||
|
||||
if (datItemFields.Contains(DatItemField.Index))
|
||||
Index = null;
|
||||
|
||||
if (datItemFields.Contains(DatItemField.Writable))
|
||||
Writable = null;
|
||||
|
||||
if (datItemFields.Contains(DatItemField.Status))
|
||||
ItemStatus = ItemStatus.NULL;
|
||||
|
||||
if (datItemFields.Contains(DatItemField.Optional))
|
||||
Optional = null;
|
||||
|
||||
#endregion
|
||||
|
||||
#region SoftwareList
|
||||
|
||||
if (DiskAreaSpecified)
|
||||
DiskArea.RemoveFields(datItemFields, machineFields);
|
||||
|
||||
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
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
@@ -105,33 +104,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
|
||||
if (datItemFields.Contains(DatItemField.AreaName))
|
||||
Name = null;
|
||||
}
|
||||
|
||||
/// <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/>
|
||||
|
||||
@@ -291,62 +291,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
|
||||
if (datItemFields.Contains(DatItemField.Tag))
|
||||
Tag = null;
|
||||
|
||||
if (datItemFields.Contains(DatItemField.DisplayType))
|
||||
DisplayType = DisplayType.NULL;
|
||||
|
||||
if (datItemFields.Contains(DatItemField.Rotate))
|
||||
Rotate = null;
|
||||
|
||||
if (datItemFields.Contains(DatItemField.FlipX))
|
||||
FlipX = null;
|
||||
|
||||
if (datItemFields.Contains(DatItemField.Width))
|
||||
Width = null;
|
||||
|
||||
if (datItemFields.Contains(DatItemField.Height))
|
||||
Height = null;
|
||||
|
||||
if (datItemFields.Contains(DatItemField.Refresh))
|
||||
Refresh = null;
|
||||
|
||||
if (datItemFields.Contains(DatItemField.PixClock))
|
||||
PixClock = null;
|
||||
|
||||
if (datItemFields.Contains(DatItemField.HTotal))
|
||||
HTotal = null;
|
||||
|
||||
if (datItemFields.Contains(DatItemField.HBEnd))
|
||||
HBEnd = null;
|
||||
|
||||
if (datItemFields.Contains(DatItemField.HBStart))
|
||||
HBStart = null;
|
||||
|
||||
if (datItemFields.Contains(DatItemField.VTotal))
|
||||
VTotal = null;
|
||||
|
||||
if (datItemFields.Contains(DatItemField.VBEnd))
|
||||
VBEnd = null;
|
||||
|
||||
if (datItemFields.Contains(DatItemField.VBStart))
|
||||
VBStart = null;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Sorting and Merging
|
||||
|
||||
/// <inheritdoc/>
|
||||
|
||||
@@ -143,32 +143,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
|
||||
if (datItemFields.Contains(DatItemField.SupportStatus))
|
||||
Status = SupportStatus.NULL;
|
||||
|
||||
if (datItemFields.Contains(DatItemField.EmulationStatus))
|
||||
Emulation = SupportStatus.NULL;
|
||||
|
||||
if (datItemFields.Contains(DatItemField.CocktailStatus))
|
||||
Cocktail = SupportStatus.NULL;
|
||||
|
||||
if (datItemFields.Contains(DatItemField.SaveStateStatus))
|
||||
SaveState = Supported.NULL;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Sorting and Merging
|
||||
|
||||
/// <inheritdoc/>
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
@@ -103,33 +102,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
|
||||
if (datItemFields.Contains(DatItemField.Extension_Name))
|
||||
Name = null;
|
||||
}
|
||||
|
||||
/// <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/>
|
||||
|
||||
@@ -125,29 +125,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
|
||||
if (datItemFields.Contains(DatItemField.FeatureType))
|
||||
Type = FeatureType.NULL;
|
||||
|
||||
if (datItemFields.Contains(DatItemField.FeatureStatus))
|
||||
Status = FeatureStatus.NULL;
|
||||
|
||||
if (datItemFields.Contains(DatItemField.FeatureOverall))
|
||||
Overall = FeatureStatus.NULL;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Sorting and Merging
|
||||
|
||||
/// <inheritdoc/>
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
@@ -114,36 +113,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
|
||||
if (datItemFields.Contains(DatItemField.Name))
|
||||
Name = null;
|
||||
|
||||
if (datItemFields.Contains(DatItemField.Value))
|
||||
Value = null;
|
||||
}
|
||||
|
||||
/// <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/>
|
||||
|
||||
@@ -171,40 +171,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
|
||||
if (datItemFields.Contains(DatItemField.Service))
|
||||
Service = null;
|
||||
|
||||
if (datItemFields.Contains(DatItemField.Tilt))
|
||||
Tilt = null;
|
||||
|
||||
if (datItemFields.Contains(DatItemField.Players))
|
||||
Players = 0;
|
||||
|
||||
if (datItemFields.Contains(DatItemField.Coins))
|
||||
Coins = null;
|
||||
|
||||
if (ControlsSpecified)
|
||||
{
|
||||
foreach (Control control in Controls)
|
||||
{
|
||||
control.RemoveFields(datItemFields, machineFields);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Sorting and Merging
|
||||
|
||||
/// <inheritdoc/>
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
@@ -114,36 +113,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
|
||||
if (datItemFields.Contains(DatItemField.Instance_Name))
|
||||
Name = null;
|
||||
|
||||
if (datItemFields.Contains(DatItemField.Instance_BriefName))
|
||||
BriefName = null;
|
||||
}
|
||||
|
||||
/// <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/>
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
@@ -134,39 +133,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
|
||||
if (datItemFields.Contains(DatItemField.Location_Name))
|
||||
Name = null;
|
||||
|
||||
if (datItemFields.Contains(DatItemField.Location_Number))
|
||||
Number = null;
|
||||
|
||||
if (datItemFields.Contains(DatItemField.Location_Inverted))
|
||||
Inverted = null;
|
||||
}
|
||||
|
||||
/// <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/>
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Xml.Serialization;
|
||||
@@ -321,45 +320,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
|
||||
if (datItemFields.Contains(DatItemField.Name))
|
||||
Name = null;
|
||||
|
||||
if (datItemFields.Contains(DatItemField.MD5))
|
||||
MD5 = null;
|
||||
|
||||
if (datItemFields.Contains(DatItemField.SHA1))
|
||||
SHA1 = null;
|
||||
|
||||
if (datItemFields.Contains(DatItemField.SHA256))
|
||||
SHA256 = null;
|
||||
|
||||
if (datItemFields.Contains(DatItemField.SpamSum))
|
||||
SpamSum = null;
|
||||
}
|
||||
|
||||
/// <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
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
@@ -141,44 +140,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
|
||||
if (datItemFields.Contains(DatItemField.Part_Name))
|
||||
Name = null;
|
||||
|
||||
if (datItemFields.Contains(DatItemField.Part_Interface))
|
||||
Interface = null;
|
||||
|
||||
if (FeaturesSpecified)
|
||||
{
|
||||
foreach (PartFeature partFeature in Features)
|
||||
{
|
||||
partFeature.RemoveFields(datItemFields, machineFields);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <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/>
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
@@ -114,36 +113,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
|
||||
if (datItemFields.Contains(DatItemField.Part_Feature_Name))
|
||||
Name = null;
|
||||
|
||||
if (datItemFields.Contains(DatItemField.Part_Feature_Value))
|
||||
Value = null;
|
||||
}
|
||||
|
||||
/// <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/>
|
||||
|
||||
@@ -121,31 +121,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
|
||||
if (datItemFields.Contains(DatItemField.Tag))
|
||||
Tag = null;
|
||||
|
||||
if (AnalogsSpecified)
|
||||
{
|
||||
foreach (Analog analog in Analogs)
|
||||
{
|
||||
analog.RemoveFields(datItemFields, machineFields);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Sorting and Merging
|
||||
|
||||
/// <inheritdoc/>
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
@@ -129,39 +128,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
|
||||
if (datItemFields.Contains(DatItemField.Name))
|
||||
Name = null;
|
||||
|
||||
if (datItemFields.Contains(DatItemField.Default))
|
||||
Default = null;
|
||||
|
||||
if (datItemFields.Contains(DatItemField.Content))
|
||||
Content = null;
|
||||
}
|
||||
|
||||
/// <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/>
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
@@ -159,45 +158,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
|
||||
if (datItemFields.Contains(DatItemField.Name))
|
||||
Name = null;
|
||||
|
||||
if (datItemFields.Contains(DatItemField.Region))
|
||||
Region = null;
|
||||
|
||||
if (datItemFields.Contains(DatItemField.Language))
|
||||
Language = null;
|
||||
|
||||
if (datItemFields.Contains(DatItemField.Date))
|
||||
Date = null;
|
||||
|
||||
if (datItemFields.Contains(DatItemField.Default))
|
||||
Default = null;
|
||||
}
|
||||
|
||||
/// <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/>
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Xml.Serialization;
|
||||
@@ -795,136 +794,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.Bios))
|
||||
Bios = null;
|
||||
|
||||
if (datItemFields.Contains(DatItemField.Size))
|
||||
Size = 0;
|
||||
|
||||
if (datItemFields.Contains(DatItemField.CRC))
|
||||
CRC = null;
|
||||
|
||||
if (datItemFields.Contains(DatItemField.MD5))
|
||||
MD5 = null;
|
||||
|
||||
#if NET_FRAMEWORK
|
||||
if (datItemFields.Contains(DatItemField.RIPEMD160))
|
||||
RIPEMD160 = null;
|
||||
#endif
|
||||
|
||||
if (datItemFields.Contains(DatItemField.SHA1))
|
||||
SHA1 = null;
|
||||
|
||||
if (datItemFields.Contains(DatItemField.SHA256))
|
||||
SHA256 = null;
|
||||
|
||||
if (datItemFields.Contains(DatItemField.SHA384))
|
||||
SHA384 = null;
|
||||
|
||||
if (datItemFields.Contains(DatItemField.SHA512))
|
||||
SHA512 = null;
|
||||
|
||||
if (datItemFields.Contains(DatItemField.SpamSum))
|
||||
SpamSum = null;
|
||||
|
||||
if (datItemFields.Contains(DatItemField.Merge))
|
||||
MergeTag = null;
|
||||
|
||||
if (datItemFields.Contains(DatItemField.Region))
|
||||
Region = null;
|
||||
|
||||
if (datItemFields.Contains(DatItemField.Offset))
|
||||
Offset = null;
|
||||
|
||||
if (datItemFields.Contains(DatItemField.Date))
|
||||
Date = null;
|
||||
|
||||
if (datItemFields.Contains(DatItemField.Status))
|
||||
ItemStatus = ItemStatus.NULL;
|
||||
|
||||
if (datItemFields.Contains(DatItemField.Optional))
|
||||
Optional = null;
|
||||
|
||||
if (datItemFields.Contains(DatItemField.Inverted))
|
||||
Inverted = null;
|
||||
|
||||
#endregion
|
||||
|
||||
#region AttractMode
|
||||
|
||||
if (datItemFields.Contains(DatItemField.AltName))
|
||||
AltName = null;
|
||||
|
||||
if (datItemFields.Contains(DatItemField.AltTitle))
|
||||
AltTitle = null;
|
||||
|
||||
#endregion
|
||||
|
||||
#region OpenMSX
|
||||
|
||||
if (datItemFields.Contains(DatItemField.Original))
|
||||
Original = null;
|
||||
|
||||
if (datItemFields.Contains(DatItemField.OpenMSXSubType))
|
||||
OpenMSXSubType = OpenMSXSubType.NULL;
|
||||
|
||||
if (datItemFields.Contains(DatItemField.OpenMSXType))
|
||||
OpenMSXType = null;
|
||||
|
||||
if (datItemFields.Contains(DatItemField.Remark))
|
||||
Remark = null;
|
||||
|
||||
if (datItemFields.Contains(DatItemField.Boot))
|
||||
Boot = null;
|
||||
|
||||
#endregion
|
||||
|
||||
#region SoftwareList
|
||||
|
||||
if (datItemFields.Contains(DatItemField.LoadFlag))
|
||||
LoadFlag = LoadFlag.NULL;
|
||||
|
||||
if (datItemFields.Contains(DatItemField.Value))
|
||||
Value = null;
|
||||
|
||||
if (DataAreaSpecified)
|
||||
DataArea.RemoveFields(datItemFields, machineFields);
|
||||
|
||||
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
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
@@ -103,33 +102,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
|
||||
if (datItemFields.Contains(DatItemField.Name))
|
||||
Name = null;
|
||||
}
|
||||
|
||||
/// <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/>
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
@@ -163,47 +162,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
|
||||
if (datItemFields.Contains(DatItemField.Setting_Name))
|
||||
Name = null;
|
||||
|
||||
if (datItemFields.Contains(DatItemField.Setting_Value))
|
||||
Value = null;
|
||||
|
||||
if (datItemFields.Contains(DatItemField.Setting_Default))
|
||||
Default = null;
|
||||
|
||||
if (ConditionsSpecified)
|
||||
{
|
||||
foreach (Condition condition in Conditions)
|
||||
{
|
||||
condition.RemoveFields(datItemFields, machineFields, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <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/>
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
@@ -114,36 +113,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
|
||||
if (datItemFields.Contains(DatItemField.Name))
|
||||
Name = null;
|
||||
|
||||
if (datItemFields.Contains(DatItemField.Value))
|
||||
Value = null;
|
||||
}
|
||||
|
||||
/// <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/>
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
@@ -135,41 +134,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
|
||||
if (datItemFields.Contains(DatItemField.Name))
|
||||
Name = null;
|
||||
|
||||
if (SlotOptionsSpecified)
|
||||
{
|
||||
foreach (SlotOption slotOption in SlotOptions)
|
||||
{
|
||||
slotOption.RemoveFields(datItemFields, machineFields);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <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/>
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
@@ -131,39 +130,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
|
||||
if (datItemFields.Contains(DatItemField.SlotOption_Name))
|
||||
Name = null;
|
||||
|
||||
if (datItemFields.Contains(DatItemField.SlotOption_DeviceName))
|
||||
DeviceName = null;
|
||||
|
||||
if (datItemFields.Contains(DatItemField.SlotOption_Default))
|
||||
Default = null;
|
||||
}
|
||||
|
||||
/// <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/>
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
@@ -133,39 +132,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
|
||||
if (datItemFields.Contains(DatItemField.Name))
|
||||
Name = null;
|
||||
|
||||
if (datItemFields.Contains(DatItemField.SoftwareListStatus))
|
||||
Status = SoftwareListStatus.NULL;
|
||||
|
||||
if (datItemFields.Contains(DatItemField.Filter))
|
||||
Filter = null;
|
||||
}
|
||||
|
||||
/// <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/>
|
||||
|
||||
@@ -94,23 +94,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
|
||||
if (datItemFields.Contains(DatItemField.Channels))
|
||||
Channels = null;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Sorting and Merging
|
||||
|
||||
/// <inheritdoc/>
|
||||
|
||||
@@ -13,7 +13,7 @@ using SabreTools.Logging;
|
||||
namespace SabreTools.DatTools
|
||||
{
|
||||
// This file represents all methods related to converting and updating DatFiles
|
||||
public class DatTool
|
||||
public class DatFileTool
|
||||
{
|
||||
#region Logging
|
||||
|
||||
@@ -87,7 +87,7 @@ namespace SabreTools.DatTools
|
||||
{
|
||||
DatItem newDatItem = datItem.Clone() as DatItem;
|
||||
if (datFile.Items.ContainsKey(key) && datFile.Items[key].Count() > 0)
|
||||
Cleaner.ReplaceFields(newDatItem.Machine, datFile.Items[key][0].Machine, machineFields, onlySame);
|
||||
DatItemTool.ReplaceFields(newDatItem.Machine, datFile.Items[key][0].Machine, machineFields, onlySame);
|
||||
|
||||
newDatItems.Add(newDatItem);
|
||||
}
|
||||
1377
SabreTools.DatTools/DatItemTool.cs
Normal file
1377
SabreTools.DatTools/DatItemTool.cs
Normal file
File diff suppressed because it is too large
Load Diff
@@ -146,7 +146,7 @@ namespace SabreTools.DatTools
|
||||
|
||||
foreach (var datItem in datItems)
|
||||
{
|
||||
Cleaner.SetFields(datItem.Machine, mappings);
|
||||
DatItemTool.SetFields(datItem.Machine, mappings);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -493,7 +493,7 @@ namespace SabreTools.DatTools
|
||||
List<DatItem> items = datFile.Items[key];
|
||||
for (int i = 0; i < items.Count; i++)
|
||||
{
|
||||
items[i].SetOneRomPerGame();
|
||||
DatItemTool.SetOneRomPerGame(items[i]);
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -524,8 +524,7 @@ namespace SabreTools.DatTools
|
||||
List<DatItem> items = datFile.Items[key];
|
||||
for (int j = 0; j < items.Count; j++)
|
||||
{
|
||||
items[j].RemoveFields(datItemFields, null);
|
||||
Cleaner.RemoveFields(items[j].Machine, machineFields);
|
||||
DatItemTool.RemoveFields(items[j], datItemFields, machineFields);
|
||||
}
|
||||
|
||||
datFile.Items.Remove(key);
|
||||
|
||||
@@ -4,7 +4,6 @@ using System.Linq;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
using SabreTools.Core;
|
||||
using SabreTools.Core.Tools;
|
||||
using SabreTools.DatItems;
|
||||
|
||||
namespace SabreTools.Filtering
|
||||
@@ -329,474 +328,6 @@ namespace SabreTools.Filtering
|
||||
|
||||
#endregion
|
||||
|
||||
// TODO: Use these instead of the baked in ones
|
||||
// TODO: Move to new class?
|
||||
#region Field Manipulation
|
||||
|
||||
/// <summary>
|
||||
/// Remove fields with given values
|
||||
/// </summary>
|
||||
/// <param name="datItem">DatItem to remove fields from</param>
|
||||
/// <param name="fields">List of fields to remove</param>
|
||||
public static void RemoveFields(DatItem datItem, List<DatItemField> fields)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Remove fields with given values
|
||||
/// </summary>
|
||||
/// <param name="machine">Machine to remove fields from</param>
|
||||
/// <param name="fields">List of fields to remove</param>
|
||||
public static void RemoveFields(Machine machine, List<MachineField> fields)
|
||||
{
|
||||
#region Common
|
||||
|
||||
if (fields.Contains(MachineField.Name))
|
||||
machine.Name = null;
|
||||
|
||||
if (fields.Contains(MachineField.Comment))
|
||||
machine.Comment = null;
|
||||
|
||||
if (fields.Contains(MachineField.Description))
|
||||
machine.Description = null;
|
||||
|
||||
if (fields.Contains(MachineField.Year))
|
||||
machine.Year = null;
|
||||
|
||||
if (fields.Contains(MachineField.Manufacturer))
|
||||
machine.Manufacturer = null;
|
||||
|
||||
if (fields.Contains(MachineField.Publisher))
|
||||
machine.Publisher = null;
|
||||
|
||||
if (fields.Contains(MachineField.Category))
|
||||
machine.Category = null;
|
||||
|
||||
if (fields.Contains(MachineField.RomOf))
|
||||
machine.RomOf = null;
|
||||
|
||||
if (fields.Contains(MachineField.CloneOf))
|
||||
machine.CloneOf = null;
|
||||
|
||||
if (fields.Contains(MachineField.SampleOf))
|
||||
machine.SampleOf = null;
|
||||
|
||||
if (fields.Contains(MachineField.Type))
|
||||
machine.MachineType = 0x0;
|
||||
|
||||
#endregion
|
||||
|
||||
#region AttractMode
|
||||
|
||||
if (fields.Contains(MachineField.Players))
|
||||
machine.Players = null;
|
||||
|
||||
if (fields.Contains(MachineField.Rotation))
|
||||
machine.Rotation = null;
|
||||
|
||||
if (fields.Contains(MachineField.Control))
|
||||
machine.Control = null;
|
||||
|
||||
if (fields.Contains(MachineField.Status))
|
||||
machine.Status = null;
|
||||
|
||||
if (fields.Contains(MachineField.DisplayCount))
|
||||
machine.DisplayCount = null;
|
||||
|
||||
if (fields.Contains(MachineField.DisplayType))
|
||||
machine.DisplayType = null;
|
||||
|
||||
if (fields.Contains(MachineField.Buttons))
|
||||
machine.Buttons = null;
|
||||
|
||||
#endregion
|
||||
|
||||
#region ListXML
|
||||
|
||||
if (fields.Contains(MachineField.SourceFile))
|
||||
machine.SourceFile = null;
|
||||
|
||||
if (fields.Contains(MachineField.Runnable))
|
||||
machine.Runnable = Runnable.NULL;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Logiqx
|
||||
|
||||
if (fields.Contains(MachineField.Board))
|
||||
machine.Board = null;
|
||||
|
||||
if (fields.Contains(MachineField.RebuildTo))
|
||||
machine.RebuildTo = null;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Logiqx EmuArc
|
||||
|
||||
if (fields.Contains(MachineField.TitleID))
|
||||
machine.TitleID = null;
|
||||
|
||||
if (fields.Contains(MachineField.Developer))
|
||||
machine.Developer = null;
|
||||
|
||||
if (fields.Contains(MachineField.Genre))
|
||||
machine.Genre = null;
|
||||
|
||||
if (fields.Contains(MachineField.Subgenre))
|
||||
machine.Subgenre = null;
|
||||
|
||||
if (fields.Contains(MachineField.Ratings))
|
||||
machine.Ratings = null;
|
||||
|
||||
if (fields.Contains(MachineField.Score))
|
||||
machine.Score = null;
|
||||
|
||||
if (fields.Contains(MachineField.Enabled))
|
||||
machine.Enabled = null;
|
||||
|
||||
if (fields.Contains(MachineField.CRC))
|
||||
machine.Crc = null;
|
||||
|
||||
if (fields.Contains(MachineField.RelatedTo))
|
||||
machine.RelatedTo = null;
|
||||
|
||||
#endregion
|
||||
|
||||
#region OpenMSX
|
||||
|
||||
if (fields.Contains(MachineField.GenMSXID))
|
||||
machine.GenMSXID = null;
|
||||
|
||||
if (fields.Contains(MachineField.System))
|
||||
machine.System = null;
|
||||
|
||||
if (fields.Contains(MachineField.Country))
|
||||
machine.Country = null;
|
||||
|
||||
#endregion
|
||||
|
||||
#region SoftwareList
|
||||
|
||||
if (fields.Contains(MachineField.Supported))
|
||||
machine.Supported = Supported.NULL;
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Replace fields with given values
|
||||
/// </summary>
|
||||
/// <param name="datItem">DatItem to replace fields in</param>
|
||||
/// <param name="repMachine">DatItem to pull new information from</param>
|
||||
/// <param name="fields">List of fields representing what should be updated</param>
|
||||
public static void ReplaceFields(DatItem datItem, DatItem repDatItem, List<DatItemField> fields)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Replace fields with given values
|
||||
/// </summary>
|
||||
/// <param name="machine">Machine to replace fields in</param>
|
||||
/// <param name="repMachine">Machine to pull new information from</param>
|
||||
/// <param name="fields">List of fields representing what should be updated</param>
|
||||
/// <param name="onlySame">True if descriptions should only be replaced if the game name is the same, false otherwise</param>
|
||||
public static void ReplaceFields(Machine machine, Machine repMachine, List<MachineField> fields, bool onlySame)
|
||||
{
|
||||
#region Common
|
||||
|
||||
if (fields.Contains(MachineField.Name))
|
||||
machine.Name = repMachine.Name;
|
||||
|
||||
if (fields.Contains(MachineField.Comment))
|
||||
machine.Comment = repMachine.Comment;
|
||||
|
||||
if (fields.Contains(MachineField.Description))
|
||||
{
|
||||
if (!onlySame || (onlySame && machine.Name == machine.Description))
|
||||
machine.Description = repMachine.Description;
|
||||
}
|
||||
|
||||
if (fields.Contains(MachineField.Year))
|
||||
machine.Year = repMachine.Year;
|
||||
|
||||
if (fields.Contains(MachineField.Manufacturer))
|
||||
machine.Manufacturer = repMachine.Manufacturer;
|
||||
|
||||
if (fields.Contains(MachineField.Publisher))
|
||||
machine.Publisher = repMachine.Publisher;
|
||||
|
||||
if (fields.Contains(MachineField.Category))
|
||||
machine.Category = repMachine.Category;
|
||||
|
||||
if (fields.Contains(MachineField.RomOf))
|
||||
machine.RomOf = repMachine.RomOf;
|
||||
|
||||
if (fields.Contains(MachineField.CloneOf))
|
||||
machine.CloneOf = repMachine.CloneOf;
|
||||
|
||||
if (fields.Contains(MachineField.SampleOf))
|
||||
machine.SampleOf = repMachine.SampleOf;
|
||||
|
||||
if (fields.Contains(MachineField.Type))
|
||||
machine.MachineType = repMachine.MachineType;
|
||||
|
||||
#endregion
|
||||
|
||||
#region AttractMode
|
||||
|
||||
if (fields.Contains(MachineField.Players))
|
||||
machine.Players = repMachine.Players;
|
||||
|
||||
if (fields.Contains(MachineField.Rotation))
|
||||
machine.Rotation = repMachine.Rotation;
|
||||
|
||||
if (fields.Contains(MachineField.Control))
|
||||
machine.Control = repMachine.Control;
|
||||
|
||||
if (fields.Contains(MachineField.Status))
|
||||
machine.Status = repMachine.Status;
|
||||
|
||||
if (fields.Contains(MachineField.DisplayCount))
|
||||
machine.DisplayCount = repMachine.DisplayCount;
|
||||
|
||||
if (fields.Contains(MachineField.DisplayType))
|
||||
machine.DisplayType = repMachine.DisplayType;
|
||||
|
||||
if (fields.Contains(MachineField.Buttons))
|
||||
machine.Buttons = repMachine.Buttons;
|
||||
|
||||
#endregion
|
||||
|
||||
#region ListXML
|
||||
|
||||
if (fields.Contains(MachineField.SourceFile))
|
||||
machine.SourceFile = repMachine.SourceFile;
|
||||
|
||||
if (fields.Contains(MachineField.Runnable))
|
||||
machine.Runnable = repMachine.Runnable;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Logiqx
|
||||
|
||||
if (fields.Contains(MachineField.Board))
|
||||
machine.Board = repMachine.Board;
|
||||
|
||||
if (fields.Contains(MachineField.RebuildTo))
|
||||
machine.RebuildTo = repMachine.RebuildTo;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Logiqx EmuArc
|
||||
|
||||
if (fields.Contains(MachineField.TitleID))
|
||||
machine.TitleID = repMachine.TitleID;
|
||||
|
||||
if (fields.Contains(MachineField.Developer))
|
||||
machine.Developer = repMachine.Developer;
|
||||
|
||||
if (fields.Contains(MachineField.Genre))
|
||||
machine.Genre = repMachine.Genre;
|
||||
|
||||
if (fields.Contains(MachineField.Subgenre))
|
||||
machine.Subgenre = repMachine.Subgenre;
|
||||
|
||||
if (fields.Contains(MachineField.Ratings))
|
||||
machine.Ratings = repMachine.Ratings;
|
||||
|
||||
if (fields.Contains(MachineField.Score))
|
||||
machine.Score = repMachine.Score;
|
||||
|
||||
if (fields.Contains(MachineField.Enabled))
|
||||
machine.Enabled = repMachine.Enabled;
|
||||
|
||||
if (fields.Contains(MachineField.CRC))
|
||||
machine.Crc = repMachine.Crc;
|
||||
|
||||
if (fields.Contains(MachineField.RelatedTo))
|
||||
machine.RelatedTo = repMachine.RelatedTo;
|
||||
|
||||
#endregion
|
||||
|
||||
#region OpenMSX
|
||||
|
||||
if (fields.Contains(MachineField.GenMSXID))
|
||||
machine.GenMSXID = repMachine.GenMSXID;
|
||||
|
||||
if (fields.Contains(MachineField.System))
|
||||
machine.System = repMachine.System;
|
||||
|
||||
if (fields.Contains(MachineField.Country))
|
||||
machine.Country = repMachine.Country;
|
||||
|
||||
#endregion
|
||||
|
||||
#region SoftwareList
|
||||
|
||||
if (fields.Contains(MachineField.Supported))
|
||||
machine.Supported = repMachine.Supported;
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set fields with given values
|
||||
/// </summary>
|
||||
/// <param name="datItem">DatItem to set fields on</param>
|
||||
/// <param name="mappings">Mappings dictionary</param>
|
||||
public static void SetFields(DatItem datItem, Dictionary<DatItemField, string> mappings)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set fields with given values
|
||||
/// </summary>
|
||||
/// <param name="machine">Machine to set fields on</param>
|
||||
/// <param name="mappings">Mappings dictionary</param>
|
||||
public static void SetFields(Machine machine, Dictionary<MachineField, string> mappings)
|
||||
{
|
||||
if (machine == null || mappings == null)
|
||||
return;
|
||||
|
||||
#region Common
|
||||
|
||||
if (mappings.Keys.Contains(MachineField.Name))
|
||||
machine.Name = mappings[MachineField.Name];
|
||||
|
||||
if (mappings.Keys.Contains(MachineField.Comment))
|
||||
machine.Comment = mappings[MachineField.Comment];
|
||||
|
||||
if (mappings.Keys.Contains(MachineField.Description))
|
||||
machine.Description = mappings[MachineField.Description];
|
||||
|
||||
if (mappings.Keys.Contains(MachineField.Year))
|
||||
machine.Year = mappings[MachineField.Year];
|
||||
|
||||
if (mappings.Keys.Contains(MachineField.Manufacturer))
|
||||
machine.Manufacturer = mappings[MachineField.Manufacturer];
|
||||
|
||||
if (mappings.Keys.Contains(MachineField.Publisher))
|
||||
machine.Publisher = mappings[MachineField.Publisher];
|
||||
|
||||
if (mappings.Keys.Contains(MachineField.Category))
|
||||
machine.Category = mappings[MachineField.Category];
|
||||
|
||||
if (mappings.Keys.Contains(MachineField.RomOf))
|
||||
machine.RomOf = mappings[MachineField.RomOf];
|
||||
|
||||
if (mappings.Keys.Contains(MachineField.CloneOf))
|
||||
machine.CloneOf = mappings[MachineField.CloneOf];
|
||||
|
||||
if (mappings.Keys.Contains(MachineField.SampleOf))
|
||||
machine.SampleOf = mappings[MachineField.SampleOf];
|
||||
|
||||
if (mappings.Keys.Contains(MachineField.Type))
|
||||
machine.MachineType = mappings[MachineField.Type].AsMachineType();
|
||||
|
||||
#endregion
|
||||
|
||||
#region AttractMode
|
||||
|
||||
if (mappings.Keys.Contains(MachineField.Players))
|
||||
machine.Players = mappings[MachineField.Players];
|
||||
|
||||
if (mappings.Keys.Contains(MachineField.Rotation))
|
||||
machine.Rotation = mappings[MachineField.Rotation];
|
||||
|
||||
if (mappings.Keys.Contains(MachineField.Control))
|
||||
machine.Control = mappings[MachineField.Control];
|
||||
|
||||
if (mappings.Keys.Contains(MachineField.Status))
|
||||
machine.Status = mappings[MachineField.Status];
|
||||
|
||||
if (mappings.Keys.Contains(MachineField.DisplayCount))
|
||||
machine.DisplayCount = mappings[MachineField.DisplayCount];
|
||||
|
||||
if (mappings.Keys.Contains(MachineField.DisplayType))
|
||||
machine.DisplayType = mappings[MachineField.DisplayType];
|
||||
|
||||
if (mappings.Keys.Contains(MachineField.Buttons))
|
||||
machine.Buttons = mappings[MachineField.Buttons];
|
||||
|
||||
#endregion
|
||||
|
||||
#region ListXML
|
||||
|
||||
if (mappings.Keys.Contains(MachineField.SourceFile))
|
||||
machine.SourceFile = mappings[MachineField.SourceFile];
|
||||
|
||||
if (mappings.Keys.Contains(MachineField.Runnable))
|
||||
machine.Runnable = mappings[MachineField.Runnable].AsRunnable();
|
||||
|
||||
#endregion
|
||||
|
||||
#region Logiqx
|
||||
|
||||
if (mappings.Keys.Contains(MachineField.Board))
|
||||
machine.Board = mappings[MachineField.Board];
|
||||
|
||||
if (mappings.Keys.Contains(MachineField.RebuildTo))
|
||||
machine.RebuildTo = mappings[MachineField.RebuildTo];
|
||||
|
||||
#endregion
|
||||
|
||||
#region Logiqx EmuArc
|
||||
|
||||
if (mappings.Keys.Contains(MachineField.TitleID))
|
||||
machine.TitleID = mappings[MachineField.TitleID];
|
||||
|
||||
if (mappings.Keys.Contains(MachineField.Developer))
|
||||
machine.Developer = mappings[MachineField.Developer];
|
||||
|
||||
if (mappings.Keys.Contains(MachineField.Genre))
|
||||
machine.Genre = mappings[MachineField.Genre];
|
||||
|
||||
if (mappings.Keys.Contains(MachineField.Subgenre))
|
||||
machine.Subgenre = mappings[MachineField.Subgenre];
|
||||
|
||||
if (mappings.Keys.Contains(MachineField.Ratings))
|
||||
machine.Ratings = mappings[MachineField.Ratings];
|
||||
|
||||
if (mappings.Keys.Contains(MachineField.Score))
|
||||
machine.Score = mappings[MachineField.Score];
|
||||
|
||||
if (mappings.Keys.Contains(MachineField.Enabled))
|
||||
machine.Enabled = mappings[MachineField.Enabled];
|
||||
|
||||
if (mappings.Keys.Contains(MachineField.CRC))
|
||||
machine.Crc = mappings[MachineField.CRC].AsYesNo();
|
||||
|
||||
if (mappings.Keys.Contains(MachineField.RelatedTo))
|
||||
machine.RelatedTo = mappings[MachineField.RelatedTo];
|
||||
|
||||
#endregion
|
||||
|
||||
#region OpenMSX
|
||||
|
||||
if (mappings.Keys.Contains(MachineField.GenMSXID))
|
||||
machine.GenMSXID = mappings[MachineField.GenMSXID];
|
||||
|
||||
if (mappings.Keys.Contains(MachineField.System))
|
||||
machine.System = mappings[MachineField.System];
|
||||
|
||||
if (mappings.Keys.Contains(MachineField.Country))
|
||||
machine.Country = mappings[MachineField.Country];
|
||||
|
||||
#endregion
|
||||
|
||||
#region SoftwareList
|
||||
|
||||
if (mappings.Keys.Contains(MachineField.Supported))
|
||||
machine.Supported = mappings[MachineField.Supported].AsSupported();
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Filtering
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -202,9 +202,9 @@ namespace SabreTools.Features
|
||||
// Populate using the correct set
|
||||
List<DatHeader> datHeaders;
|
||||
if (updateMode.HasFlag(UpdateMode.DiffAgainst) || updateMode.HasFlag(UpdateMode.BaseReplace))
|
||||
datHeaders = DatTool.PopulateUserData(userInputDat, basePaths);
|
||||
datHeaders = DatFileTool.PopulateUserData(userInputDat, basePaths);
|
||||
else
|
||||
datHeaders = DatTool.PopulateUserData(userInputDat, inputPaths);
|
||||
datHeaders = DatFileTool.PopulateUserData(userInputDat, inputPaths);
|
||||
|
||||
// Perform additional processing steps
|
||||
Modification.ApplyExtras(userInputDat, Extras);
|
||||
@@ -215,7 +215,7 @@ namespace SabreTools.Features
|
||||
// Output only DatItems that are duplicated across inputs
|
||||
if (updateMode.HasFlag(UpdateMode.DiffDupesOnly))
|
||||
{
|
||||
DatFile dupeData = DatTool.DiffDuplicates(userInputDat, inputPaths);
|
||||
DatFile dupeData = DatFileTool.DiffDuplicates(userInputDat, inputPaths);
|
||||
|
||||
InternalStopwatch watch = new InternalStopwatch("Outputting duplicate DAT");
|
||||
Writer.Write(dupeData, OutputDir, overwrite: false);
|
||||
@@ -225,7 +225,7 @@ namespace SabreTools.Features
|
||||
// Output only DatItems that are not duplicated across inputs
|
||||
if (updateMode.HasFlag(UpdateMode.DiffNoDupesOnly))
|
||||
{
|
||||
DatFile outerDiffData = DatTool.DiffNoDuplicates(userInputDat, inputPaths);
|
||||
DatFile outerDiffData = DatFileTool.DiffNoDuplicates(userInputDat, inputPaths);
|
||||
|
||||
InternalStopwatch watch = new InternalStopwatch("Outputting no duplicate DAT");
|
||||
Writer.Write(outerDiffData, OutputDir, overwrite: false);
|
||||
@@ -236,7 +236,7 @@ namespace SabreTools.Features
|
||||
if (updateMode.HasFlag(UpdateMode.DiffIndividualsOnly))
|
||||
{
|
||||
// Get all of the output DatFiles
|
||||
List<DatFile> datFiles = DatTool.DiffIndividuals(userInputDat, inputPaths);
|
||||
List<DatFile> datFiles = DatFileTool.DiffIndividuals(userInputDat, inputPaths);
|
||||
|
||||
// Loop through and output the new DatFiles
|
||||
InternalStopwatch watch = new InternalStopwatch("Outputting all individual DATs");
|
||||
@@ -271,7 +271,7 @@ namespace SabreTools.Features
|
||||
});
|
||||
|
||||
// Get all of the output DatFiles
|
||||
List<DatFile> datFiles = DatTool.DiffCascade(userInputDat, datHeaders);
|
||||
List<DatFile> datFiles = DatFileTool.DiffCascade(userInputDat, datHeaders);
|
||||
|
||||
// Loop through and output the new DatFiles
|
||||
InternalStopwatch watch = new InternalStopwatch("Outputting all created DATs");
|
||||
@@ -305,7 +305,7 @@ namespace SabreTools.Features
|
||||
Modification.ApplyCleaning(repDat, Cleaner);
|
||||
|
||||
// Now replace the fields from the base DatFile
|
||||
DatTool.DiffAgainst(userInputDat, repDat, GetBoolean(Features, ByGameValue));
|
||||
DatFileTool.DiffAgainst(userInputDat, repDat, GetBoolean(Features, ByGameValue));
|
||||
|
||||
// Finally output the diffed DatFile
|
||||
string interOutDir = inputPath.GetOutputPath(OutputDir, GetBoolean(features, InplaceValue));
|
||||
@@ -330,7 +330,7 @@ namespace SabreTools.Features
|
||||
Modification.ApplyCleaning(repDat, Cleaner);
|
||||
|
||||
// Now replace the fields from the base DatFile
|
||||
DatTool.BaseReplace(
|
||||
DatFileTool.BaseReplace(
|
||||
userInputDat,
|
||||
repDat,
|
||||
updateMachineFields,
|
||||
|
||||
Reference in New Issue
Block a user