diff --git a/SabreTools.Data.Extensions/MetadataExtensions.cs b/SabreTools.Data.Extensions/MetadataExtensions.cs
index 12ca38bf..3cce03d3 100644
--- a/SabreTools.Data.Extensions/MetadataExtensions.cs
+++ b/SabreTools.Data.Extensions/MetadataExtensions.cs
@@ -67,6 +67,8 @@ namespace SabreTools.Data.Extensions
return extension.Clone() as Extension;
else if (self is Feature feature)
return feature.Clone() as Feature;
+ else if (self is Header header)
+ return header.Clone() as Header;
else if (self is Info info)
return info.Clone() as Info;
else if (self is Input input)
@@ -114,55 +116,6 @@ namespace SabreTools.Data.Extensions
if (Activator.CreateInstance(self.GetType()) is not DictionaryBase clone)
return null;
- // Handle individual type properties
- if (self is Header selfHeader && clone is Header cloneHeader)
- {
- cloneHeader.Author = selfHeader.Author;
- cloneHeader.BiosMode = selfHeader.BiosMode;
- cloneHeader.Build = selfHeader.Build;
- cloneHeader.CanOpen = selfHeader.CanOpen;
- cloneHeader.Category = selfHeader.Category;
- cloneHeader.Comment = selfHeader.Comment;
- cloneHeader.Date = selfHeader.Date;
- cloneHeader.DatVersion = selfHeader.DatVersion;
- cloneHeader.Debug = selfHeader.Debug;
- cloneHeader.Description = selfHeader.Description;
- cloneHeader.Email = selfHeader.Email;
- cloneHeader.EmulatorVersion = selfHeader.EmulatorVersion;
- cloneHeader.ForceMerging = selfHeader.ForceMerging;
- cloneHeader.ForceNodump = selfHeader.ForceNodump;
- cloneHeader.ForcePacking = selfHeader.ForcePacking;
- cloneHeader.ForceZipping = selfHeader.ForceZipping;
- cloneHeader.HeaderRow = selfHeader.HeaderRow;
- cloneHeader.HeaderSkipper = selfHeader.HeaderSkipper;
- cloneHeader.Homepage = selfHeader.Homepage;
- cloneHeader.Id = selfHeader.Id;
- cloneHeader.Images = selfHeader.Images;
- cloneHeader.ImFolder = selfHeader.ImFolder;
- cloneHeader.Infos = selfHeader.Infos;
- cloneHeader.LockBiosMode = selfHeader.LockBiosMode;
- cloneHeader.LockRomMode = selfHeader.LockRomMode;
- cloneHeader.LockSampleMode = selfHeader.LockSampleMode;
- cloneHeader.MameConfig = selfHeader.MameConfig;
- cloneHeader.Name = selfHeader.Name;
- cloneHeader.NewDat = selfHeader.NewDat;
- cloneHeader.Notes = selfHeader.Notes;
- cloneHeader.Plugin = selfHeader.Plugin;
- cloneHeader.RefName = selfHeader.RefName;
- cloneHeader.RomMode = selfHeader.RomMode;
- cloneHeader.RomTitle = selfHeader.RomTitle;
- cloneHeader.RootDir = selfHeader.RootDir;
- cloneHeader.SampleMode = selfHeader.SampleMode;
- cloneHeader.ScreenshotsHeight = selfHeader.ScreenshotsHeight;
- cloneHeader.ScreenshotsWidth = selfHeader.ScreenshotsWidth;
- cloneHeader.Search = selfHeader.Search;
- cloneHeader.System = selfHeader.System;
- cloneHeader.Timestamp = selfHeader.Timestamp;
- cloneHeader.Type = selfHeader.Type;
- cloneHeader.Url = selfHeader.Url;
- cloneHeader.Version = selfHeader.Version;
- }
-
// Loop through and clone per type
foreach (string key in self.Keys)
{
diff --git a/SabreTools.Data.Models/Metadata/Header.cs b/SabreTools.Data.Models/Metadata/Header.cs
index 4933d094..1d8f30cb 100644
--- a/SabreTools.Data.Models/Metadata/Header.cs
+++ b/SabreTools.Data.Models/Metadata/Header.cs
@@ -1,10 +1,12 @@
+using System;
+
namespace SabreTools.Data.Models.Metadata
{
///
/// Format-agnostic representation of metadata header data
///
- public class Header : DictionaryBase
+ public class Header : DictionaryBase, ICloneable, IEquatable
{
#region Properties
@@ -95,6 +97,8 @@ namespace SabreTools.Data.Models.Metadata
/// (none|split|merged|nonmerged|fullmerged|device|full) "split"
public MergingFlag SampleMode { get; set; }
+ public string? SchemaLocation { get; set; }
+
public string? ScreenshotsHeight { get; set; }
public string? ScreenshotsWidth { get; set; }
@@ -114,11 +118,251 @@ namespace SabreTools.Data.Models.Metadata
#endregion
- #region Keys
+ ///
+ public object Clone()
+ {
+ var obj = new Header();
- /// string
- public const string SchemaLocationKey = "schemaLocation";
+ obj.Author = Author;
+ obj.BiosMode = BiosMode;
+ obj.Build = Build;
+ obj.CanOpen = CanOpen;
+ obj.Category = Category;
+ obj.Comment = Comment;
+ obj.Date = Date;
+ obj.DatVersion = DatVersion;
+ obj.Debug = Debug;
+ obj.Description = Description;
+ obj.Email = Email;
+ obj.EmulatorVersion = EmulatorVersion;
+ obj.ForceMerging = ForceMerging;
+ obj.ForceNodump = ForceNodump;
+ obj.ForcePacking = ForcePacking;
+ obj.ForceZipping = ForceZipping;
+ obj.HeaderRow = HeaderRow;
+ obj.HeaderSkipper = HeaderSkipper;
+ obj.Homepage = Homepage;
+ obj.Id = Id;
+ obj.Images = Images;
+ obj.ImFolder = ImFolder;
+ obj.Infos = Infos;
+ obj.LockBiosMode = LockBiosMode;
+ obj.LockRomMode = LockRomMode;
+ obj.LockSampleMode = LockSampleMode;
+ obj.MameConfig = MameConfig;
+ obj.Name = Name;
+ obj.NewDat = NewDat;
+ obj.Notes = Notes;
+ obj.Plugin = Plugin;
+ obj.RefName = RefName;
+ obj.RomMode = RomMode;
+ obj.RomTitle = RomTitle;
+ obj.RootDir = RootDir;
+ obj.SampleMode = SampleMode;
+ obj.SchemaLocation = SchemaLocation;
+ obj.ScreenshotsHeight = ScreenshotsHeight;
+ obj.ScreenshotsWidth = ScreenshotsWidth;
+ obj.Search = Search;
+ obj.System = System;
+ obj.Timestamp = Timestamp;
+ obj.Type = Type;
+ obj.Url = Url;
+ obj.Version = Version;
- #endregion
+ return obj;
+ }
+
+ ///
+ public bool Equals(Header? other)
+ {
+ // Null never matches
+ if (other is null)
+ return false;
+
+ // Properties
+ if ((Author is null) ^ (other.Author is null))
+ return false;
+ else if (Author is not null && !Author.Equals(other.Author, StringComparison.OrdinalIgnoreCase))
+ return false;
+
+ if (BiosMode != other.BiosMode)
+ return false;
+
+ if ((Build is null) ^ (other.Build is null))
+ return false;
+ else if (Build is not null && !Build.Equals(other.Build, StringComparison.OrdinalIgnoreCase))
+ return false;
+
+ if ((Category is null) ^ (other.Category is null))
+ return false;
+ else if (Category is not null && !Category.Equals(other.Category, StringComparison.OrdinalIgnoreCase))
+ return false;
+
+ if ((Comment is null) ^ (other.Comment is null))
+ return false;
+ else if (Comment is not null && !Comment.Equals(other.Comment, StringComparison.OrdinalIgnoreCase))
+ return false;
+
+ if ((Date is null) ^ (other.Date is null))
+ return false;
+ else if (Date is not null && !Date.Equals(other.Date, StringComparison.OrdinalIgnoreCase))
+ return false;
+
+ if ((DatVersion is null) ^ (other.DatVersion is null))
+ return false;
+ else if (DatVersion is not null && !DatVersion.Equals(other.DatVersion, StringComparison.OrdinalIgnoreCase))
+ return false;
+
+ if (Debug != other.Debug)
+ return false;
+
+ if ((Description is null) ^ (other.Description is null))
+ return false;
+ else if (Description is not null && !Description.Equals(other.Description, StringComparison.OrdinalIgnoreCase))
+ return false;
+
+ if ((Email is null) ^ (other.Email is null))
+ return false;
+ else if (Email is not null && !Email.Equals(other.Email, StringComparison.OrdinalIgnoreCase))
+ return false;
+
+ if ((EmulatorVersion is null) ^ (other.EmulatorVersion is null))
+ return false;
+ else if (EmulatorVersion is not null && !EmulatorVersion.Equals(other.EmulatorVersion, StringComparison.OrdinalIgnoreCase))
+ return false;
+
+ if (ForceMerging != other.ForceMerging)
+ return false;
+
+ if (ForceNodump != other.ForceNodump)
+ return false;
+
+ if (ForcePacking != other.ForcePacking)
+ return false;
+
+ if (ForceZipping != other.ForceZipping)
+ return false;
+
+ if ((HeaderSkipper is null) ^ (other.HeaderSkipper is null))
+ return false;
+ else if (HeaderSkipper is not null && !HeaderSkipper.Equals(other.HeaderSkipper, StringComparison.OrdinalIgnoreCase))
+ return false;
+
+ if ((Homepage is null) ^ (other.Homepage is null))
+ return false;
+ else if (Homepage is not null && !Homepage.Equals(other.Homepage, StringComparison.OrdinalIgnoreCase))
+ return false;
+
+ if ((Id is null) ^ (other.Id is null))
+ return false;
+ else if (Id is not null && !Id.Equals(other.Id, StringComparison.OrdinalIgnoreCase))
+ return false;
+
+ if ((ImFolder is null) ^ (other.ImFolder is null))
+ return false;
+ else if (ImFolder is not null && !ImFolder.Equals(other.ImFolder, StringComparison.OrdinalIgnoreCase))
+ return false;
+
+ if (LockBiosMode != other.ForceZipping)
+ return false;
+
+ if (LockRomMode != other.LockRomMode)
+ return false;
+
+ if (LockSampleMode != other.LockSampleMode)
+ return false;
+
+ if ((MameConfig is null) ^ (other.MameConfig is null))
+ return false;
+ else if (MameConfig is not null && !MameConfig.Equals(other.MameConfig, StringComparison.OrdinalIgnoreCase))
+ return false;
+
+ if ((Name is null) ^ (other.Name is null))
+ return false;
+ else if (Name is not null && !Name.Equals(other.Name, StringComparison.OrdinalIgnoreCase))
+ return false;
+
+ if ((Notes is null) ^ (other.Notes is null))
+ return false;
+ else if (Notes is not null && !Notes.Equals(other.Notes, StringComparison.OrdinalIgnoreCase))
+ return false;
+
+ if ((Plugin is null) ^ (other.Plugin is null))
+ return false;
+ else if (Plugin is not null && !Plugin.Equals(other.Plugin, StringComparison.OrdinalIgnoreCase))
+ return false;
+
+ if ((RefName is null) ^ (other.RefName is null))
+ return false;
+ else if (RefName is not null && !RefName.Equals(other.RefName, StringComparison.OrdinalIgnoreCase))
+ return false;
+
+ if (RomMode != other.RomMode)
+ return false;
+
+ if ((RomTitle is null) ^ (other.RomTitle is null))
+ return false;
+ else if (RomTitle is not null && !RomTitle.Equals(other.RomTitle, StringComparison.OrdinalIgnoreCase))
+ return false;
+
+ if ((RootDir is null) ^ (other.RootDir is null))
+ return false;
+ else if (RootDir is not null && !RootDir.Equals(other.RootDir, StringComparison.OrdinalIgnoreCase))
+ return false;
+
+ if (SampleMode != other.SampleMode)
+ return false;
+
+ if ((SchemaLocation is null) ^ (other.SchemaLocation is null))
+ return false;
+ else if (SchemaLocation is not null && !SchemaLocation.Equals(other.SchemaLocation, StringComparison.OrdinalIgnoreCase))
+ return false;
+
+ if ((ScreenshotsHeight is null) ^ (other.ScreenshotsHeight is null))
+ return false;
+ else if (ScreenshotsHeight is not null && !ScreenshotsHeight.Equals(other.ScreenshotsHeight, StringComparison.OrdinalIgnoreCase))
+ return false;
+
+ if ((ScreenshotsWidth is null) ^ (other.ScreenshotsWidth is null))
+ return false;
+ else if (ScreenshotsWidth is not null && !ScreenshotsWidth.Equals(other.ScreenshotsWidth, StringComparison.OrdinalIgnoreCase))
+ return false;
+
+ if ((System is null) ^ (other.System is null))
+ return false;
+ else if (System is not null && !System.Equals(other.System, StringComparison.OrdinalIgnoreCase))
+ return false;
+
+ if ((Timestamp is null) ^ (other.Timestamp is null))
+ return false;
+ else if (Timestamp is not null && !Timestamp.Equals(other.Timestamp, StringComparison.OrdinalIgnoreCase))
+ return false;
+
+ if ((Type is null) ^ (other.Type is null))
+ return false;
+ else if (Type is not null && !Type.Equals(other.Type, StringComparison.OrdinalIgnoreCase))
+ return false;
+
+ if ((Url is null) ^ (other.Url is null))
+ return false;
+ else if (Url is not null && !Url.Equals(other.Url, StringComparison.OrdinalIgnoreCase))
+ return false;
+
+ if ((Version is null) ^ (other.Version is null))
+ return false;
+ else if (Version is not null && !Version.Equals(other.Version, StringComparison.OrdinalIgnoreCase))
+ return false;
+
+ // Sub-items
+ // Header.CanOpen is intentionally skipped
+ // Header.Images is intentionally skipped
+ // Header.Infos is intentionally skipped
+ // Header.NewDat is intentionally skipped
+ // Header.Search is intentionally skipped
+
+ // TODO: Figure out how to properly check arrays
+
+ return true;
+ }
}
}
diff --git a/SabreTools.Metadata.DatFiles.Test/DatFileTests.FromMetadata.cs b/SabreTools.Metadata.DatFiles.Test/DatFileTests.FromMetadata.cs
index 89a7172e..92432131 100644
--- a/SabreTools.Metadata.DatFiles.Test/DatFileTests.FromMetadata.cs
+++ b/SabreTools.Metadata.DatFiles.Test/DatFileTests.FromMetadata.cs
@@ -235,7 +235,7 @@ namespace SabreTools.Metadata.DatFiles.Test
RomTitle = "romtitle",
RootDir = "rootdir",
SampleMode = Data.Models.Metadata.MergingFlag.Merged,
- [Data.Models.Metadata.Header.SchemaLocationKey] = "schemalocation",
+ SchemaLocation = "schemalocation",
ScreenshotsHeight = "screenshotsheight",
ScreenshotsWidth = "screenshotsWidth",
Search = search,
@@ -1042,7 +1042,7 @@ namespace SabreTools.Metadata.DatFiles.Test
Assert.Equal("romtitle", datHeader.RomTitle);
Assert.Equal("rootdir", datHeader.RootDir);
Assert.Equal(Data.Models.Metadata.MergingFlag.Merged, datHeader.SampleMode);
- Assert.Equal("schemalocation", datHeader.ReadString(Data.Models.Metadata.Header.SchemaLocationKey));
+ Assert.Equal("schemalocation", datHeader.SchemaLocation);
Assert.Equal("screenshotsheight", datHeader.ScreenshotsHeight);
Assert.Equal("screenshotsWidth", datHeader.ScreenshotsWidth);
Assert.NotNull(datHeader.Search);
diff --git a/SabreTools.Metadata.DatFiles.Test/DatFileTests.ToMetadata.cs b/SabreTools.Metadata.DatFiles.Test/DatFileTests.ToMetadata.cs
index 7c643816..8843f57f 100644
--- a/SabreTools.Metadata.DatFiles.Test/DatFileTests.ToMetadata.cs
+++ b/SabreTools.Metadata.DatFiles.Test/DatFileTests.ToMetadata.cs
@@ -383,7 +383,7 @@ namespace SabreTools.Metadata.DatFiles.Test
Assert.Equal("romtitle", header.RomTitle);
Assert.Equal("rootdir", header.RootDir);
Assert.Equal(Data.Models.Metadata.MergingFlag.Merged, header.SampleMode);
- Assert.Equal("schemalocation", header.ReadString(Data.Models.Metadata.Header.SchemaLocationKey));
+ Assert.Equal("schemalocation", header.SchemaLocation);
Assert.Equal("screenshotsheight", header.ScreenshotsHeight);
Assert.Equal("screenshotsWidth", header.ScreenshotsWidth);
Assert.NotNull(header.Search);
diff --git a/SabreTools.Metadata.DatFiles/DatFile.FromMetadata.cs b/SabreTools.Metadata.DatFiles/DatFile.FromMetadata.cs
index 0a67da5c..dba32835 100644
--- a/SabreTools.Metadata.DatFiles/DatFile.FromMetadata.cs
+++ b/SabreTools.Metadata.DatFiles/DatFile.FromMetadata.cs
@@ -61,7 +61,7 @@ namespace SabreTools.Metadata.DatFiles
private void ConvertHeader(Data.Models.Metadata.Header? item, bool keep)
{
// If the header is invalid, we can't do anything
- if (item is null || item.Count == 0)
+ if (item is null)
return;
// Create an internal header
@@ -152,8 +152,8 @@ namespace SabreTools.Metadata.DatFiles
Header.RootDir = header.RootDir;
if (Header.SampleMode == MergingFlag.None)
Header.SampleMode = header.SampleMode;
- if (Header.ReadString(Data.Models.Metadata.Header.SchemaLocationKey) is null)
- Header.Write(Data.Models.Metadata.Header.SchemaLocationKey, header.ReadString(Data.Models.Metadata.Header.SchemaLocationKey));
+ if (Header.SchemaLocation is null)
+ Header.SchemaLocation = header.SchemaLocation;
if (Header.ScreenshotsHeight is null)
Header.ScreenshotsHeight = header.ScreenshotsHeight;
if (Header.ScreenshotsWidth is null)
diff --git a/SabreTools.Metadata.DatFiles/DatHeader.cs b/SabreTools.Metadata.DatFiles/DatHeader.cs
index 1dffbde6..59d64715 100644
--- a/SabreTools.Metadata.DatFiles/DatHeader.cs
+++ b/SabreTools.Metadata.DatFiles/DatHeader.cs
@@ -1,7 +1,6 @@
using System;
using System.Xml.Serialization;
using Newtonsoft.Json;
-using SabreTools.Data.Extensions;
using SabreTools.Metadata.Filter;
using MergingFlag = SabreTools.Data.Models.Metadata.MergingFlag;
using NodumpFlag = SabreTools.Data.Models.Metadata.NodumpFlag;
@@ -255,6 +254,12 @@ namespace SabreTools.Metadata.DatFiles
set => _internal.SampleMode = value;
}
+ public string? SchemaLocation
+ {
+ get => _internal.SchemaLocation;
+ set => _internal.SchemaLocation = value;
+ }
+
public string? ScreenshotsHeight
{
get => _internal.ScreenshotsHeight;
@@ -347,7 +352,7 @@ namespace SabreTools.Metadata.DatFiles
///
public Data.Models.Metadata.Header GetInternalClone()
{
- var header = (_internal.DeepClone() as Data.Models.Metadata.Header)!;
+ var header = (_internal.Clone() as Data.Models.Metadata.Header)!;
// Convert subheader values
if (CanOpenSpecified)
diff --git a/SabreTools.Metadata.DatItems/Machine.cs b/SabreTools.Metadata.DatItems/Machine.cs
index d5a42cf8..6de98838 100644
--- a/SabreTools.Metadata.DatItems/Machine.cs
+++ b/SabreTools.Metadata.DatItems/Machine.cs
@@ -1,7 +1,6 @@
using System;
using System.Xml.Serialization;
using Newtonsoft.Json;
-using SabreTools.Data.Extensions;
using SabreTools.Metadata.Filter;
using SabreTools.Text.Extensions;
@@ -450,7 +449,7 @@ namespace SabreTools.Metadata.DatItems
///
/// Get a clone of the current internal model
///
- public Data.Models.Metadata.Machine GetInternalClone() => (_internal.DeepClone() as Data.Models.Metadata.Machine) ?? [];
+ public Data.Models.Metadata.Machine GetInternalClone() => (_internal.Clone() as Data.Models.Metadata.Machine) ?? [];
#endregion
diff --git a/SabreTools.Metadata.Filter/FilterObject.cs b/SabreTools.Metadata.Filter/FilterObject.cs
index 138c9798..e040019f 100644
--- a/SabreTools.Metadata.Filter/FilterObject.cs
+++ b/SabreTools.Metadata.Filter/FilterObject.cs
@@ -866,6 +866,9 @@ namespace SabreTools.Metadata.Filter
case Header item when fieldName == "samplemode":
checkValue = item.SampleMode.AsStringValue();
return true;
+ case Header item when fieldName == "schemalocation":
+ checkValue = item.SchemaLocation;
+ return true;
case Header item when fieldName == "screenshotsheight":
checkValue = item.ScreenshotsHeight;
return true;
diff --git a/SabreTools.Metadata/DictionaryBaseExtensions.cs b/SabreTools.Metadata/DictionaryBaseExtensions.cs
index 15b784a8..5698359f 100644
--- a/SabreTools.Metadata/DictionaryBaseExtensions.cs
+++ b/SabreTools.Metadata/DictionaryBaseExtensions.cs
@@ -39,24 +39,25 @@ namespace SabreTools.Metadata
(DipLocation selfDipLocation, DipLocation otherDipLocation) => selfDipLocation.Equals(otherDipLocation),
(DipSwitch selfDipSwitch, DipSwitch otherDipSwitch) => selfDipSwitch.Equals(otherDipSwitch),
(DipValue selfDipValue, DipValue otherDipValue) => selfDipValue.Equals(otherDipValue),
- (Disk diskSelf, Disk diskOther) => EqualsImpl(diskSelf, diskOther),
+ (Disk selfDisk, Disk otherDisk) => EqualsImpl(selfDisk, otherDisk),
(DiskArea selfDiskArea, DiskArea otherDiskArea) => selfDiskArea.Equals(otherDiskArea),
(Display selfDisplay, Display otherDisplay) => selfDisplay.Equals(otherDisplay),
(Driver selfDriver, Driver otherDriver) => selfDriver.Equals(otherDriver),
(Dump selfDump, Dump otherDump) => selfDump.Equals(otherDump),
(Feature selfFeature, Feature otherFeature) => selfFeature.Equals(otherFeature),
+ (Header selfHeader, Header otherHeader) => selfHeader.Equals(otherHeader),
(Info selfInfo, Info otherInfo) => selfInfo.Equals(otherInfo),
(Input selfInput, Input otherInput) => selfInput.Equals(otherInput),
(Instance selfInstance, Instance otherInstance) => selfInstance.Equals(otherInstance),
- (Machine machineSelf, Machine machineOther) => EqualsImpl(machineSelf, machineOther),
- (Media mediaSelf, Media mediaOther) => EqualsImpl(mediaSelf, mediaOther),
+ (Machine selfMachine, Machine otherMachine) => EqualsImpl(selfMachine, otherMachine),
+ (Media selfMedia, Media otherMedia) => EqualsImpl(selfMedia, otherMedia),
(Original selfOriginal, Original otherOriginal) => selfOriginal.Equals(otherOriginal),
(Part selfPart, Part otherPart) => selfPart.Equals(otherPart),
(Port selfPort, Port otherPort) => selfPort.Equals(otherPort),
(RamOption selfRamOption, RamOption otherRamOption) => selfRamOption.Equals(otherRamOption),
(Release selfRelease, Release otherRelease) => selfRelease.Equals(otherRelease),
(ReleaseDetails selfReleaseDetails, ReleaseDetails otherReleaseDetails) => selfReleaseDetails.Equals(otherReleaseDetails),
- (Rom romSelf, Rom romOther) => EqualsImpl(romSelf, romOther),
+ (Rom selfRom, Rom otherRom) => EqualsImpl(selfRom, otherRom),
(Serials selfSerials, Serials otherSerials) => selfSerials.Equals(otherSerials),
(SharedFeat selfSharedFeat, SharedFeat otherSharedFeat) => selfSharedFeat.Equals(otherSharedFeat),
(Slot selfSlot, Slot otherSlot) => selfSlot.Equals(otherSlot),
@@ -64,7 +65,7 @@ namespace SabreTools.Metadata
(SoftwareList selfSoftwareList, SoftwareList otherSoftwareList) => selfSoftwareList.Equals(otherSoftwareList),
(Sound selfSound, Sound otherSound) => selfSound.Equals(otherSound),
(SourceDetails selfSourceDetails, SourceDetails otherSourceDetails) => selfSourceDetails.Equals(otherSourceDetails),
- (Video videoSelf, Video videoOther) => EqualsImpl(videoSelf, videoOther),
+ (Video selfVideo, Video otherVideo) => EqualsImpl(selfVideo, otherVideo),
_ => self.EqualsImpl(other),
};
#else
@@ -98,8 +99,8 @@ namespace SabreTools.Metadata
return selfDipSwitch.Equals(otherDipSwitch);
else if (self is DipValue selfDipValue && other is DipValue otherDipValue)
return selfDipValue.Equals(otherDipValue);
- else if (self is Disk diskSelf && other is Disk diskOther)
- return EqualsImpl(diskSelf, diskOther);
+ else if (self is Disk selfDisk && other is Disk otherDisk)
+ return EqualsImpl(selfDisk, otherDisk);
else if (self is DiskArea selfDiskArea && other is DiskArea otherDiskArea)
return selfDiskArea.Equals(otherDiskArea);
else if (self is Display selfDisplay && other is Display otherDisplay)
@@ -110,16 +111,18 @@ namespace SabreTools.Metadata
return selfDump.Equals(otherDump);
else if (self is Feature selfFeature && other is Feature otherFeature)
return selfFeature.Equals(otherFeature);
+ else if (self is Header selfHeader && other is Header otherHeader)
+ return selfHeader.Equals(otherHeader);
else if (self is Info selfInfo && other is Info otherInfo)
return selfInfo.Equals(otherInfo);
else if (self is Input selfInput && other is Input otherInput)
return selfInput.Equals(otherInput);
else if (self is Instance selfInstance && other is Instance otherInstance)
return selfInstance.Equals(otherInstance);
- else if (self is Machine machineSelf && other is Machine machineOther)
- return EqualsImpl(machineSelf, machineOther);
- else if (self is Media mediaSelf && other is Media mediaOther)
- return EqualsImpl(mediaSelf, mediaOther);
+ else if (self is Machine selfMachine && other is Machine otherMachine)
+ return EqualsImpl(selfMachine, otherMachine);
+ else if (self is Media selfMedia && other is Media otherMedia)
+ return EqualsImpl(selfMedia, otherMedia);
else if (self is Original selfOriginal && other is Original otherOriginal)
return selfOriginal.Equals(otherOriginal);
else if (self is Part selfPart && other is Part otherPart)
@@ -132,8 +135,8 @@ namespace SabreTools.Metadata
return selfRelease.Equals(otherRelease);
else if (self is ReleaseDetails selfReleaseDetails && other is ReleaseDetails otherReleaseDetails)
return selfReleaseDetails.Equals(otherReleaseDetails);
- else if (self is Rom romSelf && other is Rom romOther)
- return EqualsImpl(romSelf, romOther);
+ else if (self is Rom selfRom && other is Rom otherRom)
+ return EqualsImpl(selfRom, otherRom);
else if (self is Serials selfSerials && other is Serials otherSerials)
return selfSerials.Equals(otherSerials);
else if (self is SharedFeat selfSharedFeat && other is SharedFeat otherSharedFeat)
@@ -171,93 +174,6 @@ namespace SabreTools.Metadata
if (!selfKeys.SetEquals(otherKeys))
return false;
- // Handle individual type properties
- if (self is Header selfHeader && other is Header otherHeader)
- {
- if (selfHeader.Author != otherHeader.Author)
- return false;
- if (selfHeader.BiosMode != otherHeader.BiosMode)
- return false;
- if (selfHeader.Build != otherHeader.Build)
- return false;
- // Header.CanOpen is intentionally skipped
- if (selfHeader.Category != otherHeader.Category)
- return false;
- if (selfHeader.Comment != otherHeader.Comment)
- return false;
- if (selfHeader.Date != otherHeader.Date)
- return false;
- if (selfHeader.DatVersion != otherHeader.DatVersion)
- return false;
- if (selfHeader.Debug != otherHeader.Debug)
- return false;
- if (selfHeader.Description != otherHeader.Description)
- return false;
- if (selfHeader.Email != otherHeader.Email)
- return false;
- if (selfHeader.EmulatorVersion != otherHeader.EmulatorVersion)
- return false;
- if (selfHeader.ForceMerging != otherHeader.ForceMerging)
- return false;
- if (selfHeader.ForceNodump != otherHeader.ForceNodump)
- return false;
- if (selfHeader.ForcePacking != otherHeader.ForcePacking)
- return false;
- if (selfHeader.ForceZipping != otherHeader.ForceZipping)
- return false;
- if (selfHeader.HeaderSkipper != otherHeader.HeaderSkipper)
- return false;
- // Header.HeaderRow is intentionally skipped
- if (selfHeader.Homepage != otherHeader.Homepage)
- return false;
- if (selfHeader.Id != otherHeader.Id)
- return false;
- // Header.Images is intentionally skipped
- if (selfHeader.ImFolder != otherHeader.ImFolder)
- return false;
- // Header.Infos is intentionally skipped
- if (selfHeader.LockBiosMode != otherHeader.LockBiosMode)
- return false;
- if (selfHeader.LockRomMode != otherHeader.LockRomMode)
- return false;
- if (selfHeader.LockSampleMode != otherHeader.LockSampleMode)
- return false;
- if (selfHeader.MameConfig != otherHeader.MameConfig)
- return false;
- if (selfHeader.Name != otherHeader.Name)
- return false;
- // Header.NewDat is intentionally skipped
- if (selfHeader.Notes != otherHeader.Notes)
- return false;
- if (selfHeader.Plugin != otherHeader.Plugin)
- return false;
- if (selfHeader.RefName != otherHeader.RefName)
- return false;
- if (selfHeader.RomMode != otherHeader.RomMode)
- return false;
- if (selfHeader.RomTitle != otherHeader.RomTitle)
- return false;
- if (selfHeader.RootDir != otherHeader.RootDir)
- return false;
- if (selfHeader.SampleMode != otherHeader.SampleMode)
- return false;
- if (selfHeader.ScreenshotsHeight != otherHeader.ScreenshotsHeight)
- return false;
- if (selfHeader.ScreenshotsWidth != otherHeader.ScreenshotsWidth)
- return false;
- // Header.Search is intentionally skipped
- if (selfHeader.System != otherHeader.System)
- return false;
- if (selfHeader.Timestamp != otherHeader.Timestamp)
- return false;
- if (selfHeader.Type != otherHeader.Type)
- return false;
- if (selfHeader.Url != otherHeader.Url)
- return false;
- if (selfHeader.Version != otherHeader.Version)
- return false;
- }
-
// Check all pairs to see if they're equal
foreach (var kvp in self)
{
diff --git a/SabreTools.Serialization.CrossModel/Logiqx.Deserializer.cs b/SabreTools.Serialization.CrossModel/Logiqx.Deserializer.cs
index 7bf85575..ca81602e 100644
--- a/SabreTools.Serialization.CrossModel/Logiqx.Deserializer.cs
+++ b/SabreTools.Serialization.CrossModel/Logiqx.Deserializer.cs
@@ -23,7 +23,7 @@ namespace SabreTools.Serialization.CrossModel
{
datafile.Build = header.Build;
datafile.Debug = header.Debug;
- datafile.SchemaLocation = header.ReadString(Data.Models.Metadata.Header.SchemaLocationKey);
+ datafile.SchemaLocation = header.SchemaLocation;
datafile.Header = ConvertHeaderFromInternalModel(header);
}
diff --git a/SabreTools.Serialization.CrossModel/Logiqx.Serializer.cs b/SabreTools.Serialization.CrossModel/Logiqx.Serializer.cs
index 97ce3a76..b49e6291 100644
--- a/SabreTools.Serialization.CrossModel/Logiqx.Serializer.cs
+++ b/SabreTools.Serialization.CrossModel/Logiqx.Serializer.cs
@@ -41,7 +41,7 @@ namespace SabreTools.Serialization.CrossModel
header.Build = item.Build;
header.Debug = item.Debug;
- header[Data.Models.Metadata.Header.SchemaLocationKey] = item.SchemaLocation;
+ header.SchemaLocation = item.SchemaLocation;
return header;
}
diff --git a/SabreTools.Serialization.CrossModel/OfflineList.Deserializer.cs b/SabreTools.Serialization.CrossModel/OfflineList.Deserializer.cs
index f0348147..848cb263 100644
--- a/SabreTools.Serialization.CrossModel/OfflineList.Deserializer.cs
+++ b/SabreTools.Serialization.CrossModel/OfflineList.Deserializer.cs
@@ -33,7 +33,7 @@ namespace SabreTools.Serialization.CrossModel
{
var dat = new Dat
{
- NoNamespaceSchemaLocation = item.ReadString(Data.Models.Metadata.Header.SchemaLocationKey),
+ NoNamespaceSchemaLocation = item.SchemaLocation,
};
if (item.Name is not null
diff --git a/SabreTools.Serialization.CrossModel/OfflineList.Serializer.cs b/SabreTools.Serialization.CrossModel/OfflineList.Serializer.cs
index a6e91ce9..98984444 100644
--- a/SabreTools.Serialization.CrossModel/OfflineList.Serializer.cs
+++ b/SabreTools.Serialization.CrossModel/OfflineList.Serializer.cs
@@ -32,12 +32,12 @@ namespace SabreTools.Serialization.CrossModel
{
var header = new Data.Models.Metadata.Header
{
- [Data.Models.Metadata.Header.SchemaLocationKey] = item.NoNamespaceSchemaLocation,
+ SchemaLocation = item.NoNamespaceSchemaLocation,
};
if (item.Configuration is not null)
{
- header.Name = item.Configuration.DatName;
+ header.Name = item.Configuration.DatName;
header.ImFolder = item.Configuration.ImFolder;
header.DatVersion = item.Configuration.DatVersion;
header.System = item.Configuration.System;