diff --git a/README.MD b/README.MD
index 56f6bbf7..115ee792 100644
--- a/README.MD
+++ b/README.MD
@@ -82,7 +82,6 @@ Below are a list of the included namespaces with links to their README files:
- [SabreTools.Data.Extensions](https://github.com/SabreTools/SabreTools.Serialization/tree/main/SabreTools.Data.Extensions)
- [SabreTools.Data.Models](https://github.com/SabreTools/SabreTools.Serialization/tree/main/SabreTools.Data.Models)
-- [SabreTools.Metadata](https://github.com/SabreTools/SabreTools.Serialization/tree/main/SabreTools.Metadata)
- [SabreTools.Metadata.DatFiles](https://github.com/SabreTools/SabreTools.Serialization/tree/main/SabreTools.Metadata.DatFiles)
- [SabreTools.Metadata.DatItems](https://github.com/SabreTools/SabreTools.Serialization/tree/main/SabreTools.Metadata.Datitems)
- [SabreTools.Metadata.Filter](https://github.com/SabreTools/SabreTools.Serialization/tree/main/SabreTools.Metadata.Filter)
diff --git a/SabreTools.Data.Extensions.Test/MetadataExtensionsTests.cs b/SabreTools.Data.Extensions.Test/MetadataExtensionsTests.cs
index 5248b23c..f994865f 100644
--- a/SabreTools.Data.Extensions.Test/MetadataExtensionsTests.cs
+++ b/SabreTools.Data.Extensions.Test/MetadataExtensionsTests.cs
@@ -8,106 +8,1128 @@ namespace SabreTools.Data.Extensions.Test
{
#region ConvertToRom
- [Fact]
- public void ConvertToRom_Null_Null()
- {
- DictionaryBase? self = null;
- Rom? actual = self.ConvertToRom();
- Assert.Null(actual);
- }
-
[Fact]
public void ConvertToRom_EmptyDisk_EmptyRom()
{
- DictionaryBase? self = new Disk();
+ var self = new Disk();
Rom? actual = self.ConvertToRom();
Assert.NotNull(actual);
- Assert.Equal(8, actual.Count);
- Assert.Equal(ItemType.Rom, actual["_type"]);
- Assert.Null(actual[Rom.NameKey]);
- Assert.Null(actual[Rom.MergeKey]);
- Assert.Null(actual[Rom.RegionKey]);
- Assert.Null(actual[Rom.StatusKey]);
- Assert.Null(actual[Rom.OptionalKey]);
- Assert.Null(actual[Rom.MD5Key]);
- Assert.Null(actual[Rom.SHA1Key]);
+ Assert.Equal(ItemType.Rom, actual.ItemType);
+ Assert.Null(actual.Name);
+ Assert.Null(actual.Merge);
+ Assert.Null(actual.Region);
+ Assert.Null(actual.Status);
+ Assert.Null(actual.Optional);
+ Assert.Null(actual.MD5);
+ Assert.Null(actual.SHA1);
}
[Fact]
public void ConvertToRom_FilledDisk_FilledRom()
{
- DictionaryBase? self = new Disk
+ var self = new Disk
{
- [Disk.NameKey] = "XXXXXX",
- [Disk.MergeKey] = "XXXXXX",
- [Disk.RegionKey] = "XXXXXX",
- [Disk.StatusKey] = "XXXXXX",
- [Disk.OptionalKey] = "XXXXXX",
- [Disk.MD5Key] = "XXXXXX",
- [Disk.SHA1Key] = "XXXXXX",
+ Name = "name",
+ Merge = "merge",
+ Region = "region",
+ Status = ItemStatus.Good,
+ Optional = true,
+ MD5 = "md5",
+ SHA1 = "sha1",
};
Rom? actual = self.ConvertToRom();
Assert.NotNull(actual);
- Assert.Equal(8, actual.Count);
- Assert.Equal(ItemType.Rom, actual["_type"]);
- Assert.Equal("XXXXXX.chd", actual[Rom.NameKey]);
- Assert.Equal("XXXXXX", actual[Rom.MergeKey]);
- Assert.Equal("XXXXXX", actual[Rom.RegionKey]);
- Assert.Equal("XXXXXX", actual[Rom.StatusKey]);
- Assert.Equal("XXXXXX", actual[Rom.OptionalKey]);
- Assert.Equal("XXXXXX", actual[Rom.MD5Key]);
- Assert.Equal("XXXXXX", actual[Rom.SHA1Key]);
+ Assert.Equal(ItemType.Rom, actual.ItemType);
+ Assert.Equal("name.chd", actual.Name);
+ Assert.Equal("merge", actual.Merge);
+ Assert.Equal("region", actual.Region);
+ Assert.Equal(ItemStatus.Good, actual.Status);
+ Assert.Equal(true, actual.Optional);
+ Assert.Equal("md5", actual.MD5);
+ Assert.Equal("sha1", actual.SHA1);
}
[Fact]
public void ConvertToRom_EmptyMedia_EmptyRom()
{
- DictionaryBase? self = new Media();
+ var self = new Media();
Rom? actual = self.ConvertToRom();
Assert.NotNull(actual);
- Assert.Equal(6, actual.Count);
- Assert.Equal(ItemType.Rom, actual["_type"]);
- Assert.Null(actual[Rom.NameKey]);
- Assert.Null(actual[Rom.MD5Key]);
- Assert.Null(actual[Rom.SHA1Key]);
- Assert.Null(actual[Rom.SHA256Key]);
- Assert.Null(actual[Rom.SpamSumKey]);
+ Assert.Equal(ItemType.Rom, actual.ItemType);
+ Assert.Null(actual.Name);
+ Assert.Null(actual.MD5);
+ Assert.Null(actual.SHA1);
+ Assert.Null(actual.SHA256);
+ Assert.Null(actual.SpamSum);
}
[Fact]
public void ConvertToRom_FilledMedia_FilledRom()
{
- DictionaryBase? self = new Media
+ var self = new Media
{
- [Media.NameKey] = "XXXXXX",
- [Media.MD5Key] = "XXXXXX",
- [Media.SHA1Key] = "XXXXXX",
- [Media.SHA256Key] = "XXXXXX",
- [Media.SpamSumKey] = "XXXXXX",
+ Name = "name",
+ MD5 = "md5",
+ SHA1 = "sha1",
+ SHA256 = "sha256",
+ SpamSum = "spamsum",
};
Rom? actual = self.ConvertToRom();
Assert.NotNull(actual);
- Assert.Equal(6, actual.Count);
- Assert.Equal(ItemType.Rom, actual["_type"]);
- Assert.Equal("XXXXXX.aaruf", actual[Rom.NameKey]);
- Assert.Equal("XXXXXX", actual[Rom.MD5Key]);
- Assert.Equal("XXXXXX", actual[Rom.SHA1Key]);
- Assert.Equal("XXXXXX", actual[Rom.SHA256Key]);
- Assert.Equal("XXXXXX", actual[Rom.SpamSumKey]);
+ Assert.Equal(ItemType.Rom, actual.ItemType);
+ Assert.Equal("name.aaruf", actual.Name);
+ Assert.Equal("md5", actual.MD5);
+ Assert.Equal("sha1", actual.SHA1);
+ Assert.Equal("sha256", actual.SHA256);
+ Assert.Equal("spamsum", actual.SpamSum);
+ }
+
+ #endregion
+
+ #region PartialEquals
+
+ [Fact]
+ public void PartialEquals_Disk_Nodumps_True()
+ {
+ var self = new Disk
+ {
+ Status = ItemStatus.Nodump,
+ Name = "name",
+ MD5 = string.Empty,
+ SHA1 = string.Empty,
+ };
+ var other = new Disk
+ {
+ Status = ItemStatus.Nodump,
+ Name = "name",
+ MD5 = string.Empty,
+ SHA1 = string.Empty,
+ };
+
+ bool actual = self.PartialEquals(other);
+ Assert.True(actual);
}
[Fact]
- public void ConvertToRom_Other_Null()
+ public void PartialEquals_Disk_Mismatch_False()
{
- DictionaryBase? self = new Sample();
- Rom? actual = self.ConvertToRom();
- Assert.Null(actual);
+ var self = new Disk
+ {
+ Name = "name",
+ MD5 = "XXXXXX",
+ SHA1 = string.Empty,
+ };
+ var other = new Disk
+ {
+ Name = "name",
+ MD5 = string.Empty,
+ SHA1 = "XXXXXX",
+ };
+
+ bool actual = self.PartialEquals(other);
+ Assert.False(actual);
+ }
+
+ [Fact]
+ public void PartialEquals_Disk_PartialMD5_True()
+ {
+ var self = new Disk
+ {
+ Name = "XXXXXX1",
+ MD5 = "XXXXXX",
+ SHA1 = string.Empty,
+ };
+ var other = new Disk
+ {
+ Name = "XXXXXX2",
+ MD5 = "XXXXXX",
+ SHA1 = "XXXXXX",
+ };
+
+ bool actual = self.PartialEquals(other);
+ Assert.True(actual);
+ }
+
+ [Fact]
+ public void PartialEquals_Disk_PartialSHA1_True()
+ {
+ var self = new Disk
+ {
+ Name = "XXXXXX1",
+ MD5 = string.Empty,
+ SHA1 = "XXXXXX",
+ };
+ var other = new Disk
+ {
+ Name = "XXXXXX2",
+ MD5 = "XXXXXX",
+ SHA1 = "XXXXXX",
+ };
+
+ bool actual = self.PartialEquals(other);
+ Assert.True(actual);
+ }
+
+ [Fact]
+ public void PartialEquals_Disk_FullMatch_True()
+ {
+ var self = new Disk
+ {
+ Name = "XXXXXX1",
+ MD5 = "XXXXXX",
+ SHA1 = "XXXXXX",
+ };
+ var other = new Disk
+ {
+ Name = "XXXXXX2",
+ MD5 = "XXXXXX",
+ SHA1 = "XXXXXX",
+ };
+
+ bool actual = self.PartialEquals(other);
+ Assert.True(actual);
+ }
+
+ [Fact]
+ public void PartialEquals_Media_Mismatch_False()
+ {
+ var self = new Media
+ {
+ Name = "name",
+ MD5 = "XXXXXX",
+ SHA1 = string.Empty,
+ SHA256 = "XXXXXX",
+ SpamSum = string.Empty,
+ };
+ var other = new Media
+ {
+ Name = "name",
+ MD5 = string.Empty,
+ SHA1 = "XXXXXX",
+ SHA256 = string.Empty,
+ SpamSum = "XXXXXX",
+ };
+
+ bool actual = self.PartialEquals(other);
+ Assert.False(actual);
+ }
+
+ [Fact]
+ public void PartialEquals_Media_PartialMD5_True()
+ {
+ var self = new Media
+ {
+ Name = "name",
+ MD5 = "XXXXXX",
+ SHA1 = string.Empty,
+ SHA256 = string.Empty,
+ SpamSum = string.Empty,
+ };
+ var other = new Media
+ {
+ Name = "name",
+ MD5 = "XXXXXX",
+ SHA1 = "XXXXXX",
+ SHA256 = "XXXXXX",
+ SpamSum = "XXXXXX",
+ };
+
+ bool actual = self.PartialEquals(other);
+ Assert.True(actual);
+ }
+
+ [Fact]
+ public void PartialEquals_Media_PartialSHA1_True()
+ {
+ var self = new Media
+ {
+ Name = "name",
+ MD5 = string.Empty,
+ SHA1 = "XXXXXX",
+ SHA256 = string.Empty,
+ SpamSum = string.Empty,
+ };
+ var other = new Media
+ {
+ Name = "name",
+ MD5 = "XXXXXX",
+ SHA1 = "XXXXXX",
+ SHA256 = "XXXXXX",
+ SpamSum = "XXXXXX",
+ };
+
+ bool actual = self.PartialEquals(other);
+ Assert.True(actual);
+ }
+
+ [Fact]
+ public void PartialEquals_Media_PartialSHA256_True()
+ {
+ var self = new Media
+ {
+ Name = "name",
+ MD5 = string.Empty,
+ SHA1 = string.Empty,
+ SHA256 = "XXXXXX",
+ SpamSum = string.Empty,
+ };
+ var other = new Media
+ {
+ Name = "name",
+ MD5 = "XXXXXX",
+ SHA1 = "XXXXXX",
+ SHA256 = "XXXXXX",
+ SpamSum = "XXXXXX",
+ };
+
+ bool actual = self.PartialEquals(other);
+ Assert.True(actual);
+ }
+
+ [Fact]
+ public void PartialEquals_Media_PartialSpamSum_True()
+ {
+ var self = new Media
+ {
+ Name = "name",
+ MD5 = string.Empty,
+ SHA1 = string.Empty,
+ SHA256 = string.Empty,
+ SpamSum = "XXXXXX",
+ };
+ var other = new Media
+ {
+ Name = "name",
+ MD5 = "XXXXXX",
+ SHA1 = "XXXXXX",
+ SHA256 = "XXXXXX",
+ SpamSum = "XXXXXX",
+ };
+
+ bool actual = self.PartialEquals(other);
+ Assert.True(actual);
+ }
+
+ [Fact]
+ public void PartialEquals_Media_FullMatch_True()
+ {
+ var self = new Media
+ {
+ Name = "name",
+ MD5 = "XXXXXX",
+ SHA1 = "XXXXXX",
+ SHA256 = "XXXXXX",
+ SpamSum = "XXXXXX",
+ };
+ var other = new Media
+ {
+ Name = "name",
+ MD5 = "XXXXXX",
+ SHA1 = "XXXXXX",
+ SHA256 = "XXXXXX",
+ SpamSum = "XXXXXX",
+ };
+
+ bool actual = self.PartialEquals(other);
+ Assert.True(actual);
+ }
+
+ [Fact]
+ public void PartialEquals_Rom_Nodumps_True()
+ {
+ var self = new Rom
+ {
+ Status = ItemStatus.Nodump,
+ Name = "name",
+ Size = 12345,
+ CRC16 = string.Empty,
+ CRC32 = string.Empty,
+ CRC64 = string.Empty,
+ MD2 = string.Empty,
+ MD4 = string.Empty,
+ MD5 = string.Empty,
+ RIPEMD128 = string.Empty,
+ RIPEMD160 = string.Empty,
+ SHA1 = string.Empty,
+ SHA256 = string.Empty,
+ SHA384 = string.Empty,
+ SHA512 = string.Empty,
+ SpamSum = string.Empty,
+ };
+ var other = new Rom
+ {
+ Status = ItemStatus.Nodump,
+ Name = "name",
+ Size = 12345,
+ CRC16 = string.Empty,
+ CRC32 = string.Empty,
+ CRC64 = string.Empty,
+ MD2 = string.Empty,
+ MD4 = string.Empty,
+ MD5 = string.Empty,
+ RIPEMD128 = string.Empty,
+ RIPEMD160 = string.Empty,
+ SHA1 = string.Empty,
+ SHA256 = string.Empty,
+ SHA384 = string.Empty,
+ SHA512 = string.Empty,
+ SpamSum = string.Empty,
+ };
+
+ bool actual = self.PartialEquals(other);
+ Assert.True(actual);
+ }
+
+ [Fact]
+ public void PartialEquals_Rom_Mismatch_False()
+ {
+ var self = new Rom
+ {
+ Name = "name",
+ Size = 12345,
+ CRC16 = "XXXXXX",
+ CRC32 = string.Empty,
+ CRC64 = "XXXXXX",
+ MD2 = string.Empty,
+ MD4 = "XXXXXX",
+ MD5 = string.Empty,
+ RIPEMD128 = "XXXXXX",
+ RIPEMD160 = string.Empty,
+ SHA1 = "XXXXXX",
+ SHA256 = string.Empty,
+ SHA384 = "XXXXXX",
+ SHA512 = string.Empty,
+ SpamSum = "XXXXXX",
+ };
+ var other = new Rom
+ {
+ Name = "name",
+ Size = 12345,
+ CRC16 = string.Empty,
+ CRC32 = "XXXXXX",
+ CRC64 = string.Empty,
+ MD2 = "XXXXXX",
+ MD4 = string.Empty,
+ MD5 = "XXXXXX",
+ RIPEMD128 = string.Empty,
+ RIPEMD160 = "XXXXXX",
+ SHA1 = string.Empty,
+ SHA256 = "XXXXXX",
+ SHA384 = string.Empty,
+ SHA512 = "XXXXXX",
+ SpamSum = string.Empty,
+ };
+
+ bool actual = self.PartialEquals(other);
+ Assert.False(actual);
+ }
+
+ [Fact]
+ public void PartialEquals_Rom_NoSelfSize_True()
+ {
+ var self = new Rom
+ {
+ Name = "XXXXXX1",
+ CRC16 = "XXXXXX",
+ CRC32 = "XXXXXX",
+ CRC64 = "XXXXXX",
+ MD2 = "XXXXXX",
+ MD4 = "XXXXXX",
+ MD5 = "XXXXXX",
+ RIPEMD128 = "XXXXXX",
+ RIPEMD160 = "XXXXXX",
+ SHA1 = "XXXXXX",
+ SHA256 = "XXXXXX",
+ SHA384 = "XXXXXX",
+ SHA512 = "XXXXXX",
+ SpamSum = "XXXXXX",
+ };
+ var other = new Rom
+ {
+ Name = "XXXXXX2",
+ Size = 12345,
+ CRC16 = "XXXXXX",
+ CRC32 = "XXXXXX",
+ CRC64 = "XXXXXX",
+ MD2 = "XXXXXX",
+ MD4 = "XXXXXX",
+ MD5 = "XXXXXX",
+ RIPEMD128 = "XXXXXX",
+ RIPEMD160 = "XXXXXX",
+ SHA1 = "XXXXXX",
+ SHA256 = "XXXXXX",
+ SHA384 = "XXXXXX",
+ SHA512 = "XXXXXX",
+ SpamSum = "XXXXXX",
+ };
+
+ bool actual = self.PartialEquals(other);
+ Assert.True(actual);
+ }
+
+ [Fact]
+ public void PartialEquals_Rom_NoOtherSize_True()
+ {
+ var self = new Rom
+ {
+ Name = "XXXXXX1",
+ Size = 12345,
+ CRC16 = "XXXXXX",
+ CRC32 = "XXXXXX",
+ CRC64 = "XXXXXX",
+ MD2 = "XXXXXX",
+ MD4 = "XXXXXX",
+ MD5 = "XXXXXX",
+ RIPEMD128 = "XXXXXX",
+ RIPEMD160 = "XXXXXX",
+ SHA1 = "XXXXXX",
+ SHA256 = "XXXXXX",
+ SHA384 = "XXXXXX",
+ SHA512 = "XXXXXX",
+ SpamSum = "XXXXXX",
+ };
+ var other = new Rom
+ {
+ Name = "XXXXXX2",
+ CRC16 = "XXXXXX",
+ CRC32 = "XXXXXX",
+ CRC64 = "XXXXXX",
+ MD2 = "XXXXXX",
+ MD4 = "XXXXXX",
+ MD5 = "XXXXXX",
+ RIPEMD128 = "XXXXXX",
+ RIPEMD160 = "XXXXXX",
+ SHA1 = "XXXXXX",
+ SHA256 = "XXXXXX",
+ SHA384 = "XXXXXX",
+ SHA512 = "XXXXXX",
+ SpamSum = "XXXXXX",
+ };
+
+ bool actual = self.PartialEquals(other);
+ Assert.True(actual);
+ }
+
+ [Fact]
+ public void PartialEquals_Rom_PartialCRC16_True()
+ {
+ var self = new Rom
+ {
+ Name = "XXXXXX1",
+ Size = 12345,
+ CRC16 = "XXXXXX",
+ CRC32 = string.Empty,
+ CRC64 = string.Empty,
+ MD2 = string.Empty,
+ MD4 = string.Empty,
+ MD5 = string.Empty,
+ RIPEMD128 = string.Empty,
+ RIPEMD160 = string.Empty,
+ SHA1 = string.Empty,
+ SHA256 = string.Empty,
+ SHA384 = string.Empty,
+ SHA512 = string.Empty,
+ SpamSum = string.Empty,
+ };
+ var other = new Rom
+ {
+ Name = "XXXXXX2",
+ Size = 12345,
+ CRC16 = "XXXXXX",
+ CRC32 = "XXXXXX",
+ CRC64 = "XXXXXX",
+ MD2 = "XXXXXX",
+ MD4 = "XXXXXX",
+ MD5 = "XXXXXX",
+ RIPEMD128 = "XXXXXX",
+ RIPEMD160 = "XXXXXX",
+ SHA1 = "XXXXXX",
+ SHA256 = "XXXXXX",
+ SHA384 = "XXXXXX",
+ SHA512 = "XXXXXX",
+ SpamSum = "XXXXXX",
+ };
+
+ bool actual = self.PartialEquals(other);
+ Assert.True(actual);
+ }
+
+ [Fact]
+ public void PartialEquals_Rom_PartialCRC_True()
+ {
+ var self = new Rom
+ {
+ Name = "XXXXXX1",
+ Size = 12345,
+ CRC16 = string.Empty,
+ CRC32 = "XXXXXX",
+ CRC64 = string.Empty,
+ MD2 = string.Empty,
+ MD4 = string.Empty,
+ MD5 = string.Empty,
+ RIPEMD128 = string.Empty,
+ RIPEMD160 = string.Empty,
+ SHA1 = string.Empty,
+ SHA256 = string.Empty,
+ SHA384 = string.Empty,
+ SHA512 = string.Empty,
+ SpamSum = string.Empty,
+ };
+ var other = new Rom
+ {
+ Name = "XXXXXX2",
+ Size = 12345,
+ CRC16 = "XXXXXX",
+ CRC32 = "XXXXXX",
+ CRC64 = "XXXXXX",
+ MD2 = "XXXXXX",
+ MD4 = "XXXXXX",
+ MD5 = "XXXXXX",
+ RIPEMD128 = "XXXXXX",
+ RIPEMD160 = "XXXXXX",
+ SHA1 = "XXXXXX",
+ SHA256 = "XXXXXX",
+ SHA384 = "XXXXXX",
+ SHA512 = "XXXXXX",
+ SpamSum = "XXXXXX",
+ };
+
+ bool actual = self.PartialEquals(other);
+ Assert.True(actual);
+ }
+
+ [Fact]
+ public void PartialEquals_Rom_PartialCRC64_True()
+ {
+ var self = new Rom
+ {
+ Name = "XXXXXX1",
+ Size = 12345,
+ CRC16 = string.Empty,
+ CRC32 = string.Empty,
+ CRC64 = "XXXXXX",
+ MD2 = string.Empty,
+ MD4 = string.Empty,
+ MD5 = string.Empty,
+ RIPEMD128 = string.Empty,
+ RIPEMD160 = string.Empty,
+ SHA1 = string.Empty,
+ SHA256 = string.Empty,
+ SHA384 = string.Empty,
+ SHA512 = string.Empty,
+ SpamSum = string.Empty,
+ };
+ var other = new Rom
+ {
+ Name = "XXXXXX2",
+ Size = 12345,
+ CRC16 = "XXXXXX",
+ CRC32 = "XXXXXX",
+ CRC64 = "XXXXXX",
+ MD2 = "XXXXXX",
+ MD4 = "XXXXXX",
+ MD5 = "XXXXXX",
+ RIPEMD128 = "XXXXXX",
+ RIPEMD160 = "XXXXXX",
+ SHA1 = "XXXXXX",
+ SHA256 = "XXXXXX",
+ SHA384 = "XXXXXX",
+ SHA512 = "XXXXXX",
+ SpamSum = "XXXXXX",
+ };
+
+ bool actual = self.PartialEquals(other);
+ Assert.True(actual);
+ }
+
+ [Fact]
+ public void PartialEquals_Rom_PartialMD2_True()
+ {
+ var self = new Rom
+ {
+ Name = "XXXXXX1",
+ Size = 12345,
+ CRC16 = string.Empty,
+ CRC32 = string.Empty,
+ CRC64 = string.Empty,
+ MD2 = "XXXXXX",
+ MD4 = string.Empty,
+ MD5 = string.Empty,
+ RIPEMD128 = string.Empty,
+ RIPEMD160 = string.Empty,
+ SHA1 = string.Empty,
+ SHA256 = string.Empty,
+ SHA384 = string.Empty,
+ SHA512 = string.Empty,
+ SpamSum = string.Empty,
+ };
+ var other = new Rom
+ {
+ Name = "XXXXXX2",
+ Size = 12345,
+ CRC16 = "XXXXXX",
+ CRC32 = "XXXXXX",
+ CRC64 = "XXXXXX",
+ MD2 = "XXXXXX",
+ MD4 = "XXXXXX",
+ MD5 = "XXXXXX",
+ RIPEMD128 = "XXXXXX",
+ RIPEMD160 = "XXXXXX",
+ SHA1 = "XXXXXX",
+ SHA256 = "XXXXXX",
+ SHA384 = "XXXXXX",
+ SHA512 = "XXXXXX",
+ SpamSum = "XXXXXX",
+ };
+
+ bool actual = self.PartialEquals(other);
+ Assert.True(actual);
+ }
+
+ [Fact]
+ public void PartialEquals_Rom_PartialMD4_True()
+ {
+ var self = new Rom
+ {
+ Name = "XXXXXX1",
+ Size = 12345,
+ CRC16 = string.Empty,
+ CRC32 = string.Empty,
+ CRC64 = string.Empty,
+ MD2 = string.Empty,
+ MD4 = "XXXXXX",
+ MD5 = string.Empty,
+ RIPEMD128 = string.Empty,
+ RIPEMD160 = string.Empty,
+ SHA1 = string.Empty,
+ SHA256 = string.Empty,
+ SHA384 = string.Empty,
+ SHA512 = string.Empty,
+ SpamSum = string.Empty,
+ };
+ var other = new Rom
+ {
+ Name = "XXXXXX2",
+ Size = 12345,
+ CRC16 = "XXXXXX",
+ CRC32 = "XXXXXX",
+ CRC64 = "XXXXXX",
+ MD2 = "XXXXXX",
+ MD4 = "XXXXXX",
+ MD5 = "XXXXXX",
+ RIPEMD128 = "XXXXXX",
+ RIPEMD160 = "XXXXXX",
+ SHA1 = "XXXXXX",
+ SHA256 = "XXXXXX",
+ SHA384 = "XXXXXX",
+ SHA512 = "XXXXXX",
+ SpamSum = "XXXXXX",
+ };
+
+ bool actual = self.PartialEquals(other);
+ Assert.True(actual);
+ }
+
+ [Fact]
+ public void PartialEquals_Rom_PartialMD5_True()
+ {
+ var self = new Rom
+ {
+ Name = "XXXXXX1",
+ Size = 12345,
+ CRC16 = string.Empty,
+ CRC32 = string.Empty,
+ CRC64 = string.Empty,
+ MD2 = string.Empty,
+ MD4 = string.Empty,
+ MD5 = "XXXXXX",
+ RIPEMD128 = string.Empty,
+ RIPEMD160 = string.Empty,
+ SHA1 = string.Empty,
+ SHA256 = string.Empty,
+ SHA384 = string.Empty,
+ SHA512 = string.Empty,
+ SpamSum = string.Empty,
+ };
+ var other = new Rom
+ {
+ Name = "XXXXXX2",
+ Size = 12345,
+ CRC16 = "XXXXXX",
+ CRC32 = "XXXXXX",
+ CRC64 = "XXXXXX",
+ MD2 = "XXXXXX",
+ MD4 = "XXXXXX",
+ MD5 = "XXXXXX",
+ RIPEMD128 = "XXXXXX",
+ RIPEMD160 = "XXXXXX",
+ SHA1 = "XXXXXX",
+ SHA256 = "XXXXXX",
+ SHA384 = "XXXXXX",
+ SHA512 = "XXXXXX",
+ SpamSum = "XXXXXX",
+ };
+
+ bool actual = self.PartialEquals(other);
+ Assert.True(actual);
+ }
+
+ [Fact]
+ public void PartialEquals_Rom_PartialRIPEMD128_True()
+ {
+ var self = new Rom
+ {
+ Name = "XXXXXX1",
+ Size = 12345,
+ CRC16 = string.Empty,
+ CRC32 = string.Empty,
+ CRC64 = string.Empty,
+ MD2 = string.Empty,
+ MD4 = string.Empty,
+ MD5 = string.Empty,
+ RIPEMD128 = "XXXXXX",
+ RIPEMD160 = string.Empty,
+ SHA1 = string.Empty,
+ SHA256 = string.Empty,
+ SHA384 = string.Empty,
+ SHA512 = string.Empty,
+ SpamSum = string.Empty,
+ };
+ var other = new Rom
+ {
+ Name = "XXXXXX2",
+ Size = 12345,
+ CRC16 = "XXXXXX",
+ CRC32 = "XXXXXX",
+ CRC64 = "XXXXXX",
+ MD2 = "XXXXXX",
+ MD4 = "XXXXXX",
+ MD5 = "XXXXXX",
+ RIPEMD128 = "XXXXXX",
+ RIPEMD160 = "XXXXXX",
+ SHA1 = "XXXXXX",
+ SHA256 = "XXXXXX",
+ SHA384 = "XXXXXX",
+ SHA512 = "XXXXXX",
+ SpamSum = "XXXXXX",
+ };
+
+ bool actual = self.PartialEquals(other);
+ Assert.True(actual);
+ }
+
+ [Fact]
+ public void PartialEquals_Rom_PartialRIPEMD160_True()
+ {
+ var self = new Rom
+ {
+ Name = "XXXXXX1",
+ Size = 12345,
+ CRC16 = string.Empty,
+ CRC32 = string.Empty,
+ CRC64 = string.Empty,
+ MD2 = string.Empty,
+ MD4 = string.Empty,
+ MD5 = string.Empty,
+ RIPEMD128 = string.Empty,
+ RIPEMD160 = "XXXXXX",
+ SHA1 = string.Empty,
+ SHA256 = string.Empty,
+ SHA384 = string.Empty,
+ SHA512 = string.Empty,
+ SpamSum = string.Empty,
+ };
+ var other = new Rom
+ {
+ Name = "XXXXXX2",
+ Size = 12345,
+ CRC16 = "XXXXXX",
+ CRC32 = "XXXXXX",
+ CRC64 = "XXXXXX",
+ MD2 = "XXXXXX",
+ MD4 = "XXXXXX",
+ MD5 = "XXXXXX",
+ RIPEMD128 = "XXXXXX",
+ RIPEMD160 = "XXXXXX",
+ SHA1 = "XXXXXX",
+ SHA256 = "XXXXXX",
+ SHA384 = "XXXXXX",
+ SHA512 = "XXXXXX",
+ SpamSum = "XXXXXX",
+ };
+
+ bool actual = self.PartialEquals(other);
+ Assert.True(actual);
+ }
+
+ [Fact]
+ public void PartialEquals_Rom_PartialSHA1_True()
+ {
+ var self = new Rom
+ {
+ Name = "XXXXXX1",
+ Size = 12345,
+ CRC16 = string.Empty,
+ CRC32 = string.Empty,
+ CRC64 = string.Empty,
+ MD2 = string.Empty,
+ MD4 = string.Empty,
+ MD5 = string.Empty,
+ RIPEMD128 = string.Empty,
+ RIPEMD160 = string.Empty,
+ SHA1 = "XXXXXX",
+ SHA256 = string.Empty,
+ SHA384 = string.Empty,
+ SHA512 = string.Empty,
+ SpamSum = string.Empty,
+ };
+ var other = new Rom
+ {
+ Name = "XXXXXX2",
+ Size = 12345,
+ CRC16 = "XXXXXX",
+ CRC32 = "XXXXXX",
+ CRC64 = "XXXXXX",
+ MD2 = "XXXXXX",
+ MD4 = "XXXXXX",
+ MD5 = "XXXXXX",
+ RIPEMD128 = "XXXXXX",
+ RIPEMD160 = "XXXXXX",
+ SHA1 = "XXXXXX",
+ SHA256 = "XXXXXX",
+ SHA384 = "XXXXXX",
+ SHA512 = "XXXXXX",
+ SpamSum = "XXXXXX",
+ };
+
+ bool actual = self.PartialEquals(other);
+ Assert.True(actual);
+ }
+
+ [Fact]
+ public void PartialEquals_Rom_PartialSHA256_True()
+ {
+ var self = new Rom
+ {
+ Name = "XXXXXX1",
+ Size = 12345,
+ CRC16 = string.Empty,
+ CRC32 = string.Empty,
+ CRC64 = string.Empty,
+ MD2 = string.Empty,
+ MD4 = string.Empty,
+ MD5 = string.Empty,
+ RIPEMD128 = string.Empty,
+ RIPEMD160 = string.Empty,
+ SHA1 = string.Empty,
+ SHA256 = "XXXXXX",
+ SHA384 = string.Empty,
+ SHA512 = string.Empty,
+ SpamSum = string.Empty,
+ };
+ var other = new Rom
+ {
+ Name = "XXXXXX2",
+ Size = 12345,
+ CRC16 = "XXXXXX",
+ CRC32 = "XXXXXX",
+ CRC64 = "XXXXXX",
+ MD2 = "XXXXXX",
+ MD4 = "XXXXXX",
+ MD5 = "XXXXXX",
+ RIPEMD128 = "XXXXXX",
+ RIPEMD160 = "XXXXXX",
+ SHA1 = "XXXXXX",
+ SHA256 = "XXXXXX",
+ SHA384 = "XXXXXX",
+ SHA512 = "XXXXXX",
+ SpamSum = "XXXXXX",
+ };
+
+ bool actual = self.PartialEquals(other);
+ Assert.True(actual);
+ }
+
+ [Fact]
+ public void PartialEquals_Rom_PartialSHA384_True()
+ {
+ var self = new Rom
+ {
+ Name = "XXXXXX1",
+ Size = 12345,
+ CRC16 = string.Empty,
+ CRC32 = string.Empty,
+ CRC64 = string.Empty,
+ MD2 = string.Empty,
+ MD4 = string.Empty,
+ MD5 = string.Empty,
+ RIPEMD128 = string.Empty,
+ RIPEMD160 = string.Empty,
+ SHA1 = string.Empty,
+ SHA256 = string.Empty,
+ SHA384 = "XXXXXX",
+ SHA512 = string.Empty,
+ SpamSum = string.Empty,
+ };
+ var other = new Rom
+ {
+ Name = "XXXXXX2",
+ Size = 12345,
+ CRC16 = "XXXXXX",
+ CRC32 = "XXXXXX",
+ CRC64 = "XXXXXX",
+ MD2 = "XXXXXX",
+ MD4 = "XXXXXX",
+ MD5 = "XXXXXX",
+ RIPEMD128 = "XXXXXX",
+ RIPEMD160 = "XXXXXX",
+ SHA1 = "XXXXXX",
+ SHA256 = "XXXXXX",
+ SHA384 = "XXXXXX",
+ SHA512 = "XXXXXX",
+ SpamSum = "XXXXXX",
+ };
+
+ bool actual = self.PartialEquals(other);
+ Assert.True(actual);
+ }
+
+ [Fact]
+ public void PartialEquals_Rom_PartialSHA512_True()
+ {
+ var self = new Rom
+ {
+ Name = "XXXXXX1",
+ Size = 12345,
+ CRC16 = string.Empty,
+ CRC32 = string.Empty,
+ CRC64 = string.Empty,
+ MD2 = string.Empty,
+ MD4 = string.Empty,
+ MD5 = string.Empty,
+ RIPEMD128 = string.Empty,
+ RIPEMD160 = string.Empty,
+ SHA1 = string.Empty,
+ SHA256 = string.Empty,
+ SHA384 = string.Empty,
+ SHA512 = "XXXXXX",
+ SpamSum = string.Empty,
+ };
+ var other = new Rom
+ {
+ Name = "XXXXXX2",
+ Size = 12345,
+ CRC16 = "XXXXXX",
+ CRC32 = "XXXXXX",
+ CRC64 = "XXXXXX",
+ MD2 = "XXXXXX",
+ MD4 = "XXXXXX",
+ MD5 = "XXXXXX",
+ RIPEMD128 = "XXXXXX",
+ RIPEMD160 = "XXXXXX",
+ SHA1 = "XXXXXX",
+ SHA256 = "XXXXXX",
+ SHA384 = "XXXXXX",
+ SHA512 = "XXXXXX",
+ SpamSum = "XXXXXX",
+ };
+
+ bool actual = self.PartialEquals(other);
+ Assert.True(actual);
+ }
+
+ [Fact]
+ public void PartialEquals_Rom_PartialSpamSum_True()
+ {
+ var self = new Rom
+ {
+ Name = "XXXXXX1",
+ Size = 12345,
+ CRC16 = string.Empty,
+ CRC32 = string.Empty,
+ CRC64 = string.Empty,
+ MD2 = string.Empty,
+ MD4 = string.Empty,
+ MD5 = string.Empty,
+ RIPEMD128 = string.Empty,
+ RIPEMD160 = string.Empty,
+ SHA1 = string.Empty,
+ SHA256 = string.Empty,
+ SHA384 = string.Empty,
+ SHA512 = string.Empty,
+ SpamSum = "XXXXXX",
+ };
+ var other = new Rom
+ {
+ Name = "XXXXXX2",
+ Size = 12345,
+ CRC16 = "XXXXXX",
+ CRC32 = "XXXXXX",
+ CRC64 = "XXXXXX",
+ MD2 = "XXXXXX",
+ MD4 = "XXXXXX",
+ MD5 = "XXXXXX",
+ RIPEMD128 = "XXXXXX",
+ RIPEMD160 = "XXXXXX",
+ SHA1 = "XXXXXX",
+ SHA256 = "XXXXXX",
+ SHA384 = "XXXXXX",
+ SHA512 = "XXXXXX",
+ SpamSum = "XXXXXX",
+ };
+
+ bool actual = self.PartialEquals(other);
+ Assert.True(actual);
+ }
+
+ [Fact]
+ public void PartialEquals_Rom_FullMatch_True()
+ {
+ var self = new Rom
+ {
+ Name = "XXXXXX1",
+ Size = 12345,
+ CRC16 = "XXXXXX",
+ CRC32 = "XXXXXX",
+ CRC64 = "XXXXXX",
+ MD2 = "XXXXXX",
+ MD4 = "XXXXXX",
+ MD5 = "XXXXXX",
+ RIPEMD128 = "XXXXXX",
+ RIPEMD160 = "XXXXXX",
+ SHA1 = "XXXXXX",
+ SHA256 = "XXXXXX",
+ SHA384 = "XXXXXX",
+ SHA512 = "XXXXXX",
+ SpamSum = "XXXXXX",
+ };
+ var other = new Rom
+ {
+ Name = "XXXXXX2",
+ Size = 12345,
+ CRC16 = "XXXXXX",
+ CRC32 = "XXXXXX",
+ CRC64 = "XXXXXX",
+ MD2 = "XXXXXX",
+ MD4 = "XXXXXX",
+ MD5 = "XXXXXX",
+ RIPEMD128 = "XXXXXX",
+ RIPEMD160 = "XXXXXX",
+ SHA1 = "XXXXXX",
+ SHA256 = "XXXXXX",
+ SHA384 = "XXXXXX",
+ SHA512 = "XXXXXX",
+ SpamSum = "XXXXXX",
+ };
+
+ bool actual = self.PartialEquals(other);
+ Assert.True(actual);
}
#endregion
@@ -153,13 +1175,13 @@ namespace SabreTools.Data.Extensions.Test
{
Disk self = new Disk
{
- [Disk.MD5Key] = "XXXXXX",
- [Disk.SHA1Key] = string.Empty,
+ MD5 = "md5",
+ SHA1 = string.Empty,
};
Disk other = new Disk
{
- [Disk.MD5Key] = string.Empty,
- [Disk.SHA1Key] = "XXXXXX",
+ MD5 = string.Empty,
+ SHA1 = "sha1",
};
bool actual = self.HashMatch(other);
@@ -171,13 +1193,13 @@ namespace SabreTools.Data.Extensions.Test
{
Disk self = new Disk
{
- [Disk.MD5Key] = "XXXXXX",
- [Disk.SHA1Key] = string.Empty,
+ MD5 = "md5",
+ SHA1 = string.Empty,
};
Disk other = new Disk
{
- [Disk.MD5Key] = "XXXXXX",
- [Disk.SHA1Key] = "XXXXXX",
+ MD5 = "md5",
+ SHA1 = "sha1",
};
bool actual = self.HashMatch(other);
@@ -189,13 +1211,13 @@ namespace SabreTools.Data.Extensions.Test
{
Disk self = new Disk
{
- [Disk.MD5Key] = string.Empty,
- [Disk.SHA1Key] = "XXXXXX",
+ MD5 = string.Empty,
+ SHA1 = "sha1",
};
Disk other = new Disk
{
- [Disk.MD5Key] = "XXXXXX",
- [Disk.SHA1Key] = "XXXXXX",
+ MD5 = "md5",
+ SHA1 = "sha1",
};
bool actual = self.HashMatch(other);
@@ -207,13 +1229,13 @@ namespace SabreTools.Data.Extensions.Test
{
Disk self = new Disk
{
- [Disk.MD5Key] = "XXXXXX",
- [Disk.SHA1Key] = "XXXXXX",
+ MD5 = "md5",
+ SHA1 = "sha1",
};
Disk other = new Disk
{
- [Disk.MD5Key] = "XXXXXX",
- [Disk.SHA1Key] = "XXXXXX",
+ MD5 = "md5",
+ SHA1 = "sha1",
};
bool actual = self.HashMatch(other);
@@ -225,17 +1247,17 @@ namespace SabreTools.Data.Extensions.Test
{
Media self = new Media
{
- [Media.MD5Key] = "XXXXXX",
- [Media.SHA1Key] = string.Empty,
- [Media.SHA256Key] = "XXXXXX",
- [Media.SpamSumKey] = string.Empty,
+ MD5 = "md5",
+ SHA1 = string.Empty,
+ SHA256 = "sha256",
+ SpamSum = string.Empty,
};
Media other = new Media
{
- [Media.MD5Key] = string.Empty,
- [Media.SHA1Key] = "XXXXXX",
- [Media.SHA256Key] = string.Empty,
- [Media.SpamSumKey] = "XXXXXX",
+ MD5 = string.Empty,
+ SHA1 = "sha1",
+ SHA256 = string.Empty,
+ SpamSum = "spamsum",
};
bool actual = self.HashMatch(other);
@@ -247,17 +1269,17 @@ namespace SabreTools.Data.Extensions.Test
{
Media self = new Media
{
- [Media.MD5Key] = "XXXXXX",
- [Media.SHA1Key] = string.Empty,
- [Media.SHA256Key] = string.Empty,
- [Media.SpamSumKey] = string.Empty,
+ MD5 = "XXXXXX",
+ SHA1 = string.Empty,
+ SHA256 = string.Empty,
+ SpamSum = string.Empty,
};
Media other = new Media
{
- [Media.MD5Key] = "XXXXXX",
- [Media.SHA1Key] = "XXXXXX",
- [Media.SHA256Key] = "XXXXXX",
- [Media.SpamSumKey] = "XXXXXX",
+ MD5 = "XXXXXX",
+ SHA1 = "XXXXXX",
+ SHA256 = "XXXXXX",
+ SpamSum = "XXXXXX",
};
bool actual = self.HashMatch(other);
@@ -269,17 +1291,17 @@ namespace SabreTools.Data.Extensions.Test
{
Media self = new Media
{
- [Media.MD5Key] = string.Empty,
- [Media.SHA1Key] = "XXXXXX",
- [Media.SHA256Key] = string.Empty,
- [Media.SpamSumKey] = string.Empty,
+ MD5 = string.Empty,
+ SHA1 = "XXXXXX",
+ SHA256 = string.Empty,
+ SpamSum = string.Empty,
};
Media other = new Media
{
- [Media.MD5Key] = "XXXXXX",
- [Media.SHA1Key] = "XXXXXX",
- [Media.SHA256Key] = "XXXXXX",
- [Media.SpamSumKey] = "XXXXXX",
+ MD5 = "XXXXXX",
+ SHA1 = "XXXXXX",
+ SHA256 = "XXXXXX",
+ SpamSum = "XXXXXX",
};
bool actual = self.HashMatch(other);
@@ -291,17 +1313,17 @@ namespace SabreTools.Data.Extensions.Test
{
Media self = new Media
{
- [Media.MD5Key] = string.Empty,
- [Media.SHA1Key] = string.Empty,
- [Media.SHA256Key] = "XXXXXX",
- [Media.SpamSumKey] = string.Empty,
+ MD5 = string.Empty,
+ SHA1 = string.Empty,
+ SHA256 = "XXXXXX",
+ SpamSum = string.Empty,
};
Media other = new Media
{
- [Media.MD5Key] = "XXXXXX",
- [Media.SHA1Key] = "XXXXXX",
- [Media.SHA256Key] = "XXXXXX",
- [Media.SpamSumKey] = "XXXXXX",
+ MD5 = "XXXXXX",
+ SHA1 = "XXXXXX",
+ SHA256 = "XXXXXX",
+ SpamSum = "XXXXXX",
};
bool actual = self.HashMatch(other);
@@ -313,17 +1335,17 @@ namespace SabreTools.Data.Extensions.Test
{
Media self = new Media
{
- [Media.MD5Key] = string.Empty,
- [Media.SHA1Key] = string.Empty,
- [Media.SHA256Key] = string.Empty,
- [Media.SpamSumKey] = "XXXXXX",
+ MD5 = string.Empty,
+ SHA1 = string.Empty,
+ SHA256 = string.Empty,
+ SpamSum = "XXXXXX",
};
Media other = new Media
{
- [Media.MD5Key] = "XXXXXX",
- [Media.SHA1Key] = "XXXXXX",
- [Media.SHA256Key] = "XXXXXX",
- [Media.SpamSumKey] = "XXXXXX",
+ MD5 = "XXXXXX",
+ SHA1 = "XXXXXX",
+ SHA256 = "XXXXXX",
+ SpamSum = "XXXXXX",
};
bool actual = self.HashMatch(other);
@@ -335,17 +1357,17 @@ namespace SabreTools.Data.Extensions.Test
{
Media self = new Media
{
- [Media.MD5Key] = "XXXXXX",
- [Media.SHA1Key] = "XXXXXX",
- [Media.SHA256Key] = "XXXXXX",
- [Media.SpamSumKey] = "XXXXXX",
+ MD5 = "XXXXXX",
+ SHA1 = "XXXXXX",
+ SHA256 = "XXXXXX",
+ SpamSum = "XXXXXX",
};
Media other = new Media
{
- [Media.MD5Key] = "XXXXXX",
- [Media.SHA1Key] = "XXXXXX",
- [Media.SHA256Key] = "XXXXXX",
- [Media.SpamSumKey] = "XXXXXX",
+ MD5 = "XXXXXX",
+ SHA1 = "XXXXXX",
+ SHA256 = "XXXXXX",
+ SpamSum = "XXXXXX",
};
bool actual = self.HashMatch(other);
@@ -357,35 +1379,35 @@ namespace SabreTools.Data.Extensions.Test
{
Rom self = new Rom
{
- [Rom.CRC16Key] = "XXXXXX",
- [Rom.CRCKey] = string.Empty,
- [Rom.CRC64Key] = "XXXXXX",
- [Rom.MD2Key] = string.Empty,
- [Rom.MD4Key] = "XXXXXX",
- [Rom.MD5Key] = string.Empty,
- [Rom.RIPEMD128Key] = "XXXXXX",
- [Rom.RIPEMD160Key] = string.Empty,
- [Rom.SHA1Key] = "XXXXXX",
- [Rom.SHA256Key] = string.Empty,
- [Rom.SHA384Key] = "XXXXXX",
- [Rom.SHA512Key] = string.Empty,
- [Rom.SpamSumKey] = "XXXXXX",
+ CRC16 = "XXXXXX",
+ CRC32 = string.Empty,
+ CRC64 = "XXXXXX",
+ MD2 = string.Empty,
+ MD4 = "XXXXXX",
+ MD5 = string.Empty,
+ RIPEMD128 = "XXXXXX",
+ RIPEMD160 = string.Empty,
+ SHA1 = "XXXXXX",
+ SHA256 = string.Empty,
+ SHA384 = "XXXXXX",
+ SHA512 = string.Empty,
+ SpamSum = "XXXXXX",
};
Rom other = new Rom
{
- [Rom.CRC16Key] = string.Empty,
- [Rom.CRCKey] = "XXXXXX",
- [Rom.CRC64Key] = string.Empty,
- [Rom.MD2Key] = "XXXXXX",
- [Rom.MD4Key] = string.Empty,
- [Rom.MD5Key] = "XXXXXX",
- [Rom.RIPEMD128Key] = string.Empty,
- [Rom.RIPEMD160Key] = "XXXXXX",
- [Rom.SHA1Key] = string.Empty,
- [Rom.SHA256Key] = "XXXXXX",
- [Rom.SHA384Key] = string.Empty,
- [Rom.SHA512Key] = "XXXXXX",
- [Rom.SpamSumKey] = string.Empty,
+ CRC16 = string.Empty,
+ CRC32 = "XXXXXX",
+ CRC64 = string.Empty,
+ MD2 = "XXXXXX",
+ MD4 = string.Empty,
+ MD5 = "XXXXXX",
+ RIPEMD128 = string.Empty,
+ RIPEMD160 = "XXXXXX",
+ SHA1 = string.Empty,
+ SHA256 = "XXXXXX",
+ SHA384 = string.Empty,
+ SHA512 = "XXXXXX",
+ SpamSum = string.Empty,
};
bool actual = self.HashMatch(other);
@@ -397,35 +1419,35 @@ namespace SabreTools.Data.Extensions.Test
{
Rom self = new Rom
{
- [Rom.CRC16Key] = "XXXXXX",
- [Rom.CRCKey] = string.Empty,
- [Rom.CRC64Key] = string.Empty,
- [Rom.MD2Key] = string.Empty,
- [Rom.MD4Key] = string.Empty,
- [Rom.MD5Key] = string.Empty,
- [Rom.RIPEMD128Key] = string.Empty,
- [Rom.RIPEMD160Key] = string.Empty,
- [Rom.SHA1Key] = string.Empty,
- [Rom.SHA256Key] = string.Empty,
- [Rom.SHA384Key] = string.Empty,
- [Rom.SHA512Key] = string.Empty,
- [Rom.SpamSumKey] = string.Empty,
+ CRC16 = "XXXXXX",
+ CRC32 = string.Empty,
+ CRC64 = string.Empty,
+ MD2 = string.Empty,
+ MD4 = string.Empty,
+ MD5 = string.Empty,
+ RIPEMD128 = string.Empty,
+ RIPEMD160 = string.Empty,
+ SHA1 = string.Empty,
+ SHA256 = string.Empty,
+ SHA384 = string.Empty,
+ SHA512 = string.Empty,
+ SpamSum = string.Empty,
};
Rom other = new Rom
{
- [Rom.CRC16Key] = "XXXXXX",
- [Rom.CRCKey] = "XXXXXX",
- [Rom.CRC64Key] = "XXXXXX",
- [Rom.MD2Key] = "XXXXXX",
- [Rom.MD4Key] = "XXXXXX",
- [Rom.MD5Key] = "XXXXXX",
- [Rom.RIPEMD128Key] = "XXXXXX",
- [Rom.RIPEMD160Key] = "XXXXXX",
- [Rom.SHA1Key] = "XXXXXX",
- [Rom.SHA256Key] = "XXXXXX",
- [Rom.SHA384Key] = "XXXXXX",
- [Rom.SHA512Key] = "XXXXXX",
- [Rom.SpamSumKey] = "XXXXXX",
+ CRC16 = "XXXXXX",
+ CRC32 = "XXXXXX",
+ CRC64 = "XXXXXX",
+ MD2 = "XXXXXX",
+ MD4 = "XXXXXX",
+ MD5 = "XXXXXX",
+ RIPEMD128 = "XXXXXX",
+ RIPEMD160 = "XXXXXX",
+ SHA1 = "XXXXXX",
+ SHA256 = "XXXXXX",
+ SHA384 = "XXXXXX",
+ SHA512 = "XXXXXX",
+ SpamSum = "XXXXXX",
};
bool actual = self.HashMatch(other);
@@ -437,35 +1459,35 @@ namespace SabreTools.Data.Extensions.Test
{
Rom self = new Rom
{
- [Rom.CRC16Key] = string.Empty,
- [Rom.CRCKey] = "XXXXXX",
- [Rom.CRC64Key] = string.Empty,
- [Rom.MD2Key] = string.Empty,
- [Rom.MD4Key] = string.Empty,
- [Rom.MD5Key] = string.Empty,
- [Rom.RIPEMD128Key] = string.Empty,
- [Rom.RIPEMD160Key] = string.Empty,
- [Rom.SHA1Key] = string.Empty,
- [Rom.SHA256Key] = string.Empty,
- [Rom.SHA384Key] = string.Empty,
- [Rom.SHA512Key] = string.Empty,
- [Rom.SpamSumKey] = string.Empty,
+ CRC16 = string.Empty,
+ CRC32 = "XXXXXX",
+ CRC64 = string.Empty,
+ MD2 = string.Empty,
+ MD4 = string.Empty,
+ MD5 = string.Empty,
+ RIPEMD128 = string.Empty,
+ RIPEMD160 = string.Empty,
+ SHA1 = string.Empty,
+ SHA256 = string.Empty,
+ SHA384 = string.Empty,
+ SHA512 = string.Empty,
+ SpamSum = string.Empty,
};
Rom other = new Rom
{
- [Rom.CRC16Key] = "XXXXXX",
- [Rom.CRCKey] = "XXXXXX",
- [Rom.CRC64Key] = "XXXXXX",
- [Rom.MD2Key] = "XXXXXX",
- [Rom.MD4Key] = "XXXXXX",
- [Rom.MD5Key] = "XXXXXX",
- [Rom.RIPEMD128Key] = "XXXXXX",
- [Rom.RIPEMD160Key] = "XXXXXX",
- [Rom.SHA1Key] = "XXXXXX",
- [Rom.SHA256Key] = "XXXXXX",
- [Rom.SHA384Key] = "XXXXXX",
- [Rom.SHA512Key] = "XXXXXX",
- [Rom.SpamSumKey] = "XXXXXX",
+ CRC16 = "XXXXXX",
+ CRC32 = "XXXXXX",
+ CRC64 = "XXXXXX",
+ MD2 = "XXXXXX",
+ MD4 = "XXXXXX",
+ MD5 = "XXXXXX",
+ RIPEMD128 = "XXXXXX",
+ RIPEMD160 = "XXXXXX",
+ SHA1 = "XXXXXX",
+ SHA256 = "XXXXXX",
+ SHA384 = "XXXXXX",
+ SHA512 = "XXXXXX",
+ SpamSum = "XXXXXX",
};
bool actual = self.HashMatch(other);
@@ -477,35 +1499,35 @@ namespace SabreTools.Data.Extensions.Test
{
Rom self = new Rom
{
- [Rom.CRC16Key] = string.Empty,
- [Rom.CRCKey] = string.Empty,
- [Rom.CRC64Key] = "XXXXXX",
- [Rom.MD2Key] = string.Empty,
- [Rom.MD4Key] = string.Empty,
- [Rom.MD5Key] = string.Empty,
- [Rom.RIPEMD128Key] = string.Empty,
- [Rom.RIPEMD160Key] = string.Empty,
- [Rom.SHA1Key] = string.Empty,
- [Rom.SHA256Key] = string.Empty,
- [Rom.SHA384Key] = string.Empty,
- [Rom.SHA512Key] = string.Empty,
- [Rom.SpamSumKey] = string.Empty,
+ CRC16 = string.Empty,
+ CRC32 = string.Empty,
+ CRC64 = "XXXXXX",
+ MD2 = string.Empty,
+ MD4 = string.Empty,
+ MD5 = string.Empty,
+ RIPEMD128 = string.Empty,
+ RIPEMD160 = string.Empty,
+ SHA1 = string.Empty,
+ SHA256 = string.Empty,
+ SHA384 = string.Empty,
+ SHA512 = string.Empty,
+ SpamSum = string.Empty,
};
Rom other = new Rom
{
- [Rom.CRC16Key] = "XXXXXX",
- [Rom.CRCKey] = "XXXXXX",
- [Rom.CRC64Key] = "XXXXXX",
- [Rom.MD2Key] = "XXXXXX",
- [Rom.MD4Key] = "XXXXXX",
- [Rom.MD5Key] = "XXXXXX",
- [Rom.RIPEMD128Key] = "XXXXXX",
- [Rom.RIPEMD160Key] = "XXXXXX",
- [Rom.SHA1Key] = "XXXXXX",
- [Rom.SHA256Key] = "XXXXXX",
- [Rom.SHA384Key] = "XXXXXX",
- [Rom.SHA512Key] = "XXXXXX",
- [Rom.SpamSumKey] = "XXXXXX",
+ CRC16 = "XXXXXX",
+ CRC32 = "XXXXXX",
+ CRC64 = "XXXXXX",
+ MD2 = "XXXXXX",
+ MD4 = "XXXXXX",
+ MD5 = "XXXXXX",
+ RIPEMD128 = "XXXXXX",
+ RIPEMD160 = "XXXXXX",
+ SHA1 = "XXXXXX",
+ SHA256 = "XXXXXX",
+ SHA384 = "XXXXXX",
+ SHA512 = "XXXXXX",
+ SpamSum = "XXXXXX",
};
bool actual = self.HashMatch(other);
@@ -517,35 +1539,35 @@ namespace SabreTools.Data.Extensions.Test
{
Rom self = new Rom
{
- [Rom.CRC16Key] = string.Empty,
- [Rom.CRCKey] = string.Empty,
- [Rom.CRC64Key] = string.Empty,
- [Rom.MD2Key] = "XXXXXX",
- [Rom.MD4Key] = string.Empty,
- [Rom.MD5Key] = string.Empty,
- [Rom.RIPEMD128Key] = string.Empty,
- [Rom.RIPEMD160Key] = string.Empty,
- [Rom.SHA1Key] = string.Empty,
- [Rom.SHA256Key] = string.Empty,
- [Rom.SHA384Key] = string.Empty,
- [Rom.SHA512Key] = string.Empty,
- [Rom.SpamSumKey] = string.Empty,
+ CRC16 = string.Empty,
+ CRC32 = string.Empty,
+ CRC64 = string.Empty,
+ MD2 = "XXXXXX",
+ MD4 = string.Empty,
+ MD5 = string.Empty,
+ RIPEMD128 = string.Empty,
+ RIPEMD160 = string.Empty,
+ SHA1 = string.Empty,
+ SHA256 = string.Empty,
+ SHA384 = string.Empty,
+ SHA512 = string.Empty,
+ SpamSum = string.Empty,
};
Rom other = new Rom
{
- [Rom.CRC16Key] = "XXXXXX",
- [Rom.CRCKey] = "XXXXXX",
- [Rom.CRC64Key] = "XXXXXX",
- [Rom.MD2Key] = "XXXXXX",
- [Rom.MD4Key] = "XXXXXX",
- [Rom.MD5Key] = "XXXXXX",
- [Rom.RIPEMD128Key] = "XXXXXX",
- [Rom.RIPEMD160Key] = "XXXXXX",
- [Rom.SHA1Key] = "XXXXXX",
- [Rom.SHA256Key] = "XXXXXX",
- [Rom.SHA384Key] = "XXXXXX",
- [Rom.SHA512Key] = "XXXXXX",
- [Rom.SpamSumKey] = "XXXXXX",
+ CRC16 = "XXXXXX",
+ CRC32 = "XXXXXX",
+ CRC64 = "XXXXXX",
+ MD2 = "XXXXXX",
+ MD4 = "XXXXXX",
+ MD5 = "XXXXXX",
+ RIPEMD128 = "XXXXXX",
+ RIPEMD160 = "XXXXXX",
+ SHA1 = "XXXXXX",
+ SHA256 = "XXXXXX",
+ SHA384 = "XXXXXX",
+ SHA512 = "XXXXXX",
+ SpamSum = "XXXXXX",
};
bool actual = self.HashMatch(other);
@@ -557,35 +1579,35 @@ namespace SabreTools.Data.Extensions.Test
{
Rom self = new Rom
{
- [Rom.CRC16Key] = string.Empty,
- [Rom.CRCKey] = string.Empty,
- [Rom.CRC64Key] = string.Empty,
- [Rom.MD2Key] = string.Empty,
- [Rom.MD4Key] = "XXXXXX",
- [Rom.MD5Key] = string.Empty,
- [Rom.RIPEMD128Key] = string.Empty,
- [Rom.RIPEMD160Key] = string.Empty,
- [Rom.SHA1Key] = string.Empty,
- [Rom.SHA256Key] = string.Empty,
- [Rom.SHA384Key] = string.Empty,
- [Rom.SHA512Key] = string.Empty,
- [Rom.SpamSumKey] = string.Empty,
+ CRC16 = string.Empty,
+ CRC32 = string.Empty,
+ CRC64 = string.Empty,
+ MD2 = string.Empty,
+ MD4 = "XXXXXX",
+ MD5 = string.Empty,
+ RIPEMD128 = string.Empty,
+ RIPEMD160 = string.Empty,
+ SHA1 = string.Empty,
+ SHA256 = string.Empty,
+ SHA384 = string.Empty,
+ SHA512 = string.Empty,
+ SpamSum = string.Empty,
};
Rom other = new Rom
{
- [Rom.CRC16Key] = "XXXXXX",
- [Rom.CRCKey] = "XXXXXX",
- [Rom.CRC64Key] = "XXXXXX",
- [Rom.MD2Key] = "XXXXXX",
- [Rom.MD4Key] = "XXXXXX",
- [Rom.MD5Key] = "XXXXXX",
- [Rom.RIPEMD128Key] = "XXXXXX",
- [Rom.RIPEMD160Key] = "XXXXXX",
- [Rom.SHA1Key] = "XXXXXX",
- [Rom.SHA256Key] = "XXXXXX",
- [Rom.SHA384Key] = "XXXXXX",
- [Rom.SHA512Key] = "XXXXXX",
- [Rom.SpamSumKey] = "XXXXXX",
+ CRC16 = "XXXXXX",
+ CRC32 = "XXXXXX",
+ CRC64 = "XXXXXX",
+ MD2 = "XXXXXX",
+ MD4 = "XXXXXX",
+ MD5 = "XXXXXX",
+ RIPEMD128 = "XXXXXX",
+ RIPEMD160 = "XXXXXX",
+ SHA1 = "XXXXXX",
+ SHA256 = "XXXXXX",
+ SHA384 = "XXXXXX",
+ SHA512 = "XXXXXX",
+ SpamSum = "XXXXXX",
};
bool actual = self.HashMatch(other);
@@ -597,35 +1619,35 @@ namespace SabreTools.Data.Extensions.Test
{
Rom self = new Rom
{
- [Rom.CRC16Key] = string.Empty,
- [Rom.CRCKey] = string.Empty,
- [Rom.CRC64Key] = string.Empty,
- [Rom.MD2Key] = string.Empty,
- [Rom.MD4Key] = string.Empty,
- [Rom.MD5Key] = "XXXXXX",
- [Rom.RIPEMD128Key] = string.Empty,
- [Rom.RIPEMD160Key] = string.Empty,
- [Rom.SHA1Key] = string.Empty,
- [Rom.SHA256Key] = string.Empty,
- [Rom.SHA384Key] = string.Empty,
- [Rom.SHA512Key] = string.Empty,
- [Rom.SpamSumKey] = string.Empty,
+ CRC16 = string.Empty,
+ CRC32 = string.Empty,
+ CRC64 = string.Empty,
+ MD2 = string.Empty,
+ MD4 = string.Empty,
+ MD5 = "XXXXXX",
+ RIPEMD128 = string.Empty,
+ RIPEMD160 = string.Empty,
+ SHA1 = string.Empty,
+ SHA256 = string.Empty,
+ SHA384 = string.Empty,
+ SHA512 = string.Empty,
+ SpamSum = string.Empty,
};
Rom other = new Rom
{
- [Rom.CRC16Key] = "XXXXXX",
- [Rom.CRCKey] = "XXXXXX",
- [Rom.CRC64Key] = "XXXXXX",
- [Rom.MD2Key] = "XXXXXX",
- [Rom.MD4Key] = "XXXXXX",
- [Rom.MD5Key] = "XXXXXX",
- [Rom.RIPEMD128Key] = "XXXXXX",
- [Rom.RIPEMD160Key] = "XXXXXX",
- [Rom.SHA1Key] = "XXXXXX",
- [Rom.SHA256Key] = "XXXXXX",
- [Rom.SHA384Key] = "XXXXXX",
- [Rom.SHA512Key] = "XXXXXX",
- [Rom.SpamSumKey] = "XXXXXX",
+ CRC16 = "XXXXXX",
+ CRC32 = "XXXXXX",
+ CRC64 = "XXXXXX",
+ MD2 = "XXXXXX",
+ MD4 = "XXXXXX",
+ MD5 = "XXXXXX",
+ RIPEMD128 = "XXXXXX",
+ RIPEMD160 = "XXXXXX",
+ SHA1 = "XXXXXX",
+ SHA256 = "XXXXXX",
+ SHA384 = "XXXXXX",
+ SHA512 = "XXXXXX",
+ SpamSum = "XXXXXX",
};
bool actual = self.HashMatch(other);
@@ -637,35 +1659,35 @@ namespace SabreTools.Data.Extensions.Test
{
Rom self = new Rom
{
- [Rom.CRC16Key] = string.Empty,
- [Rom.CRCKey] = string.Empty,
- [Rom.CRC64Key] = string.Empty,
- [Rom.MD2Key] = string.Empty,
- [Rom.MD4Key] = string.Empty,
- [Rom.MD5Key] = string.Empty,
- [Rom.RIPEMD128Key] = "XXXXXX",
- [Rom.RIPEMD160Key] = string.Empty,
- [Rom.SHA1Key] = string.Empty,
- [Rom.SHA256Key] = string.Empty,
- [Rom.SHA384Key] = string.Empty,
- [Rom.SHA512Key] = string.Empty,
- [Rom.SpamSumKey] = string.Empty,
+ CRC16 = string.Empty,
+ CRC32 = string.Empty,
+ CRC64 = string.Empty,
+ MD2 = string.Empty,
+ MD4 = string.Empty,
+ MD5 = string.Empty,
+ RIPEMD128 = "XXXXXX",
+ RIPEMD160 = string.Empty,
+ SHA1 = string.Empty,
+ SHA256 = string.Empty,
+ SHA384 = string.Empty,
+ SHA512 = string.Empty,
+ SpamSum = string.Empty,
};
Rom other = new Rom
{
- [Rom.CRC16Key] = "XXXXXX",
- [Rom.CRCKey] = "XXXXXX",
- [Rom.CRC64Key] = "XXXXXX",
- [Rom.MD2Key] = "XXXXXX",
- [Rom.MD4Key] = "XXXXXX",
- [Rom.MD5Key] = "XXXXXX",
- [Rom.RIPEMD128Key] = "XXXXXX",
- [Rom.RIPEMD160Key] = "XXXXXX",
- [Rom.SHA1Key] = "XXXXXX",
- [Rom.SHA256Key] = "XXXXXX",
- [Rom.SHA384Key] = "XXXXXX",
- [Rom.SHA512Key] = "XXXXXX",
- [Rom.SpamSumKey] = "XXXXXX",
+ CRC16 = "XXXXXX",
+ CRC32 = "XXXXXX",
+ CRC64 = "XXXXXX",
+ MD2 = "XXXXXX",
+ MD4 = "XXXXXX",
+ MD5 = "XXXXXX",
+ RIPEMD128 = "XXXXXX",
+ RIPEMD160 = "XXXXXX",
+ SHA1 = "XXXXXX",
+ SHA256 = "XXXXXX",
+ SHA384 = "XXXXXX",
+ SHA512 = "XXXXXX",
+ SpamSum = "XXXXXX",
};
bool actual = self.HashMatch(other);
@@ -677,35 +1699,35 @@ namespace SabreTools.Data.Extensions.Test
{
Rom self = new Rom
{
- [Rom.CRC16Key] = string.Empty,
- [Rom.CRCKey] = string.Empty,
- [Rom.CRC64Key] = string.Empty,
- [Rom.MD2Key] = string.Empty,
- [Rom.MD4Key] = string.Empty,
- [Rom.MD5Key] = string.Empty,
- [Rom.RIPEMD128Key] = string.Empty,
- [Rom.RIPEMD160Key] = "XXXXXX",
- [Rom.SHA1Key] = string.Empty,
- [Rom.SHA256Key] = string.Empty,
- [Rom.SHA384Key] = string.Empty,
- [Rom.SHA512Key] = string.Empty,
- [Rom.SpamSumKey] = string.Empty,
+ CRC16 = string.Empty,
+ CRC32 = string.Empty,
+ CRC64 = string.Empty,
+ MD2 = string.Empty,
+ MD4 = string.Empty,
+ MD5 = string.Empty,
+ RIPEMD128 = string.Empty,
+ RIPEMD160 = "XXXXXX",
+ SHA1 = string.Empty,
+ SHA256 = string.Empty,
+ SHA384 = string.Empty,
+ SHA512 = string.Empty,
+ SpamSum = string.Empty,
};
Rom other = new Rom
{
- [Rom.CRC16Key] = "XXXXXX",
- [Rom.CRCKey] = "XXXXXX",
- [Rom.CRC64Key] = "XXXXXX",
- [Rom.MD2Key] = "XXXXXX",
- [Rom.MD4Key] = "XXXXXX",
- [Rom.MD5Key] = "XXXXXX",
- [Rom.RIPEMD128Key] = "XXXXXX",
- [Rom.RIPEMD160Key] = "XXXXXX",
- [Rom.SHA1Key] = "XXXXXX",
- [Rom.SHA256Key] = "XXXXXX",
- [Rom.SHA384Key] = "XXXXXX",
- [Rom.SHA512Key] = "XXXXXX",
- [Rom.SpamSumKey] = "XXXXXX",
+ CRC16 = "XXXXXX",
+ CRC32 = "XXXXXX",
+ CRC64 = "XXXXXX",
+ MD2 = "XXXXXX",
+ MD4 = "XXXXXX",
+ MD5 = "XXXXXX",
+ RIPEMD128 = "XXXXXX",
+ RIPEMD160 = "XXXXXX",
+ SHA1 = "XXXXXX",
+ SHA256 = "XXXXXX",
+ SHA384 = "XXXXXX",
+ SHA512 = "XXXXXX",
+ SpamSum = "XXXXXX",
};
bool actual = self.HashMatch(other);
@@ -717,35 +1739,35 @@ namespace SabreTools.Data.Extensions.Test
{
Rom self = new Rom
{
- [Rom.CRC16Key] = string.Empty,
- [Rom.CRCKey] = string.Empty,
- [Rom.CRC64Key] = string.Empty,
- [Rom.MD2Key] = string.Empty,
- [Rom.MD4Key] = string.Empty,
- [Rom.MD5Key] = string.Empty,
- [Rom.RIPEMD128Key] = string.Empty,
- [Rom.RIPEMD160Key] = string.Empty,
- [Rom.SHA1Key] = "XXXXXX",
- [Rom.SHA256Key] = string.Empty,
- [Rom.SHA384Key] = string.Empty,
- [Rom.SHA512Key] = string.Empty,
- [Rom.SpamSumKey] = string.Empty,
+ CRC16 = string.Empty,
+ CRC32 = string.Empty,
+ CRC64 = string.Empty,
+ MD2 = string.Empty,
+ MD4 = string.Empty,
+ MD5 = string.Empty,
+ RIPEMD128 = string.Empty,
+ RIPEMD160 = string.Empty,
+ SHA1 = "XXXXXX",
+ SHA256 = string.Empty,
+ SHA384 = string.Empty,
+ SHA512 = string.Empty,
+ SpamSum = string.Empty,
};
Rom other = new Rom
{
- [Rom.CRC16Key] = "XXXXXX",
- [Rom.CRCKey] = "XXXXXX",
- [Rom.CRC64Key] = "XXXXXX",
- [Rom.MD2Key] = "XXXXXX",
- [Rom.MD4Key] = "XXXXXX",
- [Rom.MD5Key] = "XXXXXX",
- [Rom.RIPEMD128Key] = "XXXXXX",
- [Rom.RIPEMD160Key] = "XXXXXX",
- [Rom.SHA1Key] = "XXXXXX",
- [Rom.SHA256Key] = "XXXXXX",
- [Rom.SHA384Key] = "XXXXXX",
- [Rom.SHA512Key] = "XXXXXX",
- [Rom.SpamSumKey] = "XXXXXX",
+ CRC16 = "XXXXXX",
+ CRC32 = "XXXXXX",
+ CRC64 = "XXXXXX",
+ MD2 = "XXXXXX",
+ MD4 = "XXXXXX",
+ MD5 = "XXXXXX",
+ RIPEMD128 = "XXXXXX",
+ RIPEMD160 = "XXXXXX",
+ SHA1 = "XXXXXX",
+ SHA256 = "XXXXXX",
+ SHA384 = "XXXXXX",
+ SHA512 = "XXXXXX",
+ SpamSum = "XXXXXX",
};
bool actual = self.HashMatch(other);
@@ -757,35 +1779,35 @@ namespace SabreTools.Data.Extensions.Test
{
Rom self = new Rom
{
- [Rom.CRC16Key] = string.Empty,
- [Rom.CRCKey] = string.Empty,
- [Rom.CRC64Key] = string.Empty,
- [Rom.MD2Key] = string.Empty,
- [Rom.MD4Key] = string.Empty,
- [Rom.MD5Key] = string.Empty,
- [Rom.RIPEMD128Key] = string.Empty,
- [Rom.RIPEMD160Key] = string.Empty,
- [Rom.SHA1Key] = string.Empty,
- [Rom.SHA256Key] = "XXXXXX",
- [Rom.SHA384Key] = string.Empty,
- [Rom.SHA512Key] = string.Empty,
- [Rom.SpamSumKey] = string.Empty,
+ CRC16 = string.Empty,
+ CRC32 = string.Empty,
+ CRC64 = string.Empty,
+ MD2 = string.Empty,
+ MD4 = string.Empty,
+ MD5 = string.Empty,
+ RIPEMD128 = string.Empty,
+ RIPEMD160 = string.Empty,
+ SHA1 = string.Empty,
+ SHA256 = "XXXXXX",
+ SHA384 = string.Empty,
+ SHA512 = string.Empty,
+ SpamSum = string.Empty,
};
Rom other = new Rom
{
- [Rom.CRC16Key] = "XXXXXX",
- [Rom.CRCKey] = "XXXXXX",
- [Rom.CRC64Key] = "XXXXXX",
- [Rom.MD2Key] = "XXXXXX",
- [Rom.MD4Key] = "XXXXXX",
- [Rom.MD5Key] = "XXXXXX",
- [Rom.RIPEMD128Key] = "XXXXXX",
- [Rom.RIPEMD160Key] = "XXXXXX",
- [Rom.SHA1Key] = "XXXXXX",
- [Rom.SHA256Key] = "XXXXXX",
- [Rom.SHA384Key] = "XXXXXX",
- [Rom.SHA512Key] = "XXXXXX",
- [Rom.SpamSumKey] = "XXXXXX",
+ CRC16 = "XXXXXX",
+ CRC32 = "XXXXXX",
+ CRC64 = "XXXXXX",
+ MD2 = "XXXXXX",
+ MD4 = "XXXXXX",
+ MD5 = "XXXXXX",
+ RIPEMD128 = "XXXXXX",
+ RIPEMD160 = "XXXXXX",
+ SHA1 = "XXXXXX",
+ SHA256 = "XXXXXX",
+ SHA384 = "XXXXXX",
+ SHA512 = "XXXXXX",
+ SpamSum = "XXXXXX",
};
bool actual = self.HashMatch(other);
@@ -797,35 +1819,35 @@ namespace SabreTools.Data.Extensions.Test
{
Rom self = new Rom
{
- [Rom.CRC16Key] = string.Empty,
- [Rom.CRCKey] = string.Empty,
- [Rom.CRC64Key] = string.Empty,
- [Rom.MD2Key] = string.Empty,
- [Rom.MD4Key] = string.Empty,
- [Rom.MD5Key] = string.Empty,
- [Rom.RIPEMD128Key] = string.Empty,
- [Rom.RIPEMD160Key] = string.Empty,
- [Rom.SHA1Key] = string.Empty,
- [Rom.SHA256Key] = string.Empty,
- [Rom.SHA384Key] = "XXXXXX",
- [Rom.SHA512Key] = string.Empty,
- [Rom.SpamSumKey] = string.Empty,
+ CRC16 = string.Empty,
+ CRC32 = string.Empty,
+ CRC64 = string.Empty,
+ MD2 = string.Empty,
+ MD4 = string.Empty,
+ MD5 = string.Empty,
+ RIPEMD128 = string.Empty,
+ RIPEMD160 = string.Empty,
+ SHA1 = string.Empty,
+ SHA256 = string.Empty,
+ SHA384 = "XXXXXX",
+ SHA512 = string.Empty,
+ SpamSum = string.Empty,
};
Rom other = new Rom
{
- [Rom.CRC16Key] = "XXXXXX",
- [Rom.CRCKey] = "XXXXXX",
- [Rom.CRC64Key] = "XXXXXX",
- [Rom.MD2Key] = "XXXXXX",
- [Rom.MD4Key] = "XXXXXX",
- [Rom.MD5Key] = "XXXXXX",
- [Rom.RIPEMD128Key] = "XXXXXX",
- [Rom.RIPEMD160Key] = "XXXXXX",
- [Rom.SHA1Key] = "XXXXXX",
- [Rom.SHA256Key] = "XXXXXX",
- [Rom.SHA384Key] = "XXXXXX",
- [Rom.SHA512Key] = "XXXXXX",
- [Rom.SpamSumKey] = "XXXXXX",
+ CRC16 = "XXXXXX",
+ CRC32 = "XXXXXX",
+ CRC64 = "XXXXXX",
+ MD2 = "XXXXXX",
+ MD4 = "XXXXXX",
+ MD5 = "XXXXXX",
+ RIPEMD128 = "XXXXXX",
+ RIPEMD160 = "XXXXXX",
+ SHA1 = "XXXXXX",
+ SHA256 = "XXXXXX",
+ SHA384 = "XXXXXX",
+ SHA512 = "XXXXXX",
+ SpamSum = "XXXXXX",
};
bool actual = self.HashMatch(other);
@@ -837,35 +1859,35 @@ namespace SabreTools.Data.Extensions.Test
{
Rom self = new Rom
{
- [Rom.CRC16Key] = string.Empty,
- [Rom.CRCKey] = string.Empty,
- [Rom.CRC64Key] = string.Empty,
- [Rom.MD2Key] = string.Empty,
- [Rom.MD4Key] = string.Empty,
- [Rom.MD5Key] = string.Empty,
- [Rom.RIPEMD128Key] = string.Empty,
- [Rom.RIPEMD160Key] = string.Empty,
- [Rom.SHA1Key] = string.Empty,
- [Rom.SHA256Key] = string.Empty,
- [Rom.SHA384Key] = string.Empty,
- [Rom.SHA512Key] = "XXXXXX",
- [Rom.SpamSumKey] = string.Empty,
+ CRC16 = string.Empty,
+ CRC32 = string.Empty,
+ CRC64 = string.Empty,
+ MD2 = string.Empty,
+ MD4 = string.Empty,
+ MD5 = string.Empty,
+ RIPEMD128 = string.Empty,
+ RIPEMD160 = string.Empty,
+ SHA1 = string.Empty,
+ SHA256 = string.Empty,
+ SHA384 = string.Empty,
+ SHA512 = "XXXXXX",
+ SpamSum = string.Empty,
};
Rom other = new Rom
{
- [Rom.CRC16Key] = "XXXXXX",
- [Rom.CRCKey] = "XXXXXX",
- [Rom.CRC64Key] = "XXXXXX",
- [Rom.MD2Key] = "XXXXXX",
- [Rom.MD4Key] = "XXXXXX",
- [Rom.MD5Key] = "XXXXXX",
- [Rom.RIPEMD128Key] = "XXXXXX",
- [Rom.RIPEMD160Key] = "XXXXXX",
- [Rom.SHA1Key] = "XXXXXX",
- [Rom.SHA256Key] = "XXXXXX",
- [Rom.SHA384Key] = "XXXXXX",
- [Rom.SHA512Key] = "XXXXXX",
- [Rom.SpamSumKey] = "XXXXXX",
+ CRC16 = "XXXXXX",
+ CRC32 = "XXXXXX",
+ CRC64 = "XXXXXX",
+ MD2 = "XXXXXX",
+ MD4 = "XXXXXX",
+ MD5 = "XXXXXX",
+ RIPEMD128 = "XXXXXX",
+ RIPEMD160 = "XXXXXX",
+ SHA1 = "XXXXXX",
+ SHA256 = "XXXXXX",
+ SHA384 = "XXXXXX",
+ SHA512 = "XXXXXX",
+ SpamSum = "XXXXXX",
};
bool actual = self.HashMatch(other);
@@ -877,35 +1899,35 @@ namespace SabreTools.Data.Extensions.Test
{
Rom self = new Rom
{
- [Rom.CRC16Key] = string.Empty,
- [Rom.CRCKey] = string.Empty,
- [Rom.CRC64Key] = string.Empty,
- [Rom.MD2Key] = string.Empty,
- [Rom.MD4Key] = string.Empty,
- [Rom.MD5Key] = string.Empty,
- [Rom.RIPEMD128Key] = string.Empty,
- [Rom.RIPEMD160Key] = string.Empty,
- [Rom.SHA1Key] = string.Empty,
- [Rom.SHA256Key] = string.Empty,
- [Rom.SHA384Key] = string.Empty,
- [Rom.SHA512Key] = string.Empty,
- [Rom.SpamSumKey] = "XXXXXX",
+ CRC16 = string.Empty,
+ CRC32 = string.Empty,
+ CRC64 = string.Empty,
+ MD2 = string.Empty,
+ MD4 = string.Empty,
+ MD5 = string.Empty,
+ RIPEMD128 = string.Empty,
+ RIPEMD160 = string.Empty,
+ SHA1 = string.Empty,
+ SHA256 = string.Empty,
+ SHA384 = string.Empty,
+ SHA512 = string.Empty,
+ SpamSum = "XXXXXX",
};
Rom other = new Rom
{
- [Rom.CRC16Key] = "XXXXXX",
- [Rom.CRCKey] = "XXXXXX",
- [Rom.CRC64Key] = "XXXXXX",
- [Rom.MD2Key] = "XXXXXX",
- [Rom.MD4Key] = "XXXXXX",
- [Rom.MD5Key] = "XXXXXX",
- [Rom.RIPEMD128Key] = "XXXXXX",
- [Rom.RIPEMD160Key] = "XXXXXX",
- [Rom.SHA1Key] = "XXXXXX",
- [Rom.SHA256Key] = "XXXXXX",
- [Rom.SHA384Key] = "XXXXXX",
- [Rom.SHA512Key] = "XXXXXX",
- [Rom.SpamSumKey] = "XXXXXX",
+ CRC16 = "XXXXXX",
+ CRC32 = "XXXXXX",
+ CRC64 = "XXXXXX",
+ MD2 = "XXXXXX",
+ MD4 = "XXXXXX",
+ MD5 = "XXXXXX",
+ RIPEMD128 = "XXXXXX",
+ RIPEMD160 = "XXXXXX",
+ SHA1 = "XXXXXX",
+ SHA256 = "XXXXXX",
+ SHA384 = "XXXXXX",
+ SHA512 = "XXXXXX",
+ SpamSum = "XXXXXX",
};
bool actual = self.HashMatch(other);
@@ -917,35 +1939,35 @@ namespace SabreTools.Data.Extensions.Test
{
Rom self = new Rom
{
- [Rom.CRC16Key] = "XXXXXX",
- [Rom.CRCKey] = "XXXXXX",
- [Rom.CRC64Key] = "XXXXXX",
- [Rom.MD2Key] = "XXXXXX",
- [Rom.MD4Key] = "XXXXXX",
- [Rom.MD5Key] = "XXXXXX",
- [Rom.RIPEMD128Key] = "XXXXXX",
- [Rom.RIPEMD160Key] = "XXXXXX",
- [Rom.SHA1Key] = "XXXXXX",
- [Rom.SHA256Key] = "XXXXXX",
- [Rom.SHA384Key] = "XXXXXX",
- [Rom.SHA512Key] = "XXXXXX",
- [Rom.SpamSumKey] = "XXXXXX",
+ CRC16 = "XXXXXX",
+ CRC32 = "XXXXXX",
+ CRC64 = "XXXXXX",
+ MD2 = "XXXXXX",
+ MD4 = "XXXXXX",
+ MD5 = "XXXXXX",
+ RIPEMD128 = "XXXXXX",
+ RIPEMD160 = "XXXXXX",
+ SHA1 = "XXXXXX",
+ SHA256 = "XXXXXX",
+ SHA384 = "XXXXXX",
+ SHA512 = "XXXXXX",
+ SpamSum = "XXXXXX",
};
Rom other = new Rom
{
- [Rom.CRC16Key] = "XXXXXX",
- [Rom.CRCKey] = "XXXXXX",
- [Rom.CRC64Key] = "XXXXXX",
- [Rom.MD2Key] = "XXXXXX",
- [Rom.MD4Key] = "XXXXXX",
- [Rom.MD5Key] = "XXXXXX",
- [Rom.RIPEMD128Key] = "XXXXXX",
- [Rom.RIPEMD160Key] = "XXXXXX",
- [Rom.SHA1Key] = "XXXXXX",
- [Rom.SHA256Key] = "XXXXXX",
- [Rom.SHA384Key] = "XXXXXX",
- [Rom.SHA512Key] = "XXXXXX",
- [Rom.SpamSumKey] = "XXXXXX",
+ CRC16 = "XXXXXX",
+ CRC32 = "XXXXXX",
+ CRC64 = "XXXXXX",
+ MD2 = "XXXXXX",
+ MD4 = "XXXXXX",
+ MD5 = "XXXXXX",
+ RIPEMD128 = "XXXXXX",
+ RIPEMD160 = "XXXXXX",
+ SHA1 = "XXXXXX",
+ SHA256 = "XXXXXX",
+ SHA384 = "XXXXXX",
+ SHA512 = "XXXXXX",
+ SpamSum = "XXXXXX",
};
bool actual = self.HashMatch(other);
@@ -959,7 +1981,7 @@ namespace SabreTools.Data.Extensions.Test
[Fact]
public void HasZeroHash_Disk_NoHash_True()
{
- DictionaryBase self = new Disk();
+ var self = new Disk();
bool actual = self.HasZeroHash();
Assert.True(actual);
}
@@ -967,10 +1989,10 @@ namespace SabreTools.Data.Extensions.Test
[Fact]
public void HasZeroHash_Disk_NonZeroHash_False()
{
- DictionaryBase self = new Disk
+ var self = new Disk
{
- [Disk.MD5Key] = "XXXXXX",
- [Disk.SHA1Key] = "XXXXXX",
+ MD5 = "XXXXXX",
+ SHA1 = "XXXXXX",
};
bool actual = self.HasZeroHash();
@@ -980,10 +2002,10 @@ namespace SabreTools.Data.Extensions.Test
[Fact]
public void HasZeroHash_Disk_ZeroMD5_True()
{
- DictionaryBase self = new Disk
+ var self = new Disk
{
- [Disk.MD5Key] = HashType.MD5.ZeroString,
- [Disk.SHA1Key] = string.Empty,
+ MD5 = HashType.MD5.ZeroString,
+ SHA1 = string.Empty,
};
bool actual = self.HasZeroHash();
@@ -993,10 +2015,10 @@ namespace SabreTools.Data.Extensions.Test
[Fact]
public void HasZeroHash_Disk_ZeroSHA1_True()
{
- DictionaryBase self = new Disk
+ var self = new Disk
{
- [Disk.MD5Key] = string.Empty,
- [Disk.SHA1Key] = HashType.SHA1.ZeroString,
+ MD5 = string.Empty,
+ SHA1 = HashType.SHA1.ZeroString,
};
bool actual = self.HasZeroHash();
@@ -1006,10 +2028,10 @@ namespace SabreTools.Data.Extensions.Test
[Fact]
public void HasZeroHash_Disk_ZeroAll_True()
{
- DictionaryBase self = new Disk
+ var self = new Disk
{
- [Disk.MD5Key] = HashType.MD5.ZeroString,
- [Disk.SHA1Key] = HashType.SHA1.ZeroString,
+ MD5 = HashType.MD5.ZeroString,
+ SHA1 = HashType.SHA1.ZeroString,
};
bool actual = self.HasZeroHash();
@@ -1019,7 +2041,7 @@ namespace SabreTools.Data.Extensions.Test
[Fact]
public void HasZeroHash_Media_NoHash_True()
{
- DictionaryBase self = new Media();
+ var self = new Media();
bool actual = self.HasZeroHash();
Assert.True(actual);
}
@@ -1027,12 +2049,12 @@ namespace SabreTools.Data.Extensions.Test
[Fact]
public void HasZeroHash_Media_NonZeroHash_False()
{
- DictionaryBase self = new Media
+ var self = new Media
{
- [Media.MD5Key] = "XXXXXX",
- [Media.SHA1Key] = "XXXXXX",
- [Media.SHA256Key] = "XXXXXX",
- [Media.SpamSumKey] = "XXXXXX",
+ MD5 = "XXXXXX",
+ SHA1 = "XXXXXX",
+ SHA256 = "XXXXXX",
+ SpamSum = "XXXXXX",
};
bool actual = self.HasZeroHash();
@@ -1042,12 +2064,12 @@ namespace SabreTools.Data.Extensions.Test
[Fact]
public void HasZeroHash_Media_ZeroMD5_True()
{
- DictionaryBase self = new Media
+ var self = new Media
{
- [Media.MD5Key] = HashType.MD5.ZeroString,
- [Media.SHA1Key] = string.Empty,
- [Media.SHA256Key] = string.Empty,
- [Media.SpamSumKey] = string.Empty,
+ MD5 = HashType.MD5.ZeroString,
+ SHA1 = string.Empty,
+ SHA256 = string.Empty,
+ SpamSum = string.Empty,
};
bool actual = self.HasZeroHash();
@@ -1057,12 +2079,12 @@ namespace SabreTools.Data.Extensions.Test
[Fact]
public void HasZeroHash_Media_ZeroSHA1_True()
{
- DictionaryBase self = new Media
+ var self = new Media
{
- [Media.MD5Key] = string.Empty,
- [Media.SHA1Key] = HashType.SHA1.ZeroString,
- [Media.SHA256Key] = string.Empty,
- [Media.SpamSumKey] = string.Empty,
+ MD5 = string.Empty,
+ SHA1 = HashType.SHA1.ZeroString,
+ SHA256 = string.Empty,
+ SpamSum = string.Empty,
};
bool actual = self.HasZeroHash();
@@ -1072,12 +2094,12 @@ namespace SabreTools.Data.Extensions.Test
[Fact]
public void HasZeroHash_Media_ZeroSHA256_True()
{
- DictionaryBase self = new Media
+ var self = new Media
{
- [Media.MD5Key] = string.Empty,
- [Media.SHA1Key] = string.Empty,
- [Media.SHA256Key] = HashType.SHA256.ZeroString,
- [Media.SpamSumKey] = string.Empty,
+ MD5 = string.Empty,
+ SHA1 = string.Empty,
+ SHA256 = HashType.SHA256.ZeroString,
+ SpamSum = string.Empty,
};
bool actual = self.HasZeroHash();
@@ -1087,12 +2109,12 @@ namespace SabreTools.Data.Extensions.Test
[Fact]
public void HasZeroHash_Media_ZeroSpamSum_True()
{
- DictionaryBase self = new Media
+ var self = new Media
{
- [Media.MD5Key] = string.Empty,
- [Media.SHA1Key] = string.Empty,
- [Media.SHA256Key] = string.Empty,
- [Media.SpamSumKey] = HashType.SpamSum.ZeroString,
+ MD5 = string.Empty,
+ SHA1 = string.Empty,
+ SHA256 = string.Empty,
+ SpamSum = HashType.SpamSum.ZeroString,
};
bool actual = self.HasZeroHash();
@@ -1102,12 +2124,12 @@ namespace SabreTools.Data.Extensions.Test
[Fact]
public void HasZeroHash_Media_ZeroAll_True()
{
- DictionaryBase self = new Media
+ var self = new Media
{
- [Media.MD5Key] = HashType.MD5.ZeroString,
- [Media.SHA1Key] = HashType.SHA1.ZeroString,
- [Media.SHA256Key] = HashType.SHA256.ZeroString,
- [Media.SpamSumKey] = HashType.SpamSum.ZeroString,
+ MD5 = HashType.MD5.ZeroString,
+ SHA1 = HashType.SHA1.ZeroString,
+ SHA256 = HashType.SHA256.ZeroString,
+ SpamSum = HashType.SpamSum.ZeroString,
};
bool actual = self.HasZeroHash();
@@ -1117,7 +2139,7 @@ namespace SabreTools.Data.Extensions.Test
[Fact]
public void HasZeroHash_Rom_NoHash_True()
{
- DictionaryBase self = new Rom();
+ var self = new Rom();
bool actual = self.HasZeroHash();
Assert.True(actual);
}
@@ -1125,21 +2147,21 @@ namespace SabreTools.Data.Extensions.Test
[Fact]
public void HasZeroHash_Rom_NonZeroHash_False()
{
- DictionaryBase self = new Rom
+ var self = new Rom
{
- [Rom.CRC16Key] = "XXXXXX",
- [Rom.CRCKey] = "XXXXXX",
- [Rom.CRC64Key] = "XXXXXX",
- [Rom.MD2Key] = "XXXXXX",
- [Rom.MD4Key] = "XXXXXX",
- [Rom.MD5Key] = "XXXXXX",
- [Rom.RIPEMD128Key] = "XXXXXX",
- [Rom.RIPEMD160Key] = "XXXXXX",
- [Rom.SHA1Key] = "XXXXXX",
- [Rom.SHA256Key] = "XXXXXX",
- [Rom.SHA384Key] = "XXXXXX",
- [Rom.SHA512Key] = "XXXXXX",
- [Rom.SpamSumKey] = "XXXXXX",
+ CRC16 = "XXXXXX",
+ CRC32 = "XXXXXX",
+ CRC64 = "XXXXXX",
+ MD2 = "XXXXXX",
+ MD4 = "XXXXXX",
+ MD5 = "XXXXXX",
+ RIPEMD128 = "XXXXXX",
+ RIPEMD160 = "XXXXXX",
+ SHA1 = "XXXXXX",
+ SHA256 = "XXXXXX",
+ SHA384 = "XXXXXX",
+ SHA512 = "XXXXXX",
+ SpamSum = "XXXXXX",
};
bool actual = self.HasZeroHash();
@@ -1149,21 +2171,21 @@ namespace SabreTools.Data.Extensions.Test
[Fact]
public void HasZeroHash_Rom_ZeroCRC16_True()
{
- DictionaryBase self = new Rom
+ var self = new Rom
{
- [Rom.CRC16Key] = HashType.CRC16.ZeroString,
- [Rom.CRCKey] = string.Empty,
- [Rom.CRC64Key] = string.Empty,
- [Rom.MD2Key] = string.Empty,
- [Rom.MD4Key] = string.Empty,
- [Rom.MD5Key] = string.Empty,
- [Rom.RIPEMD128Key] = string.Empty,
- [Rom.RIPEMD160Key] = string.Empty,
- [Rom.SHA1Key] = string.Empty,
- [Rom.SHA256Key] = string.Empty,
- [Rom.SHA384Key] = string.Empty,
- [Rom.SHA512Key] = string.Empty,
- [Rom.SpamSumKey] = string.Empty,
+ CRC16 = HashType.CRC16.ZeroString,
+ CRC32 = string.Empty,
+ CRC64 = string.Empty,
+ MD2 = string.Empty,
+ MD4 = string.Empty,
+ MD5 = string.Empty,
+ RIPEMD128 = string.Empty,
+ RIPEMD160 = string.Empty,
+ SHA1 = string.Empty,
+ SHA256 = string.Empty,
+ SHA384 = string.Empty,
+ SHA512 = string.Empty,
+ SpamSum = string.Empty,
};
bool actual = self.HasZeroHash();
@@ -1173,21 +2195,21 @@ namespace SabreTools.Data.Extensions.Test
[Fact]
public void HasZeroHash_Rom_ZeroCRC_True()
{
- DictionaryBase self = new Rom
+ var self = new Rom
{
- [Rom.CRC16Key] = string.Empty,
- [Rom.CRCKey] = HashType.CRC32.ZeroString,
- [Rom.CRC64Key] = string.Empty,
- [Rom.MD2Key] = string.Empty,
- [Rom.MD4Key] = string.Empty,
- [Rom.MD5Key] = string.Empty,
- [Rom.RIPEMD128Key] = string.Empty,
- [Rom.RIPEMD160Key] = string.Empty,
- [Rom.SHA1Key] = string.Empty,
- [Rom.SHA256Key] = string.Empty,
- [Rom.SHA384Key] = string.Empty,
- [Rom.SHA512Key] = string.Empty,
- [Rom.SpamSumKey] = string.Empty,
+ CRC16 = string.Empty,
+ CRC32 = HashType.CRC32.ZeroString,
+ CRC64 = string.Empty,
+ MD2 = string.Empty,
+ MD4 = string.Empty,
+ MD5 = string.Empty,
+ RIPEMD128 = string.Empty,
+ RIPEMD160 = string.Empty,
+ SHA1 = string.Empty,
+ SHA256 = string.Empty,
+ SHA384 = string.Empty,
+ SHA512 = string.Empty,
+ SpamSum = string.Empty,
};
bool actual = self.HasZeroHash();
@@ -1197,21 +2219,21 @@ namespace SabreTools.Data.Extensions.Test
[Fact]
public void HasZeroHash_Rom_ZeroCRC64_True()
{
- DictionaryBase self = new Rom
+ var self = new Rom
{
- [Rom.CRC16Key] = string.Empty,
- [Rom.CRCKey] = string.Empty,
- [Rom.CRC64Key] = HashType.CRC64.ZeroString,
- [Rom.MD2Key] = string.Empty,
- [Rom.MD4Key] = string.Empty,
- [Rom.MD5Key] = string.Empty,
- [Rom.RIPEMD128Key] = string.Empty,
- [Rom.RIPEMD160Key] = string.Empty,
- [Rom.SHA1Key] = string.Empty,
- [Rom.SHA256Key] = string.Empty,
- [Rom.SHA384Key] = string.Empty,
- [Rom.SHA512Key] = string.Empty,
- [Rom.SpamSumKey] = string.Empty,
+ CRC16 = string.Empty,
+ CRC32 = string.Empty,
+ CRC64 = HashType.CRC64.ZeroString,
+ MD2 = string.Empty,
+ MD4 = string.Empty,
+ MD5 = string.Empty,
+ RIPEMD128 = string.Empty,
+ RIPEMD160 = string.Empty,
+ SHA1 = string.Empty,
+ SHA256 = string.Empty,
+ SHA384 = string.Empty,
+ SHA512 = string.Empty,
+ SpamSum = string.Empty,
};
bool actual = self.HasZeroHash();
@@ -1221,21 +2243,21 @@ namespace SabreTools.Data.Extensions.Test
[Fact]
public void HasZeroHash_Rom_ZeroMD2_True()
{
- DictionaryBase self = new Rom
+ var self = new Rom
{
- [Rom.CRC16Key] = string.Empty,
- [Rom.CRCKey] = string.Empty,
- [Rom.CRC64Key] = string.Empty,
- [Rom.MD2Key] = HashType.MD2.ZeroString,
- [Rom.MD4Key] = string.Empty,
- [Rom.MD5Key] = string.Empty,
- [Rom.RIPEMD128Key] = string.Empty,
- [Rom.RIPEMD160Key] = string.Empty,
- [Rom.SHA1Key] = string.Empty,
- [Rom.SHA256Key] = string.Empty,
- [Rom.SHA384Key] = string.Empty,
- [Rom.SHA512Key] = string.Empty,
- [Rom.SpamSumKey] = string.Empty,
+ CRC16 = string.Empty,
+ CRC32 = string.Empty,
+ CRC64 = string.Empty,
+ MD2 = HashType.MD2.ZeroString,
+ MD4 = string.Empty,
+ MD5 = string.Empty,
+ RIPEMD128 = string.Empty,
+ RIPEMD160 = string.Empty,
+ SHA1 = string.Empty,
+ SHA256 = string.Empty,
+ SHA384 = string.Empty,
+ SHA512 = string.Empty,
+ SpamSum = string.Empty,
};
bool actual = self.HasZeroHash();
@@ -1245,21 +2267,21 @@ namespace SabreTools.Data.Extensions.Test
[Fact]
public void HasZeroHash_Rom_ZeroMD4_True()
{
- DictionaryBase self = new Rom
+ var self = new Rom
{
- [Rom.CRC16Key] = string.Empty,
- [Rom.CRCKey] = string.Empty,
- [Rom.CRC64Key] = string.Empty,
- [Rom.MD2Key] = string.Empty,
- [Rom.MD4Key] = HashType.MD4.ZeroString,
- [Rom.MD5Key] = string.Empty,
- [Rom.RIPEMD128Key] = string.Empty,
- [Rom.RIPEMD160Key] = string.Empty,
- [Rom.SHA1Key] = string.Empty,
- [Rom.SHA256Key] = string.Empty,
- [Rom.SHA384Key] = string.Empty,
- [Rom.SHA512Key] = string.Empty,
- [Rom.SpamSumKey] = string.Empty,
+ CRC16 = string.Empty,
+ CRC32 = string.Empty,
+ CRC64 = string.Empty,
+ MD2 = string.Empty,
+ MD4 = HashType.MD4.ZeroString,
+ MD5 = string.Empty,
+ RIPEMD128 = string.Empty,
+ RIPEMD160 = string.Empty,
+ SHA1 = string.Empty,
+ SHA256 = string.Empty,
+ SHA384 = string.Empty,
+ SHA512 = string.Empty,
+ SpamSum = string.Empty,
};
bool actual = self.HasZeroHash();
@@ -1269,21 +2291,21 @@ namespace SabreTools.Data.Extensions.Test
[Fact]
public void HasZeroHash_Rom_ZeroMD5_True()
{
- DictionaryBase self = new Rom
+ var self = new Rom
{
- [Rom.CRC16Key] = string.Empty,
- [Rom.CRCKey] = string.Empty,
- [Rom.CRC64Key] = string.Empty,
- [Rom.MD2Key] = string.Empty,
- [Rom.MD4Key] = string.Empty,
- [Rom.MD5Key] = HashType.MD5.ZeroString,
- [Rom.RIPEMD128Key] = string.Empty,
- [Rom.RIPEMD160Key] = string.Empty,
- [Rom.SHA1Key] = string.Empty,
- [Rom.SHA256Key] = string.Empty,
- [Rom.SHA384Key] = string.Empty,
- [Rom.SHA512Key] = string.Empty,
- [Rom.SpamSumKey] = string.Empty,
+ CRC16 = string.Empty,
+ CRC32 = string.Empty,
+ CRC64 = string.Empty,
+ MD2 = string.Empty,
+ MD4 = string.Empty,
+ MD5 = HashType.MD5.ZeroString,
+ RIPEMD128 = string.Empty,
+ RIPEMD160 = string.Empty,
+ SHA1 = string.Empty,
+ SHA256 = string.Empty,
+ SHA384 = string.Empty,
+ SHA512 = string.Empty,
+ SpamSum = string.Empty,
};
bool actual = self.HasZeroHash();
@@ -1293,21 +2315,21 @@ namespace SabreTools.Data.Extensions.Test
[Fact]
public void HasZeroHash_Rom_ZeroRIPEMD128_True()
{
- DictionaryBase self = new Rom
+ var self = new Rom
{
- [Rom.CRC16Key] = string.Empty,
- [Rom.CRCKey] = string.Empty,
- [Rom.CRC64Key] = string.Empty,
- [Rom.MD2Key] = string.Empty,
- [Rom.MD4Key] = string.Empty,
- [Rom.MD5Key] = string.Empty,
- [Rom.RIPEMD128Key] = HashType.RIPEMD128.ZeroString,
- [Rom.RIPEMD160Key] = string.Empty,
- [Rom.SHA1Key] = string.Empty,
- [Rom.SHA256Key] = string.Empty,
- [Rom.SHA384Key] = string.Empty,
- [Rom.SHA512Key] = string.Empty,
- [Rom.SpamSumKey] = string.Empty,
+ CRC16 = string.Empty,
+ CRC32 = string.Empty,
+ CRC64 = string.Empty,
+ MD2 = string.Empty,
+ MD4 = string.Empty,
+ MD5 = string.Empty,
+ RIPEMD128 = HashType.RIPEMD128.ZeroString,
+ RIPEMD160 = string.Empty,
+ SHA1 = string.Empty,
+ SHA256 = string.Empty,
+ SHA384 = string.Empty,
+ SHA512 = string.Empty,
+ SpamSum = string.Empty,
};
bool actual = self.HasZeroHash();
@@ -1317,21 +2339,21 @@ namespace SabreTools.Data.Extensions.Test
[Fact]
public void HasZeroHash_Rom_ZeroRIPEMD160_True()
{
- DictionaryBase self = new Rom
+ var self = new Rom
{
- [Rom.CRC16Key] = string.Empty,
- [Rom.CRCKey] = string.Empty,
- [Rom.CRC64Key] = string.Empty,
- [Rom.MD2Key] = string.Empty,
- [Rom.MD4Key] = string.Empty,
- [Rom.MD5Key] = string.Empty,
- [Rom.RIPEMD128Key] = string.Empty,
- [Rom.RIPEMD160Key] = HashType.RIPEMD160.ZeroString,
- [Rom.SHA1Key] = string.Empty,
- [Rom.SHA256Key] = string.Empty,
- [Rom.SHA384Key] = string.Empty,
- [Rom.SHA512Key] = string.Empty,
- [Rom.SpamSumKey] = string.Empty,
+ CRC16 = string.Empty,
+ CRC32 = string.Empty,
+ CRC64 = string.Empty,
+ MD2 = string.Empty,
+ MD4 = string.Empty,
+ MD5 = string.Empty,
+ RIPEMD128 = string.Empty,
+ RIPEMD160 = HashType.RIPEMD160.ZeroString,
+ SHA1 = string.Empty,
+ SHA256 = string.Empty,
+ SHA384 = string.Empty,
+ SHA512 = string.Empty,
+ SpamSum = string.Empty,
};
bool actual = self.HasZeroHash();
@@ -1341,21 +2363,21 @@ namespace SabreTools.Data.Extensions.Test
[Fact]
public void HasZeroHash_Rom_ZeroSHA1_True()
{
- DictionaryBase self = new Rom
+ var self = new Rom
{
- [Rom.CRC16Key] = string.Empty,
- [Rom.CRCKey] = string.Empty,
- [Rom.CRC64Key] = string.Empty,
- [Rom.MD2Key] = string.Empty,
- [Rom.MD4Key] = string.Empty,
- [Rom.MD5Key] = string.Empty,
- [Rom.RIPEMD128Key] = string.Empty,
- [Rom.RIPEMD160Key] = string.Empty,
- [Rom.SHA1Key] = HashType.SHA1.ZeroString,
- [Rom.SHA256Key] = string.Empty,
- [Rom.SHA384Key] = string.Empty,
- [Rom.SHA512Key] = string.Empty,
- [Rom.SpamSumKey] = string.Empty,
+ CRC16 = string.Empty,
+ CRC32 = string.Empty,
+ CRC64 = string.Empty,
+ MD2 = string.Empty,
+ MD4 = string.Empty,
+ MD5 = string.Empty,
+ RIPEMD128 = string.Empty,
+ RIPEMD160 = string.Empty,
+ SHA1 = HashType.SHA1.ZeroString,
+ SHA256 = string.Empty,
+ SHA384 = string.Empty,
+ SHA512 = string.Empty,
+ SpamSum = string.Empty,
};
bool actual = self.HasZeroHash();
@@ -1365,21 +2387,21 @@ namespace SabreTools.Data.Extensions.Test
[Fact]
public void HasZeroHash_Rom_ZeroSHA256_True()
{
- DictionaryBase self = new Rom
+ var self = new Rom
{
- [Rom.CRC16Key] = string.Empty,
- [Rom.CRCKey] = string.Empty,
- [Rom.CRC64Key] = string.Empty,
- [Rom.MD2Key] = string.Empty,
- [Rom.MD4Key] = string.Empty,
- [Rom.MD5Key] = string.Empty,
- [Rom.RIPEMD128Key] = string.Empty,
- [Rom.RIPEMD160Key] = string.Empty,
- [Rom.SHA1Key] = string.Empty,
- [Rom.SHA256Key] = HashType.SHA256.ZeroString,
- [Rom.SHA384Key] = string.Empty,
- [Rom.SHA512Key] = string.Empty,
- [Rom.SpamSumKey] = string.Empty,
+ CRC16 = string.Empty,
+ CRC32 = string.Empty,
+ CRC64 = string.Empty,
+ MD2 = string.Empty,
+ MD4 = string.Empty,
+ MD5 = string.Empty,
+ RIPEMD128 = string.Empty,
+ RIPEMD160 = string.Empty,
+ SHA1 = string.Empty,
+ SHA256 = HashType.SHA256.ZeroString,
+ SHA384 = string.Empty,
+ SHA512 = string.Empty,
+ SpamSum = string.Empty,
};
bool actual = self.HasZeroHash();
@@ -1389,21 +2411,21 @@ namespace SabreTools.Data.Extensions.Test
[Fact]
public void HasZeroHash_Rom_ZeroSHA384_True()
{
- DictionaryBase self = new Rom
+ var self = new Rom
{
- [Rom.CRC16Key] = string.Empty,
- [Rom.CRCKey] = string.Empty,
- [Rom.CRC64Key] = string.Empty,
- [Rom.MD2Key] = string.Empty,
- [Rom.MD4Key] = string.Empty,
- [Rom.MD5Key] = string.Empty,
- [Rom.RIPEMD128Key] = string.Empty,
- [Rom.RIPEMD160Key] = string.Empty,
- [Rom.SHA1Key] = string.Empty,
- [Rom.SHA256Key] = string.Empty,
- [Rom.SHA384Key] = HashType.SHA384.ZeroString,
- [Rom.SHA512Key] = string.Empty,
- [Rom.SpamSumKey] = string.Empty,
+ CRC16 = string.Empty,
+ CRC32 = string.Empty,
+ CRC64 = string.Empty,
+ MD2 = string.Empty,
+ MD4 = string.Empty,
+ MD5 = string.Empty,
+ RIPEMD128 = string.Empty,
+ RIPEMD160 = string.Empty,
+ SHA1 = string.Empty,
+ SHA256 = string.Empty,
+ SHA384 = HashType.SHA384.ZeroString,
+ SHA512 = string.Empty,
+ SpamSum = string.Empty,
};
bool actual = self.HasZeroHash();
@@ -1413,21 +2435,21 @@ namespace SabreTools.Data.Extensions.Test
[Fact]
public void HasZeroHash_Rom_ZeroSHA512_True()
{
- DictionaryBase self = new Rom
+ var self = new Rom
{
- [Rom.CRC16Key] = string.Empty,
- [Rom.CRCKey] = string.Empty,
- [Rom.CRC64Key] = string.Empty,
- [Rom.MD2Key] = string.Empty,
- [Rom.MD4Key] = string.Empty,
- [Rom.MD5Key] = string.Empty,
- [Rom.RIPEMD128Key] = string.Empty,
- [Rom.RIPEMD160Key] = string.Empty,
- [Rom.SHA1Key] = string.Empty,
- [Rom.SHA256Key] = string.Empty,
- [Rom.SHA384Key] = string.Empty,
- [Rom.SHA512Key] = HashType.SHA512.ZeroString,
- [Rom.SpamSumKey] = string.Empty,
+ CRC16 = string.Empty,
+ CRC32 = string.Empty,
+ CRC64 = string.Empty,
+ MD2 = string.Empty,
+ MD4 = string.Empty,
+ MD5 = string.Empty,
+ RIPEMD128 = string.Empty,
+ RIPEMD160 = string.Empty,
+ SHA1 = string.Empty,
+ SHA256 = string.Empty,
+ SHA384 = string.Empty,
+ SHA512 = HashType.SHA512.ZeroString,
+ SpamSum = string.Empty,
};
bool actual = self.HasZeroHash();
@@ -1437,21 +2459,21 @@ namespace SabreTools.Data.Extensions.Test
[Fact]
public void HasZeroHash_Rom_ZeroSpamSum_True()
{
- DictionaryBase self = new Rom
+ var self = new Rom
{
- [Rom.CRC16Key] = string.Empty,
- [Rom.CRCKey] = string.Empty,
- [Rom.CRC64Key] = string.Empty,
- [Rom.MD2Key] = string.Empty,
- [Rom.MD4Key] = string.Empty,
- [Rom.MD5Key] = string.Empty,
- [Rom.RIPEMD128Key] = string.Empty,
- [Rom.RIPEMD160Key] = string.Empty,
- [Rom.SHA1Key] = string.Empty,
- [Rom.SHA256Key] = string.Empty,
- [Rom.SHA384Key] = string.Empty,
- [Rom.SHA512Key] = string.Empty,
- [Rom.SpamSumKey] = HashType.SpamSum.ZeroString,
+ CRC16 = string.Empty,
+ CRC32 = string.Empty,
+ CRC64 = string.Empty,
+ MD2 = string.Empty,
+ MD4 = string.Empty,
+ MD5 = string.Empty,
+ RIPEMD128 = string.Empty,
+ RIPEMD160 = string.Empty,
+ SHA1 = string.Empty,
+ SHA256 = string.Empty,
+ SHA384 = string.Empty,
+ SHA512 = string.Empty,
+ SpamSum = HashType.SpamSum.ZeroString,
};
bool actual = self.HasZeroHash();
@@ -1461,35 +2483,27 @@ namespace SabreTools.Data.Extensions.Test
[Fact]
public void HasZeroHash_Rom_ZeroAll_True()
{
- DictionaryBase self = new Rom
+ var self = new Rom
{
- [Rom.CRC16Key] = HashType.CRC16.ZeroString,
- [Rom.CRCKey] = HashType.CRC32.ZeroString,
- [Rom.CRC64Key] = HashType.CRC64.ZeroString,
- [Rom.MD2Key] = HashType.MD2.ZeroString,
- [Rom.MD4Key] = HashType.MD4.ZeroString,
- [Rom.MD5Key] = HashType.MD5.ZeroString,
- [Rom.RIPEMD128Key] = HashType.RIPEMD128.ZeroString,
- [Rom.RIPEMD160Key] = HashType.RIPEMD160.ZeroString,
- [Rom.SHA1Key] = HashType.SHA1.ZeroString,
- [Rom.SHA256Key] = HashType.SHA256.ZeroString,
- [Rom.SHA384Key] = HashType.SHA384.ZeroString,
- [Rom.SHA512Key] = HashType.SHA512.ZeroString,
- [Rom.SpamSumKey] = HashType.SpamSum.ZeroString,
+ CRC16 = HashType.CRC16.ZeroString,
+ CRC32 = HashType.CRC32.ZeroString,
+ CRC64 = HashType.CRC64.ZeroString,
+ MD2 = HashType.MD2.ZeroString,
+ MD4 = HashType.MD4.ZeroString,
+ MD5 = HashType.MD5.ZeroString,
+ RIPEMD128 = HashType.RIPEMD128.ZeroString,
+ RIPEMD160 = HashType.RIPEMD160.ZeroString,
+ SHA1 = HashType.SHA1.ZeroString,
+ SHA256 = HashType.SHA256.ZeroString,
+ SHA384 = HashType.SHA384.ZeroString,
+ SHA512 = HashType.SHA512.ZeroString,
+ SpamSum = HashType.SpamSum.ZeroString,
};
bool actual = self.HasZeroHash();
Assert.True(actual);
}
- [Fact]
- public void HasZeroHash_Other_False()
- {
- DictionaryBase self = new Sample();
- bool actual = self.HasZeroHash();
- Assert.False(actual);
- }
-
#endregion
#region FillMissingHashes
@@ -1497,21 +2511,21 @@ namespace SabreTools.Data.Extensions.Test
[Fact]
public void FillMissingHashes_Disk_BothEmpty()
{
- DictionaryBase self = new Disk();
- DictionaryBase other = new Disk();
+ var self = new Disk();
+ var other = new Disk();
self.FillMissingHashes(other);
- Assert.Single(self);
+ Assert.False(self.HasHashes());
}
[Fact]
public void FillMissingHashes_Disk_AllMissing()
{
- DictionaryBase self = new Disk();
- DictionaryBase other = new Disk
+ var self = new Disk();
+ var other = new Disk
{
- [Disk.MD5Key] = "XXXXXX",
- [Disk.SHA1Key] = "XXXXXX",
+ MD5 = "XXXXXX",
+ SHA1 = "XXXXXX",
};
self.FillMissingHashes(other);
@@ -1520,22 +2534,22 @@ namespace SabreTools.Data.Extensions.Test
[Fact]
public void FillMissingHashes_Media_BothEmpty()
{
- DictionaryBase self = new Media();
- DictionaryBase other = new Media();
+ var self = new Media();
+ var other = new Media();
self.FillMissingHashes(other);
- Assert.Single(self);
+ Assert.False(self.HasHashes());
}
[Fact]
public void FillMissingHashes_Media_AllMissing()
{
- DictionaryBase self = new Media();
- DictionaryBase other = new Media
+ var self = new Media();
+ var other = new Media
{
- [Media.MD5Key] = "XXXXXX",
- [Media.SHA1Key] = "XXXXXX",
- [Media.SHA256Key] = "XXXXXX",
- [Media.SpamSumKey] = "XXXXXX",
+ MD5 = "XXXXXX",
+ SHA1 = "XXXXXX",
+ SHA256 = "XXXXXX",
+ SpamSum = "XXXXXX",
};
self.FillMissingHashes(other);
@@ -1544,31 +2558,31 @@ namespace SabreTools.Data.Extensions.Test
[Fact]
public void FillMissingHashes_Rom_BothEmpty()
{
- DictionaryBase self = new Rom();
- DictionaryBase other = new Rom();
+ var self = new Rom();
+ var other = new Rom();
self.FillMissingHashes(other);
- Assert.Single(self);
+ Assert.False(self.HasHashes());
}
[Fact]
public void FillMissingHashes_Rom_AllMissing()
{
- DictionaryBase self = new Rom();
- DictionaryBase other = new Rom
+ var self = new Rom();
+ var other = new Rom
{
- [Rom.CRC16Key] = "XXXXXX",
- [Rom.CRCKey] = "XXXXXX",
- [Rom.CRC64Key] = "XXXXXX",
- [Rom.MD2Key] = "XXXXXX",
- [Rom.MD4Key] = "XXXXXX",
- [Rom.MD5Key] = "XXXXXX",
- [Rom.RIPEMD128Key] = "XXXXXX",
- [Rom.RIPEMD160Key] = "XXXXXX",
- [Rom.SHA1Key] = "XXXXXX",
- [Rom.SHA256Key] = "XXXXXX",
- [Rom.SHA384Key] = "XXXXXX",
- [Rom.SHA512Key] = "XXXXXX",
- [Rom.SpamSumKey] = "XXXXXX",
+ CRC16 = "XXXXXX",
+ CRC32 = "XXXXXX",
+ CRC64 = "XXXXXX",
+ MD2 = "XXXXXX",
+ MD4 = "XXXXXX",
+ MD5 = "XXXXXX",
+ RIPEMD128 = "XXXXXX",
+ RIPEMD160 = "XXXXXX",
+ SHA1 = "XXXXXX",
+ SHA256 = "XXXXXX",
+ SHA384 = "XXXXXX",
+ SHA512 = "XXXXXX",
+ SpamSum = "XXXXXX",
};
self.FillMissingHashes(other);
@@ -1578,6 +2592,16 @@ namespace SabreTools.Data.Extensions.Test
#region String to Enum
+ [Theory]
+ [InlineData(null, null)]
+ [InlineData("plain", Blit.Plain)]
+ [InlineData("dirty", Blit.Dirty)]
+ public void AsBlitTest(string? field, Blit? expected)
+ {
+ Blit? actual = field.AsBlit();
+ Assert.Equal(expected, actual);
+ }
+
[Theory]
[InlineData(null, null)]
[InlineData("cpu", ChipType.CPU)]
@@ -1704,12 +2728,74 @@ namespace SabreTools.Data.Extensions.Test
[InlineData("nodump", ItemStatus.Nodump)]
[InlineData("yes", ItemStatus.Nodump)]
[InlineData("verified", ItemStatus.Verified)]
+ [InlineData("deduped", ItemStatus.Deduped)]
public void AsItemStatusTest(string? field, ItemStatus? expected)
{
ItemStatus? actual = field.AsItemStatus();
Assert.Equal(expected, actual);
}
+ [Theory]
+ [InlineData(null, ItemType.NULL)]
+ [InlineData("adjuster", ItemType.Adjuster)]
+ [InlineData("analog", ItemType.Analog)]
+ [InlineData("archive", ItemType.Archive)]
+ [InlineData("biosset", ItemType.BiosSet)]
+ [InlineData("blank", ItemType.Blank)]
+ [InlineData("chip", ItemType.Chip)]
+ [InlineData("condition", ItemType.Condition)]
+ [InlineData("configuration", ItemType.Configuration)]
+ [InlineData("conflocation", ItemType.ConfLocation)]
+ [InlineData("confsetting", ItemType.ConfSetting)]
+ [InlineData("control", ItemType.Control)]
+ [InlineData("dataarea", ItemType.DataArea)]
+ [InlineData("device", ItemType.Device)]
+ [InlineData("deviceref", ItemType.DeviceRef)]
+ [InlineData("device_ref", ItemType.DeviceRef)]
+ [InlineData("diplocation", ItemType.DipLocation)]
+ [InlineData("dipswitch", ItemType.DipSwitch)]
+ [InlineData("dipvalue", ItemType.DipValue)]
+ [InlineData("disk", ItemType.Disk)]
+ [InlineData("diskarea", ItemType.DiskArea)]
+ [InlineData("display", ItemType.Display)]
+ [InlineData("driver", ItemType.Driver)]
+ [InlineData("extension", ItemType.Extension)]
+ [InlineData("feature", ItemType.Feature)]
+ [InlineData("file", ItemType.File)]
+ [InlineData("info", ItemType.Info)]
+ [InlineData("input", ItemType.Input)]
+ [InlineData("instance", ItemType.Instance)]
+ [InlineData("media", ItemType.Media)]
+ [InlineData("part", ItemType.Part)]
+ [InlineData("partfeature", ItemType.PartFeature)]
+ [InlineData("part_feature", ItemType.PartFeature)]
+ [InlineData("port", ItemType.Port)]
+ [InlineData("ramoption", ItemType.RamOption)]
+ [InlineData("ram_option", ItemType.RamOption)]
+ [InlineData("release", ItemType.Release)]
+ [InlineData("releasedetails", ItemType.ReleaseDetails)]
+ [InlineData("release_details", ItemType.ReleaseDetails)]
+ [InlineData("rom", ItemType.Rom)]
+ [InlineData("sample", ItemType.Sample)]
+ [InlineData("serials", ItemType.Serials)]
+ [InlineData("sharedfeat", ItemType.SharedFeat)]
+ [InlineData("shared_feat", ItemType.SharedFeat)]
+ [InlineData("sharedfeature", ItemType.SharedFeat)]
+ [InlineData("shared_feature", ItemType.SharedFeat)]
+ [InlineData("slot", ItemType.Slot)]
+ [InlineData("slotoption", ItemType.SlotOption)]
+ [InlineData("slot_option", ItemType.SlotOption)]
+ [InlineData("softwarelist", ItemType.SoftwareList)]
+ [InlineData("software_list", ItemType.SoftwareList)]
+ [InlineData("sound", ItemType.Sound)]
+ [InlineData("sourcedetails", ItemType.SourceDetails)]
+ [InlineData("source_details", ItemType.SourceDetails)]
+ public void AsItemTypeTest(string? field, ItemType expected)
+ {
+ ItemType actual = field.AsItemType();
+ Assert.Equal(expected, actual);
+ }
+
[Theory]
[InlineData(null, null)]
[InlineData("load16_byte", LoadFlag.Load16Byte)]
@@ -1805,6 +2891,24 @@ namespace SabreTools.Data.Extensions.Test
Assert.Equal(expected, actual);
}
+ [Theory]
+ [InlineData(null, null)]
+ [InlineData("0", Rotation.North)]
+ [InlineData("north", Rotation.North)]
+ [InlineData("vertical", Rotation.North)]
+ [InlineData("90", Rotation.East)]
+ [InlineData("east", Rotation.East)]
+ [InlineData("horizontal", Rotation.East)]
+ [InlineData("180", Rotation.South)]
+ [InlineData("south", Rotation.South)]
+ [InlineData("270", Rotation.West)]
+ [InlineData("west", Rotation.West)]
+ public void AsRotationTest(string? field, Rotation? expected)
+ {
+ Rotation? actual = field.AsRotation();
+ Assert.Equal(expected, actual);
+ }
+
[Theory]
[InlineData(null, null)]
[InlineData("no", Runnable.No)]
@@ -1851,11 +2955,29 @@ namespace SabreTools.Data.Extensions.Test
Assert.Equal(expected, actual);
}
+ [Theory]
+ [InlineData(null, null)]
+ [InlineData("8", Width.Byte)]
+ [InlineData("byte", Width.Byte)]
+ [InlineData("16", Width.Short)]
+ [InlineData("short", Width.Short)]
+ [InlineData("32", Width.Int)]
+ [InlineData("int", Width.Int)]
+ [InlineData("64", Width.Long)]
+ [InlineData("long", Width.Long)]
+ public void AsWidth(string? field, Width? expected)
+ {
+ Width? actual = field.AsWidth();
+ Assert.Equal(expected, actual);
+ }
+
[Theory]
[InlineData(null, null)]
[InlineData("INVALID", null)]
+ [InlineData("1", true)]
[InlineData("yes", true)]
[InlineData("True", true)]
+ [InlineData("0", false)]
[InlineData("no", false)]
[InlineData("False", false)]
public void AsYesNoTest(string? field, bool? expected)
@@ -1868,6 +2990,16 @@ namespace SabreTools.Data.Extensions.Test
#region Enum to String
+ [Theory]
+ [InlineData((Blit)int.MaxValue, null)]
+ [InlineData(Blit.Plain, "plain")]
+ [InlineData(Blit.Dirty, "dirty")]
+ public void FromBlitTest(Blit field, string? expected)
+ {
+ string? actual = field.AsStringValue();
+ Assert.Equal(expected, actual);
+ }
+
[Theory]
[InlineData((ChipType)int.MaxValue, null)]
[InlineData(ChipType.CPU, "cpu")]
@@ -1998,12 +3130,65 @@ namespace SabreTools.Data.Extensions.Test
[InlineData(ItemStatus.Nodump, false, "nodump")]
[InlineData(ItemStatus.Verified, true, "verified")]
[InlineData(ItemStatus.Verified, false, "verified")]
+ [InlineData(ItemStatus.Deduped, true, "deduped")]
+ [InlineData(ItemStatus.Deduped, false, "deduped")]
public void FromItemStatusTest(ItemStatus field, bool useSecond, string? expected)
{
string? actual = field.AsStringValue(useSecond);
Assert.Equal(expected, actual);
}
+ [Theory]
+ [InlineData(ItemType.NULL, null)]
+ [InlineData(ItemType.Adjuster, "adjuster")]
+ [InlineData(ItemType.Analog, "analog")]
+ [InlineData(ItemType.Archive, "archive")]
+ [InlineData(ItemType.BiosSet, "biosset")]
+ [InlineData(ItemType.Blank, "blank")]
+ [InlineData(ItemType.Chip, "chip")]
+ [InlineData(ItemType.Condition, "condition")]
+ [InlineData(ItemType.Configuration, "configuration")]
+ [InlineData(ItemType.ConfLocation, "conflocation")]
+ [InlineData(ItemType.ConfSetting, "confsetting")]
+ [InlineData(ItemType.Control, "control")]
+ [InlineData(ItemType.DataArea, "dataarea")]
+ [InlineData(ItemType.Device, "device")]
+ [InlineData(ItemType.DeviceRef, "device_ref")]
+ [InlineData(ItemType.DipLocation, "diplocation")]
+ [InlineData(ItemType.DipSwitch, "dipswitch")]
+ [InlineData(ItemType.DipValue, "dipvalue")]
+ [InlineData(ItemType.Disk, "disk")]
+ [InlineData(ItemType.DiskArea, "diskarea")]
+ [InlineData(ItemType.Display, "display")]
+ [InlineData(ItemType.Driver, "driver")]
+ [InlineData(ItemType.Extension, "extension")]
+ [InlineData(ItemType.Feature, "feature")]
+ [InlineData(ItemType.File, "file")]
+ [InlineData(ItemType.Info, "info")]
+ [InlineData(ItemType.Input, "input")]
+ [InlineData(ItemType.Instance, "instance")]
+ [InlineData(ItemType.Media, "media")]
+ [InlineData(ItemType.Part, "part")]
+ [InlineData(ItemType.PartFeature, "part_feature")]
+ [InlineData(ItemType.Port, "port")]
+ [InlineData(ItemType.RamOption, "ramoption")]
+ [InlineData(ItemType.Release, "release")]
+ [InlineData(ItemType.ReleaseDetails, "release_details")]
+ [InlineData(ItemType.Rom, "rom")]
+ [InlineData(ItemType.Sample, "sample")]
+ [InlineData(ItemType.Serials, "serials")]
+ [InlineData(ItemType.SharedFeat, "sharedfeat")]
+ [InlineData(ItemType.Slot, "slot")]
+ [InlineData(ItemType.SlotOption, "slotoption")]
+ [InlineData(ItemType.SoftwareList, "softwarelist")]
+ [InlineData(ItemType.Sound, "sound")]
+ [InlineData(ItemType.SourceDetails, "source_details")]
+ public void FromItemTypeTest(ItemType field, string? expected)
+ {
+ string? actual = field.AsStringValue();
+ Assert.Equal(expected, actual);
+ }
+
[Theory]
[InlineData((LoadFlag)int.MaxValue, null)]
[InlineData(LoadFlag.Load16Byte, "load16_byte")]
@@ -2102,6 +3287,21 @@ namespace SabreTools.Data.Extensions.Test
Assert.Equal(expected, actual);
}
+ [Theory]
+ [InlineData(Rotation.North, true, "vertical")]
+ [InlineData(Rotation.North, false, "0")]
+ [InlineData(Rotation.East, true, "horizontal")]
+ [InlineData(Rotation.East, false, "90")]
+ [InlineData(Rotation.South, true, "vertical")]
+ [InlineData(Rotation.South, false, "180")]
+ [InlineData(Rotation.West, true, "horizontal")]
+ [InlineData(Rotation.West, false, "270")]
+ public void FromRotationTest(Rotation field, bool useSecond, string? expected)
+ {
+ string? actual = field.AsStringValue(useSecond);
+ Assert.Equal(expected, actual);
+ }
+
[Theory]
[InlineData((Runnable)int.MaxValue, null)]
[InlineData(Runnable.No, "no")]
@@ -2150,6 +3350,18 @@ namespace SabreTools.Data.Extensions.Test
Assert.Equal(expected, actual);
}
+ [Theory]
+ [InlineData((Width)int.MaxValue, null)]
+ [InlineData(Width.Byte, "8")]
+ [InlineData(Width.Short, "16")]
+ [InlineData(Width.Int, "32")]
+ [InlineData(Width.Long, "64")]
+ public void FromWidthTest(Width field, string? expected)
+ {
+ string? actual = field.AsStringValue();
+ Assert.Equal(expected, actual);
+ }
+
[Theory]
[InlineData(null, null)]
[InlineData(true, "yes")]
diff --git a/SabreTools.Data.Extensions/MetadataExtensions.cs b/SabreTools.Data.Extensions/MetadataExtensions.cs
index c46fece7..9852c363 100644
--- a/SabreTools.Data.Extensions/MetadataExtensions.cs
+++ b/SabreTools.Data.Extensions/MetadataExtensions.cs
@@ -6,238 +6,148 @@ using SabreTools.Matching;
namespace SabreTools.Data.Extensions
{
+ // TODO: Add proper enum for YesNo
+ // TODO: Combine yes/partial/no enums
public static class MetadataExtensions
{
- #region Accessors
-
- ///
- /// Gets the name to use for a DictionaryBase or null
- ///
- public static string? GetName(this DictionaryBase self)
- {
- if (self is null)
- return null;
-
- return self switch
- {
- Machine => self.ReadString(Machine.NameKey),
-
- Adjuster => self.ReadString(Adjuster.NameKey),
- Analog => null,
- Archive => self.ReadString(Archive.NameKey),
- BiosSet => self.ReadString(BiosSet.NameKey),
- Chip => self.ReadString(Chip.NameKey),
- Condition => null,
- ConfLocation => self.ReadString(ConfLocation.NameKey),
- ConfSetting => self.ReadString(ConfSetting.NameKey),
- Configuration => self.ReadString(Configuration.NameKey),
- Control => null,
- DataArea => self.ReadString(DataArea.NameKey),
- Device => null,
- DeviceRef => self.ReadString(DeviceRef.NameKey),
- DipLocation => self.ReadString(DipLocation.NameKey),
- DipSwitch => self.ReadString(DipSwitch.NameKey),
- DipValue => self.ReadString(DipValue.NameKey),
- Disk => self.ReadString(Disk.NameKey),
- DiskArea => self.ReadString(DiskArea.NameKey),
- Display => null,
- Driver => null,
- Extension => self.ReadString(Extension.NameKey),
- Feature => self.ReadString(Feature.NameKey),
- Info => self.ReadString(Info.NameKey),
- Input => null,
- Instance => self.ReadString(Instance.NameKey),
- Media => self.ReadString(Media.NameKey),
- Part => self.ReadString(Part.NameKey),
- Port => null,
- RamOption => self.ReadString(RamOption.NameKey),
- Release => self.ReadString(Release.NameKey),
- ReleaseDetails => null,
- Rom => self.ReadString(Rom.NameKey),
- Sample => self.ReadString(Sample.NameKey),
- Serials => null,
- SharedFeat => self.ReadString(SharedFeat.NameKey),
- Slot => self.ReadString(Slot.NameKey),
- SlotOption => self.ReadString(SlotOption.NameKey),
- SoftwareList => self.ReadString(SoftwareList.NameKey),
- Sound => null,
- SourceDetails => null,
- Video => null,
-
- _ => null,
- };
- }
-
- ///
- /// Gets the name to use for a DictionaryBase or null
- ///
- public static void SetName(this DictionaryBase self, string? name)
- {
- if (self is null || string.IsNullOrEmpty(name))
- return;
-
- switch (self)
- {
- case Machine: self[Machine.NameKey] = name; break;
-
- case Adjuster: self[Adjuster.NameKey] = name; break;
- case Analog: break;
- case Archive: self[Archive.NameKey] = name; break;
- case BiosSet: self[BiosSet.NameKey] = name; break;
- case Chip: self[Chip.NameKey] = name; break;
- case Condition: break;
- case ConfLocation: self[ConfLocation.NameKey] = name; break;
- case ConfSetting: self[ConfSetting.NameKey] = name; break;
- case Configuration: self[Configuration.NameKey] = name; break;
- case Control: break;
- case DataArea: self[DataArea.NameKey] = name; break;
- case Device: break;
- case DeviceRef: self[DeviceRef.NameKey] = name; break;
- case DipLocation: self[DipLocation.NameKey] = name; break;
- case DipSwitch: self[DipSwitch.NameKey] = name; break;
- case DipValue: self[DipValue.NameKey] = name; break;
- case Disk: self[Disk.NameKey] = name; break;
- case DiskArea: self[DiskArea.NameKey] = name; break;
- case Display: break;
- case Driver: break;
- case Extension: self[Extension.NameKey] = name; break;
- case Feature: self[Feature.NameKey] = name; break;
- case Info: self[Info.NameKey] = name; break;
- case Input: break;
- case Instance: self[Instance.NameKey] = name; break;
- case Media: self[Media.NameKey] = name; break;
- case Part: self[Part.NameKey] = name; break;
- case Port: break;
- case RamOption: self[RamOption.NameKey] = name; break;
- case Release: self[Release.NameKey] = name; break;
- case ReleaseDetails: break;
- case Rom: self[Rom.NameKey] = name; break;
- case Sample: self[Sample.NameKey] = name; break;
- case Serials: break;
- case SharedFeat: self[SharedFeat.NameKey] = name; break;
- case Slot: self[Slot.NameKey] = name; break;
- case SlotOption: self[SlotOption.NameKey] = name; break;
- case SoftwareList: self[SoftwareList.NameKey] = name; break;
- case Sound: break;
- case SourceDetails: break;
- case Video: break;
-
- default: break;
- }
- }
-
- #endregion
-
- #region Cloning
-
- ///
- /// Deep clone a DictionaryBase object
- ///
- public static DictionaryBase? Clone(this DictionaryBase self)
- {
- // If construction failed, we can't do anything
- if (Activator.CreateInstance(self.GetType()) is not DictionaryBase clone)
- return null;
-
- // Loop through and clone per type
- foreach (string key in self.Keys)
- {
- object? value = self[key];
- clone[key] = value switch
- {
- // Primative types
- bool or long or double or string => value,
-
- // DictionaryBase types
- DictionaryBase db => db.Clone(),
-
- // Enumerable types
- byte[] bytArr => bytArr.Clone(),
- string[] strArr => strArr.Clone(),
- DictionaryBase[] dbArr => Array.ConvertAll(dbArr, Clone),
- ICloneable[] clArr => Array.ConvertAll(clArr, cl => cl.Clone()),
-
- // Everything else just copies
- _ => value,
- };
- }
-
- return clone;
- }
-
- #endregion
-
#region Conversion
- ///
- /// Convert a DictionaryBase to a Rom
- ///
- public static Rom? ConvertToRom(this DictionaryBase? self)
- {
- // If the DatItem is missing, we can't do anything
- if (self is null)
- return null;
-
- return self switch
- {
- Disk diskSelf => ConvertToRom(diskSelf),
- Media mediaSelf => ConvertToRom(mediaSelf),
- _ => null,
- };
- }
-
///
/// Convert a Disk to a Rom
///
- private static Rom? ConvertToRom(this Disk? disk)
+ public static Rom? ConvertToRom(this Disk? disk)
{
// If the Disk is missing, we can't do anything
if (disk is null)
return null;
// Append a suffix to the name
- string? name = disk.ReadString(Disk.NameKey);
+ string? name = disk.Name;
if (name is not null)
name += ".chd";
return new Rom
{
- [Rom.NameKey] = name,
- [Rom.MergeKey] = disk.ReadString(Disk.MergeKey),
- [Rom.RegionKey] = disk.ReadString(Disk.RegionKey),
- [Rom.StatusKey] = disk.ReadString(Disk.StatusKey),
- [Rom.OptionalKey] = disk.ReadString(Disk.OptionalKey),
- [Rom.MD5Key] = disk.ReadString(Disk.MD5Key),
- [Rom.SHA1Key] = disk.ReadString(Disk.SHA1Key),
+ Name = name,
+ Merge = disk.Merge,
+ Region = disk.Region,
+ Status = disk.Status,
+ Optional = disk.Optional,
+ MD5 = disk.MD5,
+ SHA1 = disk.SHA1,
};
}
///
/// Convert a Media to a Rom
///
- private static Rom? ConvertToRom(this Media? media)
+ public static Rom? ConvertToRom(this Media? media)
{
// If the Media is missing, we can't do anything
if (media is null)
return null;
// Append a suffix to the name
- string? name = media.ReadString(Media.NameKey);
+ string? name = media.Name;
if (name is not null)
name += ".aaruf";
return new Rom
{
- [Rom.NameKey] = name,
- [Rom.MD5Key] = media.ReadString(Media.MD5Key),
- [Rom.SHA1Key] = media.ReadString(Media.SHA1Key),
- [Rom.SHA256Key] = media.ReadString(Media.SHA256Key),
- [Rom.SpamSumKey] = media.ReadString(Media.SpamSumKey),
+ Name = name,
+ MD5 = media.MD5,
+ SHA1 = media.SHA1,
+ SHA256 = media.SHA256,
+ SpamSum = media.SpamSum,
};
}
#endregion
+ #region Equality Checking
+
+ ///
+ /// Check equality of two Disk objects
+ ///
+ public static bool PartialEquals(this Disk self, Disk other)
+ {
+ ItemStatus? selfStatus = self.Status;
+ ItemStatus? otherStatus = other.Status;
+
+ string? selfName = self.Name;
+ string? otherName = other.Name;
+
+ // If all hashes are empty but they're both nodump and the names match, then they're dupes
+ if (selfStatus == ItemStatus.Nodump
+ && otherStatus == ItemStatus.Nodump
+ && string.Equals(selfName, otherName, StringComparison.OrdinalIgnoreCase)
+ && !self.HasHashes()
+ && !other.HasHashes())
+ {
+ return true;
+ }
+
+ // If we get a partial match
+ if (self.HashMatch(other))
+ return true;
+
+ // All other cases fail
+ return false;
+ }
+
+ ///
+ /// Check equality of two Media objects
+ ///
+ public static bool PartialEquals(this Media self, Media other)
+ {
+ // If we get a partial match
+ if (self.HashMatch(other))
+ return true;
+
+ // All other cases fail
+ return false;
+ }
+
+ ///
+ /// Check equality of two Rom objects
+ ///
+ public static bool PartialEquals(this Rom self, Rom other)
+ {
+ ItemStatus? selfStatus = self.Status;
+ ItemStatus? otherStatus = other.Status;
+
+ string? selfName = self.Name;
+ string? otherName = other.Name;
+
+ long? selfSize = self.Size;
+ long? otherSize = other.Size;
+
+ // If all hashes are empty but they're both nodump and the names match, then they're dupes
+ if (selfStatus == ItemStatus.Nodump
+ && otherStatus == ItemStatus.Nodump
+ && string.Equals(selfName, otherName, StringComparison.OrdinalIgnoreCase)
+ && !self.HasHashes()
+ && !other.HasHashes())
+ {
+ return true;
+ }
+
+ // If we have a file that has no known size, rely on the hashes only
+ if (selfSize is null && self.HashMatch(other))
+ return true;
+ else if (otherSize is null && self.HashMatch(other))
+ return true;
+
+ // If we get a partial match
+ if (selfSize == otherSize && self.HashMatch(other))
+ return true;
+
+ // All other cases fail
+ return false;
+ }
+
+ #endregion
+
#region Hash Checking
///
@@ -288,13 +198,8 @@ namespace SabreTools.Data.Extensions
return false;
// Return if all hashes match according to merge rules
- string? selfMd5 = self.ReadString(Disk.MD5Key);
- string? otherMd5 = other.ReadString(Disk.MD5Key);
- bool conditionalMd5 = ConditionalHashEquals(selfMd5, otherMd5);
-
- string? selfSha1 = self.ReadString(Disk.SHA1Key);
- string? otherSha1 = other.ReadString(Disk.SHA1Key);
- bool conditionalSha1 = ConditionalHashEquals(selfSha1, otherSha1);
+ bool conditionalMd5 = ConditionalHashEquals(self.MD5, other.MD5);
+ bool conditionalSha1 = ConditionalHashEquals(self.SHA1, other.SHA1);
return conditionalMd5
&& conditionalSha1;
@@ -314,21 +219,10 @@ namespace SabreTools.Data.Extensions
return false;
// Return if all hashes match according to merge rules
- string? selfMd5 = self.ReadString(Media.MD5Key);
- string? otherMd5 = other.ReadString(Media.MD5Key);
- bool conditionalMd5 = ConditionalHashEquals(selfMd5, otherMd5);
-
- string? selfSha1 = self.ReadString(Media.SHA1Key);
- string? otherSha1 = other.ReadString(Media.SHA1Key);
- bool conditionalSha1 = ConditionalHashEquals(selfSha1, otherSha1);
-
- string? selfSha256 = self.ReadString(Media.SHA256Key);
- string? otherSha256 = other.ReadString(Media.SHA256Key);
- bool conditionalSha256 = ConditionalHashEquals(selfSha256, otherSha256);
-
- string? selfSpamSum = self.ReadString(Media.SpamSumKey);
- string? otherSpamSum = other.ReadString(Media.SpamSumKey);
- bool conditionalSpamSum = ConditionalHashEquals(selfSpamSum, otherSpamSum);
+ bool conditionalMd5 = ConditionalHashEquals(self.MD5, other.MD5);
+ bool conditionalSha1 = ConditionalHashEquals(self.SHA1, other.SHA1);
+ bool conditionalSha256 = ConditionalHashEquals(self.SHA256, other.SHA256);
+ bool conditionalSpamSum = ConditionalHashEquals(self.SpamSum, other.SpamSum);
return conditionalMd5
&& conditionalSha1
@@ -350,56 +244,56 @@ namespace SabreTools.Data.Extensions
return false;
// Return if all hashes match according to merge rules
- string? selfCrc16 = self.ReadString(Rom.CRC16Key);
- string? otherCrc16 = other.ReadString(Rom.CRC16Key);
+ string? selfCrc16 = self.CRC16;
+ string? otherCrc16 = other.CRC16;
bool conditionalCrc16 = ConditionalHashEquals(selfCrc16, otherCrc16);
- string? selfCrc = self.ReadString(Rom.CRCKey);
- string? otherCrc = other.ReadString(Rom.CRCKey);
+ string? selfCrc = self.CRC32;
+ string? otherCrc = other.CRC32;
bool conditionalCrc = ConditionalHashEquals(selfCrc, otherCrc);
- string? selfCrc64 = self.ReadString(Rom.CRC64Key);
- string? otherCrc64 = other.ReadString(Rom.CRC64Key);
+ string? selfCrc64 = self.CRC64;
+ string? otherCrc64 = other.CRC64;
bool conditionalCrc64 = ConditionalHashEquals(selfCrc64, otherCrc64);
- string? selfMd2 = self.ReadString(Rom.MD2Key);
- string? otherMd2 = other.ReadString(Rom.MD2Key);
+ string? selfMd2 = self.MD2;
+ string? otherMd2 = other.MD2;
bool conditionalMd2 = ConditionalHashEquals(selfMd2, otherMd2);
- string? selfMd4 = self.ReadString(Rom.MD4Key);
- string? otherMd4 = other.ReadString(Rom.MD4Key);
+ string? selfMd4 = self.MD4;
+ string? otherMd4 = other.MD4;
bool conditionalMd4 = ConditionalHashEquals(selfMd4, otherMd4);
- string? selfMd5 = self.ReadString(Rom.MD5Key);
- string? otherMd5 = other.ReadString(Rom.MD5Key);
+ string? selfMd5 = self.MD5;
+ string? otherMd5 = other.MD5;
bool conditionalMd5 = ConditionalHashEquals(selfMd5, otherMd5);
- string? selfRipeMD128 = self.ReadString(Rom.RIPEMD128Key);
- string? otherRipeMD128 = other.ReadString(Rom.RIPEMD128Key);
+ string? selfRipeMD128 = self.RIPEMD128;
+ string? otherRipeMD128 = other.RIPEMD128;
bool conditionaRipeMD128 = ConditionalHashEquals(selfRipeMD128, otherRipeMD128);
- string? selfRipeMD160 = self.ReadString(Rom.RIPEMD160Key);
- string? otherRipeMD160 = other.ReadString(Rom.RIPEMD160Key);
+ string? selfRipeMD160 = self.RIPEMD160;
+ string? otherRipeMD160 = other.RIPEMD160;
bool conditionaRipeMD160 = ConditionalHashEquals(selfRipeMD160, otherRipeMD160);
- string? selfSha1 = self.ReadString(Rom.SHA1Key);
- string? otherSha1 = other.ReadString(Rom.SHA1Key);
+ string? selfSha1 = self.SHA1;
+ string? otherSha1 = other.SHA1;
bool conditionalSha1 = ConditionalHashEquals(selfSha1, otherSha1);
- string? selfSha256 = self.ReadString(Rom.SHA256Key);
- string? otherSha256 = other.ReadString(Rom.SHA256Key);
+ string? selfSha256 = self.SHA256;
+ string? otherSha256 = other.SHA256;
bool conditionalSha256 = ConditionalHashEquals(selfSha256, otherSha256);
- string? selfSha384 = self.ReadString(Rom.SHA384Key);
- string? otherSha384 = other.ReadString(Rom.SHA384Key);
+ string? selfSha384 = self.SHA384;
+ string? otherSha384 = other.SHA384;
bool conditionalSha384 = ConditionalHashEquals(selfSha384, otherSha384);
- string? selfSha512 = self.ReadString(Rom.SHA512Key);
- string? otherSha512 = other.ReadString(Rom.SHA512Key);
+ string? selfSha512 = self.SHA512;
+ string? otherSha512 = other.SHA512;
bool conditionalSha512 = ConditionalHashEquals(selfSha512, otherSha512);
- string? selfSpamSum = self.ReadString(Rom.SpamSumKey);
- string? otherSpamSum = other.ReadString(Rom.SpamSumKey);
+ string? selfSpamSum = self.SpamSum;
+ string? otherSpamSum = other.SpamSum;
bool conditionalSpamSum = ConditionalHashEquals(selfSpamSum, otherSpamSum);
return conditionalCrc16
@@ -420,135 +314,10 @@ namespace SabreTools.Data.Extensions
///
/// Returns if any hashes exist
///
- public static bool HasHashes(this DictionaryBase self)
+ public static bool HasHashes(this Disk disk)
{
- return self switch
- {
- Disk diskSelf => diskSelf.HasHashes(),
- Media mediaSelf => mediaSelf.HasHashes(),
- Rom romSelf => romSelf.HasHashes(),
- _ => false,
- };
- }
-
- ///
- /// Returns if all of the hashes are set to their 0-byte values or null
- ///
- public static bool HasZeroHash(this DictionaryBase self)
- {
- return self switch
- {
- Disk diskSelf => diskSelf.HasZeroHash(),
- Media mediaSelf => mediaSelf.HasZeroHash(),
- Rom romSelf => romSelf.HasZeroHash(),
- _ => false,
- };
- }
-
- ///
- /// Returns if there are no, non-empty hashes in common
- ///
- private static bool HasCommonHash(this Disk self, Disk other)
- {
- bool md5Null = string.IsNullOrEmpty(self.ReadString(Disk.MD5Key));
- md5Null ^= string.IsNullOrEmpty(other.ReadString(Disk.MD5Key));
-
- bool sha1Null = string.IsNullOrEmpty(self.ReadString(Disk.SHA1Key));
- sha1Null ^= string.IsNullOrEmpty(other.ReadString(Disk.SHA1Key));
-
- return !md5Null
- || !sha1Null;
- }
-
- ///
- /// Returns if there are no, non-empty hashes in common
- ///
- private static bool HasCommonHash(this Media self, Media other)
- {
- bool md5Null = string.IsNullOrEmpty(self.ReadString(Media.MD5Key));
- md5Null ^= string.IsNullOrEmpty(other.ReadString(Media.MD5Key));
-
- bool sha1Null = string.IsNullOrEmpty(self.ReadString(Media.SHA1Key));
- sha1Null ^= string.IsNullOrEmpty(other.ReadString(Media.SHA1Key));
-
- bool sha256Null = string.IsNullOrEmpty(self.ReadString(Media.SHA256Key));
- sha256Null ^= string.IsNullOrEmpty(other.ReadString(Media.SHA256Key));
-
- bool spamsumNull = string.IsNullOrEmpty(self.ReadString(Media.SpamSumKey));
- spamsumNull ^= string.IsNullOrEmpty(other.ReadString(Media.SpamSumKey));
-
- return !md5Null
- || !sha1Null
- || !sha256Null
- || !spamsumNull;
- }
-
- ///
- /// Returns if there are no, non-empty hashes in common
- ///
- private static bool HasCommonHash(this Rom self, Rom other)
- {
- bool crc16Null = string.IsNullOrEmpty(self.ReadString(Rom.CRC16Key));
- crc16Null ^= string.IsNullOrEmpty(other.ReadString(Rom.CRC16Key));
-
- bool crcNull = string.IsNullOrEmpty(self.ReadString(Rom.CRCKey));
- crcNull ^= string.IsNullOrEmpty(other.ReadString(Rom.CRCKey));
-
- bool crc64Null = string.IsNullOrEmpty(self.ReadString(Rom.CRC64Key));
- crc64Null ^= string.IsNullOrEmpty(other.ReadString(Rom.CRC64Key));
-
- bool md2Null = string.IsNullOrEmpty(self.ReadString(Rom.MD2Key));
- md2Null ^= string.IsNullOrEmpty(other.ReadString(Rom.MD2Key));
-
- bool md4Null = string.IsNullOrEmpty(self.ReadString(Rom.MD4Key));
- md4Null ^= string.IsNullOrEmpty(other.ReadString(Rom.MD4Key));
-
- bool md5Null = string.IsNullOrEmpty(self.ReadString(Rom.MD5Key));
- md5Null ^= string.IsNullOrEmpty(other.ReadString(Rom.MD5Key));
-
- bool ripeMD128Null = string.IsNullOrEmpty(self.ReadString(Rom.RIPEMD128Key));
- ripeMD128Null ^= string.IsNullOrEmpty(other.ReadString(Rom.RIPEMD128Key));
-
- bool ripeMD160Null = string.IsNullOrEmpty(self.ReadString(Rom.RIPEMD160Key));
- ripeMD160Null ^= string.IsNullOrEmpty(other.ReadString(Rom.RIPEMD160Key));
-
- bool sha1Null = string.IsNullOrEmpty(self.ReadString(Rom.SHA1Key));
- sha1Null ^= string.IsNullOrEmpty(other.ReadString(Rom.SHA1Key));
-
- bool sha256Null = string.IsNullOrEmpty(self.ReadString(Rom.SHA256Key));
- sha256Null ^= string.IsNullOrEmpty(other.ReadString(Rom.SHA256Key));
-
- bool sha384Null = string.IsNullOrEmpty(self.ReadString(Rom.SHA384Key));
- sha384Null ^= string.IsNullOrEmpty(other.ReadString(Rom.SHA384Key));
-
- bool sha512Null = string.IsNullOrEmpty(self.ReadString(Rom.SHA512Key));
- sha512Null ^= string.IsNullOrEmpty(other.ReadString(Rom.SHA512Key));
-
- bool spamsumNull = string.IsNullOrEmpty(self.ReadString(Rom.SpamSumKey));
- spamsumNull ^= string.IsNullOrEmpty(other.ReadString(Rom.SpamSumKey));
-
- return !crc16Null
- || !crcNull
- || !crc64Null
- || !md2Null
- || !md4Null
- || !md5Null
- || !ripeMD128Null
- || !ripeMD160Null
- || !sha1Null
- || !sha256Null
- || !sha384Null
- || !sha512Null
- || !spamsumNull;
- }
-
- ///
- /// Returns if any hashes exist
- ///
- private static bool HasHashes(this Disk disk)
- {
- bool md5Null = string.IsNullOrEmpty(disk.ReadString(Disk.MD5Key));
- bool sha1Null = string.IsNullOrEmpty(disk.ReadString(Disk.SHA1Key));
+ bool md5Null = string.IsNullOrEmpty(disk.MD5);
+ bool sha1Null = string.IsNullOrEmpty(disk.SHA1);
return !md5Null
|| !sha1Null;
@@ -557,12 +326,12 @@ namespace SabreTools.Data.Extensions
///
/// Returns if any hashes exist
///
- private static bool HasHashes(this Media media)
+ public static bool HasHashes(this Media media)
{
- bool md5Null = string.IsNullOrEmpty(media.ReadString(Media.MD5Key));
- bool sha1Null = string.IsNullOrEmpty(media.ReadString(Media.SHA1Key));
- bool sha256Null = string.IsNullOrEmpty(media.ReadString(Media.SHA256Key));
- bool spamsumNull = string.IsNullOrEmpty(media.ReadString(Media.SpamSumKey));
+ bool md5Null = string.IsNullOrEmpty(media.MD5);
+ bool sha1Null = string.IsNullOrEmpty(media.SHA1);
+ bool sha256Null = string.IsNullOrEmpty(media.SHA256);
+ bool spamsumNull = string.IsNullOrEmpty(media.SpamSum);
return !md5Null
|| !sha1Null
@@ -573,24 +342,24 @@ namespace SabreTools.Data.Extensions
///
/// Returns if any hashes exist
///
- private static bool HasHashes(this Rom rom)
+ public static bool HasHashes(this Rom rom)
{
- bool crc16Null = string.IsNullOrEmpty(rom.ReadString(Rom.CRC16Key));
- bool crcNull = string.IsNullOrEmpty(rom.ReadString(Rom.CRCKey));
- bool crc64Null = string.IsNullOrEmpty(rom.ReadString(Rom.CRC64Key));
- bool md2Null = string.IsNullOrEmpty(rom.ReadString(Rom.MD2Key));
- bool md4Null = string.IsNullOrEmpty(rom.ReadString(Rom.MD4Key));
- bool md5Null = string.IsNullOrEmpty(rom.ReadString(Rom.MD5Key));
- bool ripeMD128Null = string.IsNullOrEmpty(rom.ReadString(Rom.RIPEMD128Key));
- bool ripeMD160Null = string.IsNullOrEmpty(rom.ReadString(Rom.RIPEMD160Key));
- bool sha1Null = string.IsNullOrEmpty(rom.ReadString(Rom.SHA1Key));
- bool sha256Null = string.IsNullOrEmpty(rom.ReadString(Rom.SHA256Key));
- bool sha384Null = string.IsNullOrEmpty(rom.ReadString(Rom.SHA384Key));
- bool sha512Null = string.IsNullOrEmpty(rom.ReadString(Rom.SHA512Key));
- bool spamsumNull = string.IsNullOrEmpty(rom.ReadString(Rom.SpamSumKey));
+ bool crc16Null = string.IsNullOrEmpty(rom.CRC16);
+ bool crc32Null = string.IsNullOrEmpty(rom.CRC32);
+ bool crc64Null = string.IsNullOrEmpty(rom.CRC64);
+ bool md2Null = string.IsNullOrEmpty(rom.MD2);
+ bool md4Null = string.IsNullOrEmpty(rom.MD4);
+ bool md5Null = string.IsNullOrEmpty(rom.MD5);
+ bool ripeMD128Null = string.IsNullOrEmpty(rom.RIPEMD128);
+ bool ripeMD160Null = string.IsNullOrEmpty(rom.RIPEMD160);
+ bool sha1Null = string.IsNullOrEmpty(rom.SHA1);
+ bool sha256Null = string.IsNullOrEmpty(rom.SHA256);
+ bool sha384Null = string.IsNullOrEmpty(rom.SHA384);
+ bool sha512Null = string.IsNullOrEmpty(rom.SHA512);
+ bool spamsumNull = string.IsNullOrEmpty(rom.SpamSum);
return !crc16Null
- || !crcNull
+ || !crc32Null
|| !crc64Null
|| !md2Null
|| !md4Null
@@ -607,12 +376,12 @@ namespace SabreTools.Data.Extensions
///
/// Returns if all of the hashes are set to their 0-byte values or null
///
- private static bool HasZeroHash(this Disk disk)
+ public static bool HasZeroHash(this Disk disk)
{
- string? md5 = disk.ReadString(Disk.MD5Key);
+ string? md5 = disk.MD5;
bool md5Null = string.IsNullOrEmpty(md5) || string.Equals(md5, HashType.MD5.ZeroString, StringComparison.OrdinalIgnoreCase);
- string? sha1 = disk.ReadString(Disk.SHA1Key);
+ string? sha1 = disk.SHA1;
bool sha1Null = string.IsNullOrEmpty(sha1) || string.Equals(sha1, HashType.SHA1.ZeroString, StringComparison.OrdinalIgnoreCase);
return md5Null
@@ -622,18 +391,18 @@ namespace SabreTools.Data.Extensions
///
/// Returns if all of the hashes are set to their 0-byte values or null
///
- private static bool HasZeroHash(this Media media)
+ public static bool HasZeroHash(this Media media)
{
- string? md5 = media.ReadString(Media.MD5Key);
+ string? md5 = media.MD5;
bool md5Null = string.IsNullOrEmpty(md5) || string.Equals(md5, HashType.MD5.ZeroString, StringComparison.OrdinalIgnoreCase);
- string? sha1 = media.ReadString(Media.SHA1Key);
+ string? sha1 = media.SHA1;
bool sha1Null = string.IsNullOrEmpty(sha1) || string.Equals(sha1, HashType.SHA1.ZeroString, StringComparison.OrdinalIgnoreCase);
- string? sha256 = media.ReadString(Media.SHA256Key);
+ string? sha256 = media.SHA256;
bool sha256Null = string.IsNullOrEmpty(sha256) || string.Equals(sha256, HashType.SHA256.ZeroString, StringComparison.OrdinalIgnoreCase);
- string? spamsum = media.ReadString(Media.SpamSumKey);
+ string? spamsum = media.SpamSum;
bool spamsumNull = string.IsNullOrEmpty(spamsum) || string.Equals(spamsum, HashType.SpamSum.ZeroString, StringComparison.OrdinalIgnoreCase);
return md5Null
@@ -645,49 +414,49 @@ namespace SabreTools.Data.Extensions
///
/// Returns if all of the hashes are set to their 0-byte values or null
///
- private static bool HasZeroHash(this Rom rom)
+ public static bool HasZeroHash(this Rom rom)
{
- string? crc16 = rom.ReadString(Rom.CRC16Key);
+ string? crc16 = rom.CRC16;
bool crc16Null = string.IsNullOrEmpty(crc16) || string.Equals(crc16, HashType.CRC16.ZeroString, StringComparison.OrdinalIgnoreCase);
- string? crc = rom.ReadString(Rom.CRCKey);
- bool crcNull = string.IsNullOrEmpty(crc) || string.Equals(crc, HashType.CRC32.ZeroString, StringComparison.OrdinalIgnoreCase);
+ string? crc32 = rom.CRC32;
+ bool crc32Null = string.IsNullOrEmpty(crc32) || string.Equals(crc32, HashType.CRC32.ZeroString, StringComparison.OrdinalIgnoreCase);
- string? crc64 = rom.ReadString(Rom.CRC64Key);
+ string? crc64 = rom.CRC64;
bool crc64Null = string.IsNullOrEmpty(crc64) || string.Equals(crc64, HashType.CRC64.ZeroString, StringComparison.OrdinalIgnoreCase);
- string? md2 = rom.ReadString(Rom.MD2Key);
+ string? md2 = rom.MD2;
bool md2Null = string.IsNullOrEmpty(md2) || string.Equals(md2, HashType.MD2.ZeroString, StringComparison.OrdinalIgnoreCase);
- string? md4 = rom.ReadString(Rom.MD4Key);
+ string? md4 = rom.MD4;
bool md4Null = string.IsNullOrEmpty(md4) || string.Equals(md4, HashType.MD4.ZeroString, StringComparison.OrdinalIgnoreCase);
- string? md5 = rom.ReadString(Rom.MD5Key);
+ string? md5 = rom.MD5;
bool md5Null = string.IsNullOrEmpty(md5) || string.Equals(md5, HashType.MD5.ZeroString, StringComparison.OrdinalIgnoreCase);
- string? ripeMD128 = rom.ReadString(Rom.RIPEMD128Key);
+ string? ripeMD128 = rom.RIPEMD128;
bool ripeMD128Null = string.IsNullOrEmpty(value: ripeMD128) || string.Equals(ripeMD128, HashType.RIPEMD128.ZeroString, StringComparison.OrdinalIgnoreCase);
- string? ripeMD160 = rom.ReadString(Rom.RIPEMD160Key);
+ string? ripeMD160 = rom.RIPEMD160;
bool ripeMD160Null = string.IsNullOrEmpty(ripeMD160) || string.Equals(ripeMD160, HashType.RIPEMD160.ZeroString, StringComparison.OrdinalIgnoreCase);
- string? sha1 = rom.ReadString(Rom.SHA1Key);
+ string? sha1 = rom.SHA1;
bool sha1Null = string.IsNullOrEmpty(sha1) || string.Equals(sha1, HashType.SHA1.ZeroString, StringComparison.OrdinalIgnoreCase);
- string? sha256 = rom.ReadString(Rom.SHA256Key);
+ string? sha256 = rom.SHA256;
bool sha256Null = string.IsNullOrEmpty(sha256) || string.Equals(sha256, HashType.SHA256.ZeroString, StringComparison.OrdinalIgnoreCase);
- string? sha384 = rom.ReadString(Rom.SHA384Key);
+ string? sha384 = rom.SHA384;
bool sha384Null = string.IsNullOrEmpty(sha384) || string.Equals(sha384, HashType.SHA384.ZeroString, StringComparison.OrdinalIgnoreCase);
- string? sha512 = rom.ReadString(Rom.SHA512Key);
+ string? sha512 = rom.SHA512;
bool sha512Null = string.IsNullOrEmpty(sha512) || string.Equals(sha512, HashType.SHA512.ZeroString, StringComparison.OrdinalIgnoreCase);
- string? spamsum = rom.ReadString(Rom.SpamSumKey);
+ string? spamsum = rom.SpamSum;
bool spamsumNull = string.IsNullOrEmpty(spamsum) || string.Equals(spamsum, HashType.SpamSum.ZeroString, StringComparison.OrdinalIgnoreCase);
return crc16Null
- && crcNull
+ && crc32Null
&& crc64Null
&& md2Null
&& md4Null
@@ -701,175 +470,253 @@ namespace SabreTools.Data.Extensions
&& spamsumNull;
}
+ ///
+ /// Returns if there are no, non-empty hashes in common
+ ///
+ private static bool HasCommonHash(this Disk self, Disk other)
+ {
+ bool md5Null = string.IsNullOrEmpty(self.MD5);
+ md5Null ^= string.IsNullOrEmpty(other.MD5);
+
+ bool sha1Null = string.IsNullOrEmpty(self.SHA1);
+ sha1Null ^= string.IsNullOrEmpty(other.SHA1);
+
+ return !md5Null
+ || !sha1Null;
+ }
+
+ ///
+ /// Returns if there are no, non-empty hashes in common
+ ///
+ private static bool HasCommonHash(this Media self, Media other)
+ {
+ bool md5Null = string.IsNullOrEmpty(self.MD5);
+ md5Null ^= string.IsNullOrEmpty(other.MD5);
+
+ bool sha1Null = string.IsNullOrEmpty(self.SHA1);
+ sha1Null ^= string.IsNullOrEmpty(other.SHA1);
+
+ bool sha256Null = string.IsNullOrEmpty(self.SHA256);
+ sha256Null ^= string.IsNullOrEmpty(other.SHA256);
+
+ bool spamsumNull = string.IsNullOrEmpty(self.SpamSum);
+ spamsumNull ^= string.IsNullOrEmpty(other.SpamSum);
+
+ return !md5Null
+ || !sha1Null
+ || !sha256Null
+ || !spamsumNull;
+ }
+
+ ///
+ /// Returns if there are no, non-empty hashes in common
+ ///
+ private static bool HasCommonHash(this Rom self, Rom other)
+ {
+ bool crc16Null = string.IsNullOrEmpty(self.CRC16);
+ crc16Null ^= string.IsNullOrEmpty(other.CRC16);
+
+ bool crc32Null = string.IsNullOrEmpty(self.CRC32);
+ crc32Null ^= string.IsNullOrEmpty(other.CRC32);
+
+ bool crc64Null = string.IsNullOrEmpty(self.CRC64);
+ crc64Null ^= string.IsNullOrEmpty(other.CRC64);
+
+ bool md2Null = string.IsNullOrEmpty(self.MD2);
+ md2Null ^= string.IsNullOrEmpty(other.MD2);
+
+ bool md4Null = string.IsNullOrEmpty(self.MD4);
+ md4Null ^= string.IsNullOrEmpty(other.MD4);
+
+ bool md5Null = string.IsNullOrEmpty(self.MD5);
+ md5Null ^= string.IsNullOrEmpty(other.MD5);
+
+ bool ripeMD128Null = string.IsNullOrEmpty(self.RIPEMD128);
+ ripeMD128Null ^= string.IsNullOrEmpty(other.RIPEMD128);
+
+ bool ripeMD160Null = string.IsNullOrEmpty(self.RIPEMD160);
+ ripeMD160Null ^= string.IsNullOrEmpty(other.RIPEMD160);
+
+ bool sha1Null = string.IsNullOrEmpty(self.SHA1);
+ sha1Null ^= string.IsNullOrEmpty(other.SHA1);
+
+ bool sha256Null = string.IsNullOrEmpty(self.SHA256);
+ sha256Null ^= string.IsNullOrEmpty(other.SHA256);
+
+ bool sha384Null = string.IsNullOrEmpty(self.SHA384);
+ sha384Null ^= string.IsNullOrEmpty(other.SHA384);
+
+ bool sha512Null = string.IsNullOrEmpty(self.SHA512);
+ sha512Null ^= string.IsNullOrEmpty(other.SHA512);
+
+ bool spamsumNull = string.IsNullOrEmpty(self.SpamSum);
+ spamsumNull ^= string.IsNullOrEmpty(other.SpamSum);
+
+ return !crc16Null
+ || !crc32Null
+ || !crc64Null
+ || !md2Null
+ || !md4Null
+ || !md5Null
+ || !ripeMD128Null
+ || !ripeMD160Null
+ || !sha1Null
+ || !sha256Null
+ || !sha384Null
+ || !sha512Null
+ || !spamsumNull;
+ }
+
#endregion
#region Information Filling
- ///
- /// Fill any missing size and hash information from another DictionaryBase
- ///
- public static void FillMissingHashes(this DictionaryBase? self, DictionaryBase? other)
- {
- if (self is null || other is null)
- return;
-
-#if NETCOREAPP || NETSTANDARD2_0_OR_GREATER
- switch (self, other)
- {
- case (Disk diskSelf, Disk diskOther):
- diskSelf.FillMissingHashes(diskOther);
- break;
- case (Media mediaSelf, Media mediaOther):
- mediaSelf.FillMissingHashes(mediaOther);
- break;
- case (Rom romSelf, Rom romOther):
- romSelf.FillMissingHashes(romOther);
- break;
-
- default:
- break;
- }
-#else
- if (self is Disk diskSelf && other is Disk diskOther)
- diskSelf.FillMissingHashes(diskOther);
- else if (self is Media mediaSelf && other is Media mediaOther)
- mediaSelf.FillMissingHashes(mediaOther);
- else if (self is Rom romSelf && other is Rom romOther)
- romSelf.FillMissingHashes(romOther);
-#endif
- }
-
///
/// Fill any missing size and hash information from another Disk
///
- private static void FillMissingHashes(this Disk? self, Disk? other)
+ public static void FillMissingHashes(this Disk? self, Disk? other)
{
if (self is null || other is null)
return;
- string? selfMd5 = self.ReadString(Disk.MD5Key);
- string? otherMd5 = other.ReadString(Disk.MD5Key);
+ string? selfMd5 = self.MD5;
+ string? otherMd5 = other.MD5;
if (string.IsNullOrEmpty(selfMd5) && !string.IsNullOrEmpty(otherMd5))
- self[Disk.MD5Key] = otherMd5;
+ self.MD5 = otherMd5;
- string? selfSha1 = self.ReadString(Disk.SHA1Key);
- string? otherSha1 = other.ReadString(Disk.SHA1Key);
+ string? selfSha1 = self.SHA1;
+ string? otherSha1 = other.SHA1;
if (string.IsNullOrEmpty(selfSha1) && !string.IsNullOrEmpty(otherSha1))
- self[Disk.SHA1Key] = otherSha1;
+ self.SHA1 = otherSha1;
}
///
/// Fill any missing size and hash information from another Media
///
- private static void FillMissingHashes(this Media? self, Media? other)
+ public static void FillMissingHashes(this Media? self, Media? other)
{
if (self is null || other is null)
return;
- string? selfMd5 = self.ReadString(Media.MD5Key);
- string? otherMd5 = other.ReadString(Media.MD5Key);
+ string? selfMd5 = self.MD5;
+ string? otherMd5 = other.MD5;
if (string.IsNullOrEmpty(selfMd5) && !string.IsNullOrEmpty(otherMd5))
- self[Media.MD5Key] = otherMd5;
+ self.MD5 = otherMd5;
- string? selfSha1 = self.ReadString(Media.SHA1Key);
- string? otherSha1 = other.ReadString(Media.SHA1Key);
+ string? selfSha1 = self.SHA1;
+ string? otherSha1 = other.SHA1;
if (string.IsNullOrEmpty(selfSha1) && !string.IsNullOrEmpty(otherSha1))
- self[Media.SHA1Key] = otherSha1;
+ self.SHA1 = otherSha1;
- string? selfSha256 = self.ReadString(Media.SHA256Key);
- string? otherSha256 = other.ReadString(Media.SHA256Key);
+ string? selfSha256 = self.SHA256;
+ string? otherSha256 = other.SHA256;
if (string.IsNullOrEmpty(selfSha256) && !string.IsNullOrEmpty(otherSha256))
- self[Media.SHA256Key] = otherSha256;
+ self.SHA256 = otherSha256;
- string? selfSpamSum = self.ReadString(Media.SpamSumKey);
- string? otherSpamSum = other.ReadString(Media.SpamSumKey);
+ string? selfSpamSum = self.SpamSum;
+ string? otherSpamSum = other.SpamSum;
if (string.IsNullOrEmpty(selfSpamSum) && !string.IsNullOrEmpty(otherSpamSum))
- self[Media.SpamSumKey] = otherSpamSum;
+ self.SpamSum = otherSpamSum;
}
///
/// Fill any missing size and hash information from another Rom
///
- private static void FillMissingHashes(this Rom? self, Rom? other)
+ public static void FillMissingHashes(this Rom? self, Rom? other)
{
if (self is null || other is null)
return;
- long? selfSize = self.ReadLong(Rom.SizeKey);
- long? otherSize = other.ReadLong(Rom.SizeKey);
+ long? selfSize = self.Size;
+ long? otherSize = other.Size;
if (selfSize is null && otherSize is not null)
- self[Rom.SizeKey] = otherSize;
+ self.Size = otherSize;
- string? selfCrc16 = self.ReadString(Rom.CRC16Key);
- string? otherCrc16 = other.ReadString(Rom.CRC16Key);
+ string? selfCrc16 = self.CRC16;
+ string? otherCrc16 = other.CRC16;
if (string.IsNullOrEmpty(selfCrc16) && !string.IsNullOrEmpty(otherCrc16))
- self[Rom.CRC16Key] = otherCrc16;
+ self.CRC16 = otherCrc16;
- string? selfCrc = self.ReadString(Rom.CRCKey);
- string? otherCrc = other.ReadString(Rom.CRCKey);
+ string? selfCrc = self.CRC32;
+ string? otherCrc = other.CRC32;
if (string.IsNullOrEmpty(selfCrc) && !string.IsNullOrEmpty(otherCrc))
- self[Rom.CRCKey] = otherCrc;
+ self.CRC32 = otherCrc;
- string? selfCrc64 = self.ReadString(Rom.CRC64Key);
- string? otherCrc64 = other.ReadString(Rom.CRC64Key);
+ string? selfCrc64 = self.CRC64;
+ string? otherCrc64 = other.CRC64;
if (string.IsNullOrEmpty(selfCrc64) && !string.IsNullOrEmpty(otherCrc64))
- self[Rom.CRC64Key] = otherCrc64;
+ self.CRC64 = otherCrc64;
- string? selfMd2 = self.ReadString(Rom.MD2Key);
- string? otherMd2 = other.ReadString(Rom.MD2Key);
+ string? selfMd2 = self.MD2;
+ string? otherMd2 = other.MD2;
if (string.IsNullOrEmpty(selfMd2) && !string.IsNullOrEmpty(otherMd2))
- self[Rom.MD2Key] = otherMd2;
+ self.MD2 = otherMd2;
- string? selfMd4 = self.ReadString(Rom.MD4Key);
- string? otherMd4 = other.ReadString(Rom.MD4Key);
+ string? selfMd4 = self.MD4;
+ string? otherMd4 = other.MD4;
if (string.IsNullOrEmpty(selfMd4) && !string.IsNullOrEmpty(otherMd4))
- self[Rom.MD4Key] = otherMd4;
+ self.MD4 = otherMd4;
- string? selfMd5 = self.ReadString(Rom.MD5Key);
- string? otherMd5 = other.ReadString(Rom.MD5Key);
+ string? selfMd5 = self.MD5;
+ string? otherMd5 = other.MD5;
if (string.IsNullOrEmpty(selfMd5) && !string.IsNullOrEmpty(otherMd5))
- self[Rom.MD5Key] = otherMd5;
+ self.MD5 = otherMd5;
- string? selfRipeMD128 = self.ReadString(Rom.RIPEMD128Key);
- string? otherRipeMD128 = other.ReadString(Rom.RIPEMD128Key);
+ string? selfRipeMD128 = self.RIPEMD128;
+ string? otherRipeMD128 = other.RIPEMD128;
if (string.IsNullOrEmpty(selfRipeMD128) && !string.IsNullOrEmpty(otherRipeMD128))
- self[Rom.RIPEMD128Key] = otherRipeMD128;
+ self.RIPEMD128 = otherRipeMD128;
- string? selfRipeMD160 = self.ReadString(Rom.RIPEMD160Key);
- string? otherRipeMD160 = other.ReadString(Rom.RIPEMD160Key);
+ string? selfRipeMD160 = self.RIPEMD160;
+ string? otherRipeMD160 = other.RIPEMD160;
if (string.IsNullOrEmpty(selfRipeMD160) && !string.IsNullOrEmpty(otherRipeMD160))
- self[Rom.RIPEMD160Key] = otherRipeMD160;
+ self.RIPEMD160 = otherRipeMD160;
- string? selfSha1 = self.ReadString(Rom.SHA1Key);
- string? otherSha1 = other.ReadString(Rom.SHA1Key);
+ string? selfSha1 = self.SHA1;
+ string? otherSha1 = other.SHA1;
if (string.IsNullOrEmpty(selfSha1) && !string.IsNullOrEmpty(otherSha1))
- self[Rom.SHA1Key] = otherSha1;
+ self.SHA1 = otherSha1;
- string? selfSha256 = self.ReadString(Rom.SHA256Key);
- string? otherSha256 = other.ReadString(Rom.SHA256Key);
+ string? selfSha256 = self.SHA256;
+ string? otherSha256 = other.SHA256;
if (string.IsNullOrEmpty(selfSha256) && !string.IsNullOrEmpty(otherSha256))
- self[Rom.SHA256Key] = otherSha256;
+ self.SHA256 = otherSha256;
- string? selfSha384 = self.ReadString(Rom.SHA384Key);
- string? otherSha384 = other.ReadString(Rom.SHA384Key);
+ string? selfSha384 = self.SHA384;
+ string? otherSha384 = other.SHA384;
if (string.IsNullOrEmpty(selfSha384) && !string.IsNullOrEmpty(otherSha384))
- self[Rom.SHA384Key] = otherSha384;
+ self.SHA384 = otherSha384;
- string? selfSha512 = self.ReadString(Rom.SHA512Key);
- string? otherSha512 = other.ReadString(Rom.SHA512Key);
+ string? selfSha512 = self.SHA512;
+ string? otherSha512 = other.SHA512;
if (string.IsNullOrEmpty(selfSha512) && !string.IsNullOrEmpty(otherSha512))
- self[Rom.SHA512Key] = otherSha512;
+ self.SHA512 = otherSha512;
- string? selfSpamSum = self.ReadString(Rom.SpamSumKey);
- string? otherSpamSum = other.ReadString(Rom.SpamSumKey);
+ string? selfSpamSum = self.SpamSum;
+ string? otherSpamSum = other.SpamSum;
if (string.IsNullOrEmpty(selfSpamSum) && !string.IsNullOrEmpty(otherSpamSum))
- self[Rom.SpamSumKey] = otherSpamSum;
+ self.SpamSum = otherSpamSum;
}
#endregion
#region String to Enum
+ ///
+ /// Get the enum value for an input string, if possible
+ ///
+ /// String value to parse/param>
+ /// Enum value representing the input, null on error
+ public static Blit? AsBlit(this string? value)
+ {
+ return value?.ToLowerInvariant() switch
+ {
+ "plain" => Blit.Plain,
+ "dirty" => Blit.Dirty,
+ _ => null,
+ };
+ }
+
///
/// Get the enum value for an input string, if possible
///
@@ -1036,10 +883,73 @@ namespace SabreTools.Data.Extensions
"baddump" => ItemStatus.BadDump,
"nodump" or "yes" => ItemStatus.Nodump,
"verified" => ItemStatus.Verified,
+ "deduped" => ItemStatus.Deduped,
_ => null,
};
}
+ ///
+ /// Get the enum value for an input string, if possible
+ ///
+ /// String value to parse/param>
+ /// Enum value representing the input, default on error
+ public static ItemType AsItemType(this string? value)
+ {
+ return value?.ToLowerInvariant() switch
+ {
+ // "Actionable" item types
+ "rom" => ItemType.Rom,
+ "disk" => ItemType.Disk,
+ "file" => ItemType.File,
+ "media" => ItemType.Media,
+
+ // "Auxiliary" item types
+ "adjuster" => ItemType.Adjuster,
+ "analog" => ItemType.Analog,
+ "archive" => ItemType.Archive,
+ "biosset" => ItemType.BiosSet,
+ "chip" => ItemType.Chip,
+ "condition" => ItemType.Condition,
+ "configuration" => ItemType.Configuration,
+ "conflocation" => ItemType.ConfLocation,
+ "confsetting" => ItemType.ConfSetting,
+ "control" => ItemType.Control,
+ "dataarea" => ItemType.DataArea,
+ "device" => ItemType.Device,
+ "device_ref" or "deviceref" => ItemType.DeviceRef,
+ "diplocation" => ItemType.DipLocation,
+ "dipswitch" => ItemType.DipSwitch,
+ "dipvalue" => ItemType.DipValue,
+ "diskarea" => ItemType.DiskArea,
+ "display" => ItemType.Display,
+ "driver" => ItemType.Driver,
+ "dump" => ItemType.Dump,
+ "extension" => ItemType.Extension,
+ "feature" => ItemType.Feature,
+ "info" => ItemType.Info,
+ "input" => ItemType.Input,
+ "instance" => ItemType.Instance,
+ "original" => ItemType.Original,
+ "part" => ItemType.Part,
+ "part_feature" or "partfeature" => ItemType.PartFeature,
+ "port" => ItemType.Port,
+ "ramoption" or "ram_option" => ItemType.RamOption,
+ "release" => ItemType.Release,
+ "release_details" or "releasedetails" => ItemType.ReleaseDetails,
+ "sample" => ItemType.Sample,
+ "serials" => ItemType.Serials,
+ "sharedfeat" or "shared_feat" or "sharedfeature" or "shared_feature" => ItemType.SharedFeat,
+ "slot" => ItemType.Slot,
+ "slotoption" or "slot_option" => ItemType.SlotOption,
+ "softwarelist" or "software_list" => ItemType.SoftwareList,
+ "sound" => ItemType.Sound,
+ "source_details" or "sourcedetails" => ItemType.SourceDetails,
+ "video" => ItemType.Video,
+ "blank" => ItemType.Blank,
+ _ => ItemType.NULL,
+ };
+ }
+
///
/// Get the enum value for an input string, if possible
///
@@ -1158,6 +1068,23 @@ namespace SabreTools.Data.Extensions
};
}
+ ///
+ /// Get the enum value for an input string, if possible
+ ///
+ /// String value to parse/param>
+ /// Enum value representing the input, null on error
+ public static Rotation? AsRotation(this string? value)
+ {
+ return value?.ToLowerInvariant() switch
+ {
+ "0" or "north" or "vertical" => Rotation.North,
+ "90" or "east" or "horizontal" => Rotation.East,
+ "180" or "south" => Rotation.South,
+ "270" or "west" => Rotation.West,
+ _ => null,
+ };
+ }
+
///
/// Get the enum value for an input string, if possible
///
@@ -1222,6 +1149,23 @@ namespace SabreTools.Data.Extensions
};
}
+ ///
+ /// Get the enum value for an input string, if possible
+ ///
+ /// String value to parse/param>
+ /// Enum value representing the input, null on error
+ public static Width? AsWidth(this string? value)
+ {
+ return value?.ToLowerInvariant() switch
+ {
+ "8" or "byte" => Width.Byte,
+ "16" or "short" => Width.Short,
+ "32" or "int" => Width.Int,
+ "64" or "long" => Width.Long,
+ _ => null,
+ };
+ }
+
///
/// Get bool? value from input string
///
@@ -1231,8 +1175,8 @@ namespace SabreTools.Data.Extensions
{
return yesno?.ToLowerInvariant() switch
{
- "yes" or "true" => true,
- "no" or "false" => false,
+ "1" or "yes" or "true" => true,
+ "0" or "no" or "false" => false,
_ => null,
};
}
@@ -1241,6 +1185,21 @@ namespace SabreTools.Data.Extensions
#region Enum to String
+ ///
+ /// Get the string value for an input enum, if possible
+ ///
+ /// Enum value to parse/param>
+ /// String value representing the input, null on error
+ public static string? AsStringValue(this Blit value)
+ {
+ return value switch
+ {
+ Blit.Plain => "plain",
+ Blit.Dirty => "dirty",
+ _ => null,
+ };
+ }
+
///
/// Get the string value for an input enum, if possible
///
@@ -1408,6 +1367,71 @@ namespace SabreTools.Data.Extensions
ItemStatus.BadDump => "baddump",
ItemStatus.Nodump => useSecond ? "yes" : "nodump",
ItemStatus.Verified => "verified",
+ ItemStatus.Deduped => "deduped",
+ _ => null,
+ };
+ }
+
+ ///
+ /// Get the string value for an input enum, if possible
+ ///
+ /// Enum value to parse/param>
+ /// String value representing the input, default on error
+ public static string? AsStringValue(this ItemType value)
+ {
+ return value switch
+ {
+ // "Actionable" item types
+ ItemType.Rom => "rom",
+ ItemType.Disk => "disk",
+ ItemType.File => "file",
+ ItemType.Media => "media",
+
+ // "Auxiliary" item types
+ ItemType.Adjuster => "adjuster",
+ ItemType.Analog => "analog",
+ ItemType.Archive => "archive",
+ ItemType.BiosSet => "biosset",
+ ItemType.Chip => "chip",
+ ItemType.Condition => "condition",
+ ItemType.Configuration => "configuration",
+ ItemType.ConfLocation => "conflocation",
+ ItemType.ConfSetting => "confsetting",
+ ItemType.Control => "control",
+ ItemType.DataArea => "dataarea",
+ ItemType.Device => "device",
+ ItemType.DeviceRef => "device_ref",
+ ItemType.DipLocation => "diplocation",
+ ItemType.DipSwitch => "dipswitch",
+ ItemType.DipValue => "dipvalue",
+ ItemType.DiskArea => "diskarea",
+ ItemType.Display => "display",
+ ItemType.Driver => "driver",
+ ItemType.Dump => "dump",
+ ItemType.Extension => "extension",
+ ItemType.Feature => "feature",
+ ItemType.Info => "info",
+ ItemType.Input => "input",
+ ItemType.Instance => "instance",
+ ItemType.Original => "original",
+ ItemType.Part => "part",
+ ItemType.PartFeature => "part_feature",
+ ItemType.Port => "port",
+ ItemType.RamOption => "ramoption",
+ ItemType.Release => "release",
+ ItemType.ReleaseDetails => "release_details",
+ ItemType.Sample => "sample",
+ ItemType.Serials => "serials",
+ ItemType.SharedFeat => "sharedfeat",
+ ItemType.Slot => "slot",
+ ItemType.SlotOption => "slotoption",
+ ItemType.SoftwareList => "softwarelist",
+ ItemType.Sound => "sound",
+ ItemType.SourceDetails => "source_details",
+ ItemType.Video => "video",
+ ItemType.Blank => "blank",
+
+ ItemType.NULL => null,
_ => null,
};
}
@@ -1532,6 +1556,23 @@ namespace SabreTools.Data.Extensions
};
}
+ ///
+ /// Get the string value for an input enum, if possible
+ ///
+ /// Enum value to parse/param>
+ /// String value representing the input, null on error
+ public static string? AsStringValue(this Rotation value, bool useSecond = false)
+ {
+ return value switch
+ {
+ Rotation.North => useSecond ? "vertical" : "0",
+ Rotation.East => useSecond ? "horizontal" : "90",
+ Rotation.South => useSecond ? "vertical" : "180",
+ Rotation.West => useSecond ? "horizontal" : "270",
+ _ => null,
+ };
+ }
+
///
/// Get the string value for an input enum, if possible
///
@@ -1581,6 +1622,23 @@ namespace SabreTools.Data.Extensions
};
}
+ ///
+ /// Get the string value for an input enum, if possible
+ ///
+ /// Enum value to parse/param>
+ /// String value representing the input, null on error
+ public static string? AsStringValue(this Width value)
+ {
+ return value switch
+ {
+ Width.Byte => "8",
+ Width.Short => "16",
+ Width.Int => "32",
+ Width.Long => "64",
+ _ => null,
+ };
+ }
+
///
/// Get the string value for an input enum, if possible
///
@@ -1593,6 +1651,7 @@ namespace SabreTools.Data.Extensions
SupportStatus.Good => "good",
SupportStatus.Imperfect => "imperfect",
SupportStatus.Preliminary => "preliminary",
+ SupportStatus.Test => "test",
_ => null,
};
}
diff --git a/SabreTools.Data.Models/ArchiveDotOrg/File.cs b/SabreTools.Data.Models/ArchiveDotOrg/File.cs
index adb129c2..d1f52fbb 100644
--- a/SabreTools.Data.Models/ArchiveDotOrg/File.cs
+++ b/SabreTools.Data.Models/ArchiveDotOrg/File.cs
@@ -33,7 +33,7 @@ namespace SabreTools.Data.Models.ArchiveDotOrg
public string? SHA1 { get; set; }
[XmlElement("filecount")]
- public string? FileCount { get; set; }
+ public long? FileCount { get; set; }
/// Is this a set of defined values?
[XmlElement("format")]
diff --git a/SabreTools.Data.Models/AttractMode/Row.cs b/SabreTools.Data.Models/AttractMode/Row.cs
index 06867ab5..6f4c648e 100644
--- a/SabreTools.Data.Models/AttractMode/Row.cs
+++ b/SabreTools.Data.Models/AttractMode/Row.cs
@@ -46,6 +46,6 @@ namespace SabreTools.Data.Models.AttractMode
public string? PlayedTime { get; set; }
- public string? FileIsAvailable { get; set; }
+ public bool? FileIsAvailable { get; set; }
}
}
diff --git a/SabreTools.Data.Models/ClrMamePro/BiosSet.cs b/SabreTools.Data.Models/ClrMamePro/BiosSet.cs
index 77895d53..a6d069ea 100644
--- a/SabreTools.Data.Models/ClrMamePro/BiosSet.cs
+++ b/SabreTools.Data.Models/ClrMamePro/BiosSet.cs
@@ -3,15 +3,15 @@ namespace SabreTools.Data.Models.ClrMamePro
/// biosset
public class BiosSet
{
- /// name
+ /// "name"
[Required]
public string? Name { get; set; }
- /// description
+ /// "description"
[Required]
public string? Description { get; set; }
- /// default
- public string? Default { get; set; }
+ /// "default", (yes|no) "no"
+ public bool? Default { get; set; }
}
}
diff --git a/SabreTools.Data.Models/ClrMamePro/Chip.cs b/SabreTools.Data.Models/ClrMamePro/Chip.cs
index 5d9fd30b..282e53fe 100644
--- a/SabreTools.Data.Models/ClrMamePro/Chip.cs
+++ b/SabreTools.Data.Models/ClrMamePro/Chip.cs
@@ -1,4 +1,6 @@
+using SabreTools.Data.Models.Metadata;
+
namespace SabreTools.Data.Models.ClrMamePro
{
/// chip
@@ -6,7 +8,7 @@ namespace SabreTools.Data.Models.ClrMamePro
{
/// type, (cpu|audio)
[Required]
- public string? Type { get; set; }
+ public ChipType? Type { get; set; }
/// name
[Required]
@@ -15,7 +17,7 @@ namespace SabreTools.Data.Models.ClrMamePro
/// flags
public string? Flags { get; set; }
- /// clock, Numeric?
- public string? Clock { get; set; }
+ /// clock
+ public long? Clock { get; set; }
}
}
diff --git a/SabreTools.Data.Models/ClrMamePro/ClrMamePro.cs b/SabreTools.Data.Models/ClrMamePro/ClrMamePro.cs
index 4cc061bd..772d6664 100644
--- a/SabreTools.Data.Models/ClrMamePro/ClrMamePro.cs
+++ b/SabreTools.Data.Models/ClrMamePro/ClrMamePro.cs
@@ -1,3 +1,5 @@
+using SabreTools.Data.Models.Metadata;
+
namespace SabreTools.Data.Models.ClrMamePro
{
/// clrmamepro
@@ -40,12 +42,12 @@ namespace SabreTools.Data.Models.ClrMamePro
public string? Type { get; set; }
/// forcemerging
- public string? ForceMerging { get; set; }
+ public MergingFlag ForceMerging { get; set; }
- /// forcezipping
- public string? ForceZipping { get; set; }
+ /// forcezipping, (yes|no) "no"
+ public bool? ForceZipping { get; set; }
/// forcepacking
- public string? ForcePacking { get; set; }
+ public PackingFlag ForcePacking { get; set; }
}
}
diff --git a/SabreTools.Data.Models/ClrMamePro/DipSwitch.cs b/SabreTools.Data.Models/ClrMamePro/DipSwitch.cs
index 63370948..49a970ff 100644
--- a/SabreTools.Data.Models/ClrMamePro/DipSwitch.cs
+++ b/SabreTools.Data.Models/ClrMamePro/DipSwitch.cs
@@ -4,14 +4,14 @@ namespace SabreTools.Data.Models.ClrMamePro
/// dipswitch
public class DipSwitch
{
- /// name
+ /// "name"
[Required]
public string? Name { get; set; }
- /// entry
+ /// "entry"
public string[]? Entry { get; set; }
- /// default, (yes|no) "no"
- public string? Default { get; set; }
+ /// "default", (yes|no) "no"
+ public bool? Default { get; set; }
}
}
diff --git a/SabreTools.Data.Models/ClrMamePro/Disk.cs b/SabreTools.Data.Models/ClrMamePro/Disk.cs
index af2493ba..34d9d4b9 100644
--- a/SabreTools.Data.Models/ClrMamePro/Disk.cs
+++ b/SabreTools.Data.Models/ClrMamePro/Disk.cs
@@ -1,4 +1,6 @@
+using SabreTools.Data.Models.Metadata;
+
namespace SabreTools.Data.Models.ClrMamePro
{
/// disk
@@ -18,7 +20,7 @@ namespace SabreTools.Data.Models.ClrMamePro
public string? Merge { get; set; }
/// status
- public string? Status { get; set; }
+ public ItemStatus? Status { get; set; }
/// flags
public string? Flags { get; set; }
diff --git a/SabreTools.Data.Models/ClrMamePro/Driver.cs b/SabreTools.Data.Models/ClrMamePro/Driver.cs
index cddc19b9..07abe4a2 100644
--- a/SabreTools.Data.Models/ClrMamePro/Driver.cs
+++ b/SabreTools.Data.Models/ClrMamePro/Driver.cs
@@ -1,4 +1,6 @@
+using SabreTools.Data.Models.Metadata;
+
namespace SabreTools.Data.Models.ClrMamePro
{
/// driver
@@ -6,18 +8,18 @@ namespace SabreTools.Data.Models.ClrMamePro
{
/// status, (good|imperfect|preliminary)
[Required]
- public string? Status { get; set; }
+ public SupportStatus? Status { get; set; }
/// color, (good|imperfect|preliminary)
- public string? Color { get; set; }
+ public SupportStatus? Color { get; set; }
/// sound, (good|imperfect|preliminary)
- public string? Sound { get; set; }
+ public SupportStatus? Sound { get; set; }
/// palettesize, Numeric?
public string? PaletteSize { get; set; }
/// blit, (plain|dirty)
- public string? Blit { get; set; }
+ public Blit? Blit { get; set; }
}
}
diff --git a/SabreTools.Data.Models/ClrMamePro/Input.cs b/SabreTools.Data.Models/ClrMamePro/Input.cs
index 3a413113..94217a4c 100644
--- a/SabreTools.Data.Models/ClrMamePro/Input.cs
+++ b/SabreTools.Data.Models/ClrMamePro/Input.cs
@@ -4,24 +4,24 @@ namespace SabreTools.Data.Models.ClrMamePro
/// input
public class Input
{
- /// players, Numeric/remarks>
+ /// "players"/remarks>
[Required]
- public string? Players { get; set; }
+ public long? Players { get; set; }
- /// control
+ /// "control"
public string? Control { get; set; }
- /// buttons, Numeric
+ /// "buttons"
[Required]
- public string? Buttons { get; set; }
+ public long? Buttons { get; set; }
- /// coins, Numeric
- public string? Coins { get; set; }
+ /// "coins"
+ public long? Coins { get; set; }
- /// tilt, (yes|no) "no"
- public string? Tilt { get; set; }
+ /// "tilt", (yes|no) "no"
+ public bool? Tilt { get; set; }
- /// service, (yes|no) "no"
- public string? Service { get; set; }
+ /// "service", (yes|no) "no"
+ public bool? Service { get; set; }
}
}
diff --git a/SabreTools.Data.Models/ClrMamePro/Release.cs b/SabreTools.Data.Models/ClrMamePro/Release.cs
index 7ed56e6d..afb313d8 100644
--- a/SabreTools.Data.Models/ClrMamePro/Release.cs
+++ b/SabreTools.Data.Models/ClrMamePro/Release.cs
@@ -4,21 +4,21 @@ namespace SabreTools.Data.Models.ClrMamePro
/// release
public class Release
{
- /// name
+ /// "name"
[Required]
public string? Name { get; set; }
- /// region
+ /// "region"
[Required]
public string? Region { get; set; }
- /// language
+ /// "language"
public string? Language { get; set; }
- /// date
+ /// "date"
public string? Date { get; set; }
- /// default
- public string? Default { get; set; }
+ /// "default", (yes|no) "no"
+ public bool? Default { get; set; }
}
}
diff --git a/SabreTools.Data.Models/ClrMamePro/Rom.cs b/SabreTools.Data.Models/ClrMamePro/Rom.cs
index 4034798e..329fa18e 100644
--- a/SabreTools.Data.Models/ClrMamePro/Rom.cs
+++ b/SabreTools.Data.Models/ClrMamePro/Rom.cs
@@ -1,5 +1,7 @@
#pragma warning disable IDE1006 // Naming Styles
+using SabreTools.Data.Models.Metadata;
+
namespace SabreTools.Data.Models.ClrMamePro
{
/// rom
@@ -11,7 +13,7 @@ namespace SabreTools.Data.Models.ClrMamePro
/// size, Numeric
[Required]
- public string? Size { get; set; }
+ public long? Size { get; set; }
/// crc
public string? CRC { get; set; }
@@ -26,7 +28,7 @@ namespace SabreTools.Data.Models.ClrMamePro
public string? Merge { get; set; }
/// status
- public string? Status { get; set; }
+ public ItemStatus? Status { get; set; }
/// flags
public string? Flags { get; set; }
@@ -101,10 +103,10 @@ namespace SabreTools.Data.Models.ClrMamePro
#region RomVault Extensions
/// inverted; Boolean; Appears after Date
- public string? Inverted { get; set; }
+ public bool? Inverted { get; set; }
/// mia; Boolean; Appears after Inverted
- public string? MIA { get; set; }
+ public bool? MIA { get; set; }
#endregion
}
diff --git a/SabreTools.Data.Models/ClrMamePro/Sound.cs b/SabreTools.Data.Models/ClrMamePro/Sound.cs
index 4af5f9ce..1ffa6fc0 100644
--- a/SabreTools.Data.Models/ClrMamePro/Sound.cs
+++ b/SabreTools.Data.Models/ClrMamePro/Sound.cs
@@ -6,6 +6,6 @@ namespace SabreTools.Data.Models.ClrMamePro
{
/// channels, Numeric?
[Required]
- public string? Channels { get; set; }
+ public long? Channels { get; set; }
}
}
diff --git a/SabreTools.Data.Models/ClrMamePro/Video.cs b/SabreTools.Data.Models/ClrMamePro/Video.cs
index e8c801ca..0c53a151 100644
--- a/SabreTools.Data.Models/ClrMamePro/Video.cs
+++ b/SabreTools.Data.Models/ClrMamePro/Video.cs
@@ -1,4 +1,6 @@
+using SabreTools.Data.Models.Metadata;
+
namespace SabreTools.Data.Models.ClrMamePro
{
/// video
@@ -6,25 +8,25 @@ namespace SabreTools.Data.Models.ClrMamePro
{
/// screen, (raster|vector)
[Required]
- public string? Screen { get; set; }
+ public DisplayType? Screen { get; set; }
/// orientation, (vertical|horizontal)
[Required]
- public string? Orientation { get; set; }
+ public Rotation? Orientation { get; set; }
- /// x, Numeric?
- public string? X { get; set; }
+ /// x
+ public long? X { get; set; }
- /// y, Numeric?
- public string? Y { get; set; }
+ /// y
+ public long? Y { get; set; }
- /// aspectx, Numeric?
- public string? AspectX { get; set; }
+ /// aspectx
+ public long? AspectX { get; set; }
- /// aspecty, Numeric?
- public string? AspectY { get; set; }
+ /// aspecty
+ public long? AspectY { get; set; }
- /// freq, Numeric?
- public string? Freq { get; set; }
+ /// freq
+ public double? Freq { get; set; }
}
}
diff --git a/SabreTools.Data.Models/DosCenter/File.cs b/SabreTools.Data.Models/DosCenter/File.cs
index 7766ead6..99b30442 100644
--- a/SabreTools.Data.Models/DosCenter/File.cs
+++ b/SabreTools.Data.Models/DosCenter/File.cs
@@ -10,7 +10,7 @@ namespace SabreTools.Data.Models.DosCenter
/// size, attribute, numeric
[Required]
- public string? Size { get; set; }
+ public long? Size { get; set; }
/// crc, attribute
[Required]
diff --git a/SabreTools.Data.Models/EverdriveSMDB/Row.cs b/SabreTools.Data.Models/EverdriveSMDB/Row.cs
index ddc19765..d81cc3fb 100644
--- a/SabreTools.Data.Models/EverdriveSMDB/Row.cs
+++ b/SabreTools.Data.Models/EverdriveSMDB/Row.cs
@@ -21,6 +21,6 @@ namespace SabreTools.Data.Models.EverdriveSMDB
[Required]
public string? CRC32 { get; set; }
- public string? Size { get; set; }
+ public long? Size { get; set; }
}
}
diff --git a/SabreTools.Data.Models/Listrom/Row.cs b/SabreTools.Data.Models/Listrom/Row.cs
index 28e32499..a86bb239 100644
--- a/SabreTools.Data.Models/Listrom/Row.cs
+++ b/SabreTools.Data.Models/Listrom/Row.cs
@@ -18,7 +18,7 @@ namespace SabreTools.Data.Models.Listrom
[Required]
public string? Name { get; set; }
- public string? Size { get; set; }
+ public long? Size { get; set; }
public bool Bad { get; set; }
diff --git a/SabreTools.Data.Models/Listxml/Adjuster.cs b/SabreTools.Data.Models/Listxml/Adjuster.cs
index 44417c5d..ea99b1d2 100644
--- a/SabreTools.Data.Models/Listxml/Adjuster.cs
+++ b/SabreTools.Data.Models/Listxml/Adjuster.cs
@@ -12,7 +12,7 @@ namespace SabreTools.Data.Models.Listxml
/// (yes|no) "no"
[XmlAttribute("default")]
- public string? Default { get; set; }
+ public bool? Default { get; set; }
[XmlElement("condition")]
public Condition? Condition { get; set; }
diff --git a/SabreTools.Data.Models/Listxml/BiosSet.cs b/SabreTools.Data.Models/Listxml/BiosSet.cs
index f62df74a..2ffdb633 100644
--- a/SabreTools.Data.Models/Listxml/BiosSet.cs
+++ b/SabreTools.Data.Models/Listxml/BiosSet.cs
@@ -16,6 +16,6 @@ namespace SabreTools.Data.Models.Listxml
/// (yes|no) "no"
[XmlAttribute("default")]
- public string? Default { get; set; }
+ public bool? Default { get; set; }
}
}
diff --git a/SabreTools.Data.Models/Listxml/Chip.cs b/SabreTools.Data.Models/Listxml/Chip.cs
index 993a967f..b447e24c 100644
--- a/SabreTools.Data.Models/Listxml/Chip.cs
+++ b/SabreTools.Data.Models/Listxml/Chip.cs
@@ -1,5 +1,6 @@
using System.Xml;
using System.Xml.Serialization;
+using SabreTools.Data.Models.Metadata;
namespace SabreTools.Data.Models.Listxml
{
@@ -16,13 +17,13 @@ namespace SabreTools.Data.Models.Listxml
/// (cpu|audio)
[Required]
[XmlAttribute("type")]
- public string? Type { get; set; }
+ public ChipType? Type { get; set; }
/// Only present in older versions
[XmlAttribute("soundonly")]
- public string? SoundOnly { get; set; }
+ public bool? SoundOnly { get; set; }
[XmlAttribute("clock")]
- public string? Clock { get; set; }
+ public long? Clock { get; set; }
}
}
diff --git a/SabreTools.Data.Models/Listxml/Condition.cs b/SabreTools.Data.Models/Listxml/Condition.cs
index 73f4908b..5e4858a4 100644
--- a/SabreTools.Data.Models/Listxml/Condition.cs
+++ b/SabreTools.Data.Models/Listxml/Condition.cs
@@ -1,5 +1,6 @@
using System.Xml;
using System.Xml.Serialization;
+using SabreTools.Data.Models.Metadata;
namespace SabreTools.Data.Models.Listxml
{
@@ -17,7 +18,7 @@ namespace SabreTools.Data.Models.Listxml
/// (eq|ne|gt|le|lt|ge)
[Required]
[XmlAttribute("relation")]
- public string? Relation { get; set; }
+ public Relation? Relation { get; set; }
[Required]
[XmlAttribute("value")]
diff --git a/SabreTools.Data.Models/Listxml/ConfLocation.cs b/SabreTools.Data.Models/Listxml/ConfLocation.cs
index dd1da1dc..de57786f 100644
--- a/SabreTools.Data.Models/Listxml/ConfLocation.cs
+++ b/SabreTools.Data.Models/Listxml/ConfLocation.cs
@@ -10,13 +10,12 @@ namespace SabreTools.Data.Models.Listxml
[XmlAttribute("name")]
public string? Name { get; set; }
- /// Numeric?
[Required]
[XmlAttribute("number")]
- public string? Number { get; set; }
+ public long? Number { get; set; }
/// (yes|no) "no"
[XmlAttribute("inverted")]
- public string? Inverted { get; set; }
+ public bool? Inverted { get; set; }
}
}
diff --git a/SabreTools.Data.Models/Listxml/ConfSetting.cs b/SabreTools.Data.Models/Listxml/ConfSetting.cs
index 20f7200b..1d351d0c 100644
--- a/SabreTools.Data.Models/Listxml/ConfSetting.cs
+++ b/SabreTools.Data.Models/Listxml/ConfSetting.cs
@@ -16,7 +16,7 @@ namespace SabreTools.Data.Models.Listxml
/// (yes|no) "no"
[XmlAttribute("default")]
- public string? Default { get; set; }
+ public bool? Default { get; set; }
[XmlElement("condition")]
public Condition? Condition { get; set; }
diff --git a/SabreTools.Data.Models/Listxml/Control.cs b/SabreTools.Data.Models/Listxml/Control.cs
index e5b0f134..b1be6a26 100644
--- a/SabreTools.Data.Models/Listxml/Control.cs
+++ b/SabreTools.Data.Models/Listxml/Control.cs
@@ -1,5 +1,6 @@
using System.Xml;
using System.Xml.Serialization;
+using SabreTools.Data.Models.Metadata;
namespace SabreTools.Data.Models.Listxml
{
@@ -9,49 +10,39 @@ namespace SabreTools.Data.Models.Listxml
/// (joy|stick|paddle|pedal|lightgun|positional|dial|trackball|mouse|only_buttons|keypad|keyboard|mahjong|hanafuda|gambling)
[Required]
[XmlAttribute("type")]
- public string? Type { get; set; }
+ public ControlType? Type { get; set; }
- /// Numeric
[XmlAttribute("player")]
- public string? Player { get; set; }
+ public long? Player { get; set; }
- /// Numeric
[XmlAttribute("buttons")]
- public string? Buttons { get; set; }
+ public long? Buttons { get; set; }
- /// Numeric
[XmlAttribute("reqbuttons")]
- public string? ReqButtons { get; set; }
+ public long? ReqButtons { get; set; }
- /// Numeric
[XmlAttribute("minimum")]
- public string? Minimum { get; set; }
+ public long? Minimum { get; set; }
- /// Numeric
[XmlAttribute("maximum")]
- public string? Maximum { get; set; }
+ public long? Maximum { get; set; }
- /// Numeric
[XmlAttribute("sensitivity")]
- public string? Sensitivity { get; set; }
+ public long? Sensitivity { get; set; }
- /// Numeric
[XmlAttribute("keydelta")]
- public string? KeyDelta { get; set; }
+ public long? KeyDelta { get; set; }
/// (yes|no) "no"
[XmlAttribute("reverse")]
- public string? Reverse { get; set; }
+ public bool? Reverse { get; set; }
- /// Numeric?
[XmlAttribute("ways")]
public string? Ways { get; set; }
- /// Numeric?
[XmlAttribute("ways2")]
public string? Ways2 { get; set; }
- /// Numeric?
[XmlAttribute("ways3")]
public string? Ways3 { get; set; }
}
diff --git a/SabreTools.Data.Models/Listxml/Device.cs b/SabreTools.Data.Models/Listxml/Device.cs
index a6790474..ef377197 100644
--- a/SabreTools.Data.Models/Listxml/Device.cs
+++ b/SabreTools.Data.Models/Listxml/Device.cs
@@ -1,14 +1,16 @@
using System.Xml;
using System.Xml.Serialization;
+using SabreTools.Data.Models.Metadata;
namespace SabreTools.Data.Models.Listxml
{
[XmlRoot("device")]
public class Device
{
+ /// (unknown|cartridge|floppydisk|harddisk|cylinder|cassette|punchcard|punchtape|printout|serial|parallel|snapshot|quickload|memcard|cdrom|magtape|romimage|midiin|midiout|picture|vidfile)
[Required]
[XmlAttribute("type")]
- public string? Type { get; set; }
+ public DeviceType? Type { get; set; }
[XmlAttribute("tag")]
public string? Tag { get; set; }
@@ -16,9 +18,9 @@ namespace SabreTools.Data.Models.Listxml
[XmlAttribute("fixed_image")]
public string? FixedImage { get; set; }
- /// Numeric boolean
+ /// (0|1) "0"
[XmlAttribute("mandatory")]
- public string? Mandatory { get; set; }
+ public bool? Mandatory { get; set; }
[XmlAttribute("interface")]
public string? Interface { get; set; }
diff --git a/SabreTools.Data.Models/Listxml/DipLocation.cs b/SabreTools.Data.Models/Listxml/DipLocation.cs
index f669f3e5..cdbdf653 100644
--- a/SabreTools.Data.Models/Listxml/DipLocation.cs
+++ b/SabreTools.Data.Models/Listxml/DipLocation.cs
@@ -10,13 +10,12 @@ namespace SabreTools.Data.Models.Listxml
[XmlAttribute("name")]
public string? Name { get; set; }
- /// Numeric?
[Required]
[XmlAttribute("number")]
- public string? Number { get; set; }
+ public long? Number { get; set; }
/// (yes|no) "no"
[XmlAttribute("inverted")]
- public string? Inverted { get; set; }
+ public bool? Inverted { get; set; }
}
}
diff --git a/SabreTools.Data.Models/Listxml/DipValue.cs b/SabreTools.Data.Models/Listxml/DipValue.cs
index 3f61f7fb..cfd96626 100644
--- a/SabreTools.Data.Models/Listxml/DipValue.cs
+++ b/SabreTools.Data.Models/Listxml/DipValue.cs
@@ -16,7 +16,7 @@ namespace SabreTools.Data.Models.Listxml
/// (yes|no) "no"
[XmlAttribute("default")]
- public string? Default { get; set; }
+ public bool? Default { get; set; }
[XmlElement("condition")]
public Condition? Condition { get; set; }
diff --git a/SabreTools.Data.Models/Listxml/Disk.cs b/SabreTools.Data.Models/Listxml/Disk.cs
index 3b4c6158..1ca07c83 100644
--- a/SabreTools.Data.Models/Listxml/Disk.cs
+++ b/SabreTools.Data.Models/Listxml/Disk.cs
@@ -1,5 +1,6 @@
using System.Xml;
using System.Xml.Serialization;
+using SabreTools.Data.Models.Metadata;
namespace SabreTools.Data.Models.Listxml
{
@@ -23,20 +24,19 @@ namespace SabreTools.Data.Models.Listxml
[XmlAttribute("region")]
public string? Region { get; set; }
- /// Numeric?
[XmlAttribute("index")]
- public string? Index { get; set; }
+ public long? Index { get; set; }
/// (yes|no) "no"
[XmlAttribute("writable")]
- public string? Writable { get; set; }
+ public bool? Writable { get; set; }
/// (baddump|nodump|good) "good"
[XmlAttribute("status")]
- public string? Status { get; set; }
+ public ItemStatus? Status { get; set; }
/// (yes|no) "no"
[XmlAttribute("optional")]
- public string? Optional { get; set; }
+ public bool? Optional { get; set; }
}
}
diff --git a/SabreTools.Data.Models/Listxml/Display.cs b/SabreTools.Data.Models/Listxml/Display.cs
index 885cb5f3..2da2f7c0 100644
--- a/SabreTools.Data.Models/Listxml/Display.cs
+++ b/SabreTools.Data.Models/Listxml/Display.cs
@@ -1,5 +1,6 @@
using System.Xml;
using System.Xml.Serialization;
+using SabreTools.Data.Models.Metadata;
namespace SabreTools.Data.Models.Listxml
{
@@ -12,55 +13,45 @@ namespace SabreTools.Data.Models.Listxml
/// (raster|vector|lcd|svg|unknown)
[Required]
[XmlAttribute("type")]
- public string? Type { get; set; }
+ public DisplayType? Type { get; set; }
/// (0|90|180|270)
[XmlAttribute("rotate")]
- public string? Rotate { get; set; }
+ public Rotation? Rotate { get; set; }
/// (yes|no) "no"
[XmlAttribute("flipx")]
- public string? FlipX { get; set; }
+ public bool? FlipX { get; set; }
- /// Numeric
[XmlAttribute("width")]
- public string? Width { get; set; }
+ public long? Width { get; set; }
- /// Numeric
[XmlAttribute("height")]
- public string? Height { get; set; }
+ public long? Height { get; set; }
- /// Numeric
[Required]
[XmlAttribute("refresh")]
- public string? Refresh { get; set; }
+ public double? Refresh { get; set; }
- /// Numeric
[XmlAttribute("pixclock")]
- public string? PixClock { get; set; }
+ public long? PixClock { get; set; }
- /// Numeric
[XmlAttribute("htotal")]
- public string? HTotal { get; set; }
+ public long? HTotal { get; set; }
- /// Numeric
[XmlAttribute("hbend")]
- public string? HBEnd { get; set; }
+ public long? HBEnd { get; set; }
- /// Numeric
[XmlAttribute("hbstart")]
- public string? HBStart { get; set; }
+ public long? HBStart { get; set; }
- /// Numeric
[XmlAttribute("vtotal")]
- public string? VTotal { get; set; }
+ public long? VTotal { get; set; }
- /// Numeric
[XmlAttribute("vbend")]
- public string? VBEnd { get; set; }
+ public long? VBEnd { get; set; }
- /// Numeric
[XmlAttribute("vbstart")]
- public string? VBStart { get; set; }
+ public long? VBStart { get; set; }
}
}
diff --git a/SabreTools.Data.Models/Listxml/Driver.cs b/SabreTools.Data.Models/Listxml/Driver.cs
index 56efb119..c03b7baf 100644
--- a/SabreTools.Data.Models/Listxml/Driver.cs
+++ b/SabreTools.Data.Models/Listxml/Driver.cs
@@ -1,5 +1,6 @@
using System.Xml;
using System.Xml.Serialization;
+using SabreTools.Data.Models.Metadata;
namespace SabreTools.Data.Models.Listxml
{
@@ -9,15 +10,15 @@ namespace SabreTools.Data.Models.Listxml
/// (good|imperfect|preliminary), (good|preliminary|test) in older versions
[Required]
[XmlAttribute("status")]
- public string? Status { get; set; }
+ public SupportStatus? Status { get; set; }
/// (good|imperfect|preliminary), Only present in older versions
[XmlAttribute("color")]
- public string? Color { get; set; }
+ public SupportStatus? Color { get; set; }
/// (good|imperfect|preliminary), Only present in older versions
[XmlAttribute("sound")]
- public string? Sound { get; set; }
+ public SupportStatus? Sound { get; set; }
/// Only present in older versions
[XmlAttribute("palettesize")]
@@ -26,32 +27,32 @@ namespace SabreTools.Data.Models.Listxml
/// (good|imperfect|preliminary)
[Required]
[XmlAttribute("emulation")]
- public string? Emulation { get; set; }
+ public SupportStatus? Emulation { get; set; }
/// (good|imperfect|preliminary)
[Required]
[XmlAttribute("cocktail")]
- public string? Cocktail { get; set; }
+ public SupportStatus? Cocktail { get; set; }
/// (supported|unsupported)
[Required]
[XmlAttribute("savestate")]
- public string? SaveState { get; set; }
+ public Supported? SaveState { get; set; }
/// (yes|no) "no"
[XmlAttribute("requiresartwork")]
- public string? RequiresArtwork { get; set; }
+ public bool? RequiresArtwork { get; set; }
/// (yes|no) "no"
[XmlAttribute("unofficial")]
- public string? Unofficial { get; set; }
+ public bool? Unofficial { get; set; }
/// (yes|no) "no"
[XmlAttribute("nosoundhardware")]
- public string? NoSoundHardware { get; set; }
+ public bool? NoSoundHardware { get; set; }
/// (yes|no) "no"
[XmlAttribute("incomplete")]
- public string? Incomplete { get; set; }
+ public bool? Incomplete { get; set; }
}
}
diff --git a/SabreTools.Data.Models/Listxml/Feature.cs b/SabreTools.Data.Models/Listxml/Feature.cs
index b4897e4c..b1a29119 100644
--- a/SabreTools.Data.Models/Listxml/Feature.cs
+++ b/SabreTools.Data.Models/Listxml/Feature.cs
@@ -1,5 +1,6 @@
using System.Xml;
using System.Xml.Serialization;
+using SabreTools.Data.Models.Metadata;
namespace SabreTools.Data.Models.Listxml
{
@@ -9,14 +10,14 @@ namespace SabreTools.Data.Models.Listxml
/// (protection|timing|graphics|palette|sound|capture|camera|microphone|controls|keyboard|mouse|media|disk|printer|tape|punch|drum|rom|comms|lan|wan)
[Required]
[XmlAttribute("type")]
- public string? Type { get; set; }
+ public FeatureType? Type { get; set; }
/// (unemulated|imperfect)
[XmlAttribute("status")]
- public string? Status { get; set; }
+ public FeatureStatus? Status { get; set; }
/// (unemulated|imperfect)
[XmlAttribute("overall")]
- public string? Overall { get; set; }
+ public FeatureStatus? Overall { get; set; }
}
}
diff --git a/SabreTools.Data.Models/Listxml/GameBase.cs b/SabreTools.Data.Models/Listxml/GameBase.cs
index bec36fcd..de08a58b 100644
--- a/SabreTools.Data.Models/Listxml/GameBase.cs
+++ b/SabreTools.Data.Models/Listxml/GameBase.cs
@@ -1,5 +1,6 @@
using System.Xml;
using System.Xml.Serialization;
+using SabreTools.Data.Models.Metadata;
namespace SabreTools.Data.Models.Listxml
{
@@ -18,19 +19,19 @@ namespace SabreTools.Data.Models.Listxml
/// (yes|no) "no", Machine only
[XmlAttribute("isbios")]
- public string? IsBios { get; set; }
+ public bool? IsBios { get; set; }
/// (yes|no) "no", Machine only
[XmlAttribute("isdevice")]
- public string? IsDevice { get; set; }
+ public bool? IsDevice { get; set; }
/// (yes|no) "no", Machine only
[XmlAttribute("ismechanical")]
- public string? IsMechanical { get; set; }
+ public bool? IsMechanical { get; set; }
/// (yes|no) "no"
[XmlAttribute("runnable")]
- public string? Runnable { get; set; }
+ public Runnable? Runnable { get; set; }
[XmlAttribute("cloneof")]
public string? CloneOf { get; set; }
diff --git a/SabreTools.Data.Models/Listxml/Input.cs b/SabreTools.Data.Models/Listxml/Input.cs
index f856df6d..e6f62971 100644
--- a/SabreTools.Data.Models/Listxml/Input.cs
+++ b/SabreTools.Data.Models/Listxml/Input.cs
@@ -8,28 +8,26 @@ namespace SabreTools.Data.Models.Listxml
{
/// (yes|no) "no"
[XmlAttribute("service")]
- public string? Service { get; set; }
+ public bool? Service { get; set; }
/// (yes|no) "no"
[XmlAttribute("tilt")]
- public string? Tilt { get; set; }
+ public bool? Tilt { get; set; }
- /// Numeric
[Required]
[XmlAttribute("players")]
- public string? Players { get; set; }
+ public long? Players { get; set; }
/// Only present in older versions
[XmlAttribute("control")]
public string? ControlAttr { get; set; }
- /// Only present in older versions, Numeric?
+ /// Only present in older versions
[XmlAttribute("buttons")]
- public string? Buttons { get; set; }
+ public long? Buttons { get; set; }
- /// Numeric?
[XmlAttribute("coins")]
- public string? Coins { get; set; }
+ public long? Coins { get; set; }
[XmlElement("control")]
public Control[]? Control { get; set; }
diff --git a/SabreTools.Data.Models/Listxml/Mame.cs b/SabreTools.Data.Models/Listxml/Mame.cs
index 06faa831..a52584c6 100644
--- a/SabreTools.Data.Models/Listxml/Mame.cs
+++ b/SabreTools.Data.Models/Listxml/Mame.cs
@@ -11,7 +11,7 @@ namespace SabreTools.Data.Models.Listxml
/// (yes|no) "no"
[XmlAttribute("debug")]
- public string? Debug { get; set; }
+ public bool? Debug { get; set; }
[Required]
[XmlAttribute("mameconfig")]
diff --git a/SabreTools.Data.Models/Listxml/RamOption.cs b/SabreTools.Data.Models/Listxml/RamOption.cs
index d1d0b5cf..78c105cc 100644
--- a/SabreTools.Data.Models/Listxml/RamOption.cs
+++ b/SabreTools.Data.Models/Listxml/RamOption.cs
@@ -10,8 +10,9 @@ namespace SabreTools.Data.Models.Listxml
[XmlAttribute("name")]
public string? Name { get; set; }
+ /// (yes|no) "no"
[XmlAttribute("default")]
- public string? Default { get; set; }
+ public bool? Default { get; set; }
[XmlText]
public string? Content { get; set; }
diff --git a/SabreTools.Data.Models/Listxml/Rom.cs b/SabreTools.Data.Models/Listxml/Rom.cs
index edaecf51..d537ea66 100644
--- a/SabreTools.Data.Models/Listxml/Rom.cs
+++ b/SabreTools.Data.Models/Listxml/Rom.cs
@@ -1,5 +1,6 @@
using System.Xml;
using System.Xml.Serialization;
+using SabreTools.Data.Models.Metadata;
namespace SabreTools.Data.Models.Listxml
{
@@ -13,10 +14,9 @@ namespace SabreTools.Data.Models.Listxml
[XmlAttribute("bios")]
public string? Bios { get; set; }
- /// Numeric
[Required]
[XmlAttribute("size")]
- public string? Size { get; set; }
+ public long? Size { get; set; }
[XmlAttribute("crc")]
public string? CRC { get; set; }
@@ -36,18 +36,18 @@ namespace SabreTools.Data.Models.Listxml
/// (baddump|nodump|good) "good"
[XmlAttribute("status")]
- public string? Status { get; set; }
+ public ItemStatus? Status { get; set; }
/// (yes|no) "no"
[XmlAttribute("optional")]
- public string? Optional { get; set; }
+ public bool? Optional { get; set; }
/// (yes|no) "no", Only present in older versions
[XmlAttribute("dispose")]
- public string? Dispose { get; set; }
+ public bool? Dispose { get; set; }
/// (yes|no) "no", Only present in older versions
[XmlAttribute("soundonly")]
- public string? SoundOnly { get; set; }
+ public bool? SoundOnly { get; set; }
}
}
diff --git a/SabreTools.Data.Models/Listxml/SlotOption.cs b/SabreTools.Data.Models/Listxml/SlotOption.cs
index 8f9bb9cf..fbbe9730 100644
--- a/SabreTools.Data.Models/Listxml/SlotOption.cs
+++ b/SabreTools.Data.Models/Listxml/SlotOption.cs
@@ -16,6 +16,6 @@ namespace SabreTools.Data.Models.Listxml
/// (yes|no) "no"
[XmlAttribute("default")]
- public string? Default { get; set; }
+ public bool? Default { get; set; }
}
}
diff --git a/SabreTools.Data.Models/Listxml/SoftwareList.cs b/SabreTools.Data.Models/Listxml/SoftwareList.cs
index 31f7ed3c..b440b12d 100644
--- a/SabreTools.Data.Models/Listxml/SoftwareList.cs
+++ b/SabreTools.Data.Models/Listxml/SoftwareList.cs
@@ -1,5 +1,6 @@
using System.Xml;
using System.Xml.Serialization;
+using SabreTools.Data.Models.Metadata;
namespace SabreTools.Data.Models.Listxml
{
@@ -17,7 +18,7 @@ namespace SabreTools.Data.Models.Listxml
/// (original|compatible)
[Required]
[XmlAttribute("status")]
- public string? Status { get; set; }
+ public SoftwareListStatus? Status { get; set; }
[XmlAttribute("filter")]
public string? Filter { get; set; }
diff --git a/SabreTools.Data.Models/Listxml/Sound.cs b/SabreTools.Data.Models/Listxml/Sound.cs
index 7f616c72..2600d84c 100644
--- a/SabreTools.Data.Models/Listxml/Sound.cs
+++ b/SabreTools.Data.Models/Listxml/Sound.cs
@@ -9,6 +9,6 @@ namespace SabreTools.Data.Models.Listxml
/// Numeric
[Required]
[XmlAttribute("channels")]
- public string? Channels { get; set; }
+ public long? Channels { get; set; }
}
}
diff --git a/SabreTools.Data.Models/Listxml/Video.cs b/SabreTools.Data.Models/Listxml/Video.cs
index 7568ea9f..9c0f0e15 100644
--- a/SabreTools.Data.Models/Listxml/Video.cs
+++ b/SabreTools.Data.Models/Listxml/Video.cs
@@ -1,5 +1,6 @@
using System.Xml;
using System.Xml.Serialization;
+using SabreTools.Data.Models.Metadata;
namespace SabreTools.Data.Models.Listxml
{
@@ -9,31 +10,26 @@ namespace SabreTools.Data.Models.Listxml
/// (raster|vector)
[Required]
[XmlAttribute("screen")]
- public string? Screen { get; set; }
+ public DisplayType? Screen { get; set; }
/// (vertical|horizontal)
[Required]
[XmlAttribute("orientation")]
- public string? Orientation { get; set; }
+ public Rotation? Orientation { get; set; }
- /// Numeric
[XmlAttribute("width")]
- public string? Width { get; set; }
+ public long? Width { get; set; }
- /// Numeric
[XmlAttribute("height")]
- public string? Height { get; set; }
+ public long? Height { get; set; }
- /// Numeric
[XmlAttribute("aspectx")]
- public string? AspectX { get; set; }
+ public long? AspectX { get; set; }
- /// Numeric
[XmlAttribute("aspecty")]
- public string? AspectY { get; set; }
+ public long? AspectY { get; set; }
- /// Numeric
[XmlAttribute("refresh")]
- public string? Refresh { get; set; }
+ public double? Refresh { get; set; }
}
}
diff --git a/SabreTools.Data.Models/Logiqx/BiosSet.cs b/SabreTools.Data.Models/Logiqx/BiosSet.cs
index 53c13561..f8be9c31 100644
--- a/SabreTools.Data.Models/Logiqx/BiosSet.cs
+++ b/SabreTools.Data.Models/Logiqx/BiosSet.cs
@@ -16,6 +16,6 @@ namespace SabreTools.Data.Models.Logiqx
/// (yes|no) "no"
[XmlAttribute("default")]
- public string? Default { get; set; }
+ public bool? Default { get; set; }
}
}
diff --git a/SabreTools.Data.Models/Logiqx/ClrMamePro.cs b/SabreTools.Data.Models/Logiqx/ClrMamePro.cs
index f66596a6..ba9bf306 100644
--- a/SabreTools.Data.Models/Logiqx/ClrMamePro.cs
+++ b/SabreTools.Data.Models/Logiqx/ClrMamePro.cs
@@ -1,5 +1,6 @@
using System.Xml;
using System.Xml.Serialization;
+using SabreTools.Data.Models.Metadata;
namespace SabreTools.Data.Models.Logiqx
{
@@ -11,14 +12,14 @@ namespace SabreTools.Data.Models.Logiqx
/// (none|split|merged|nonmerged|fullmerged|device|full) "split"
[XmlAttribute("forcemerging")]
- public string? ForceMerging { get; set; }
+ public MergingFlag ForceMerging { get; set; }
/// (obsolete|required|ignore) "obsolete"
[XmlAttribute("forcenodump")]
- public string? ForceNodump { get; set; }
+ public NodumpFlag ForceNodump { get; set; }
/// (zip|unzip) "zip"
[XmlAttribute("forcepacking")]
- public string? ForcePacking { get; set; }
+ public PackingFlag ForcePacking { get; set; }
}
}
diff --git a/SabreTools.Data.Models/Logiqx/Datafile.cs b/SabreTools.Data.Models/Logiqx/Datafile.cs
index 3c0b8eb6..4a9eca43 100644
--- a/SabreTools.Data.Models/Logiqx/Datafile.cs
+++ b/SabreTools.Data.Models/Logiqx/Datafile.cs
@@ -11,7 +11,7 @@ namespace SabreTools.Data.Models.Logiqx
/// (yes|no) "no"
[XmlAttribute("debug")]
- public string? Debug { get; set; }
+ public bool? Debug { get; set; }
/// No-Intro extension
[XmlAttribute(Namespace = "http://www.w3.org/2001/XMLSchema-instance", AttributeName = "schemaLocation")]
diff --git a/SabreTools.Data.Models/Logiqx/Disk.cs b/SabreTools.Data.Models/Logiqx/Disk.cs
index c36ef5d1..2b080f8d 100644
--- a/SabreTools.Data.Models/Logiqx/Disk.cs
+++ b/SabreTools.Data.Models/Logiqx/Disk.cs
@@ -1,5 +1,6 @@
using System.Xml;
using System.Xml.Serialization;
+using SabreTools.Data.Models.Metadata;
namespace SabreTools.Data.Models.Logiqx
{
@@ -21,7 +22,7 @@ namespace SabreTools.Data.Models.Logiqx
/// (baddump|nodump|good|verified) "good"
[XmlAttribute("status")]
- public string? Status { get; set; }
+ public ItemStatus? Status { get; set; }
/// MAME extension
[XmlAttribute("region")]
diff --git a/SabreTools.Data.Models/Logiqx/Driver.cs b/SabreTools.Data.Models/Logiqx/Driver.cs
index b58fdd42..bb1f752c 100644
--- a/SabreTools.Data.Models/Logiqx/Driver.cs
+++ b/SabreTools.Data.Models/Logiqx/Driver.cs
@@ -1,5 +1,6 @@
using System.Xml;
using System.Xml.Serialization;
+using SabreTools.Data.Models.Metadata;
namespace SabreTools.Data.Models.Logiqx
{
@@ -9,37 +10,37 @@ namespace SabreTools.Data.Models.Logiqx
/// (good|imperfect|preliminary)
[Required]
[XmlAttribute("status")]
- public string? Status { get; set; }
+ public SupportStatus? Status { get; set; }
/// (good|imperfect|preliminary)
[Required]
[XmlAttribute("emulation")]
- public string? Emulation { get; set; }
+ public SupportStatus? Emulation { get; set; }
/// (good|imperfect|preliminary)
[Required]
[XmlAttribute("cocktail")]
- public string? Cocktail { get; set; }
+ public SupportStatus? Cocktail { get; set; }
/// (supported|unsupported)
[Required]
[XmlAttribute("savestate")]
- public string? SaveState { get; set; }
+ public Supported? SaveState { get; set; }
/// (yes|no) "no"
[XmlAttribute("requiresartwork")]
- public string? RequiresArtwork { get; set; }
+ public bool? RequiresArtwork { get; set; }
/// (yes|no) "no"
[XmlAttribute("unofficial")]
- public string? Unofficial { get; set; }
+ public bool? Unofficial { get; set; }
/// (yes|no) "no"
[XmlAttribute("nosoundhardware")]
- public string? NoSoundHardware { get; set; }
+ public bool? NoSoundHardware { get; set; }
/// (yes|no) "no"
[XmlAttribute("incomplete")]
- public string? Incomplete { get; set; }
+ public bool? Incomplete { get; set; }
}
}
diff --git a/SabreTools.Data.Models/Logiqx/GameBase.cs b/SabreTools.Data.Models/Logiqx/GameBase.cs
index 28e6d4ab..49fb6d26 100644
--- a/SabreTools.Data.Models/Logiqx/GameBase.cs
+++ b/SabreTools.Data.Models/Logiqx/GameBase.cs
@@ -1,5 +1,6 @@
using System.Xml;
using System.Xml.Serialization;
+using SabreTools.Data.Models.Metadata;
namespace SabreTools.Data.Models.Logiqx
{
@@ -17,15 +18,15 @@ namespace SabreTools.Data.Models.Logiqx
/// (yes|no) "no"
[XmlAttribute("isbios")]
- public string? IsBios { get; set; }
+ public bool? IsBios { get; set; }
/// (yes|no) "no", MAME extension
[XmlAttribute("isdevice")]
- public string? IsDevice { get; set; }
+ public bool? IsDevice { get; set; }
/// (yes|no) "no", MAME extension
[XmlAttribute("ismechanical")]
- public string? IsMechanical { get; set; }
+ public bool? IsMechanical { get; set; }
[XmlAttribute("cloneof")]
public string? CloneOf { get; set; }
@@ -52,7 +53,7 @@ namespace SabreTools.Data.Models.Logiqx
/// (no|partial|yes) "no"
[XmlAttribute("runnable")]
- public string? Runnable { get; set; }
+ public Runnable? Runnable { get; set; }
[XmlElement("comment")]
public string[]? Comment { get; set; }
diff --git a/SabreTools.Data.Models/Logiqx/Header.cs b/SabreTools.Data.Models/Logiqx/Header.cs
index 86619e68..504615e9 100644
--- a/SabreTools.Data.Models/Logiqx/Header.cs
+++ b/SabreTools.Data.Models/Logiqx/Header.cs
@@ -52,6 +52,9 @@ namespace SabreTools.Data.Models.Logiqx
[XmlElement("type")]
public string? Type { get; set; }
+ [XmlElement("romvault")]
+ public RomVault? RomVault { get; set; }
+
[XmlElement("clrmamepro")]
public ClrMamePro? ClrMamePro { get; set; }
diff --git a/SabreTools.Data.Models/Logiqx/Release.cs b/SabreTools.Data.Models/Logiqx/Release.cs
index e961fcb3..51a442cb 100644
--- a/SabreTools.Data.Models/Logiqx/Release.cs
+++ b/SabreTools.Data.Models/Logiqx/Release.cs
@@ -22,6 +22,6 @@ namespace SabreTools.Data.Models.Logiqx
/// (yes|no) "no"
[XmlAttribute("default")]
- public string? Default { get; set; }
+ public bool? Default { get; set; }
}
}
diff --git a/SabreTools.Data.Models/Logiqx/Rom.cs b/SabreTools.Data.Models/Logiqx/Rom.cs
index e20d4efb..bef09c1c 100644
--- a/SabreTools.Data.Models/Logiqx/Rom.cs
+++ b/SabreTools.Data.Models/Logiqx/Rom.cs
@@ -1,5 +1,6 @@
using System.Xml;
using System.Xml.Serialization;
+using SabreTools.Data.Models.Metadata;
#pragma warning disable IDE1006 // Naming Styles
namespace SabreTools.Data.Models.Logiqx
@@ -13,7 +14,7 @@ namespace SabreTools.Data.Models.Logiqx
[Required]
[XmlAttribute("size")]
- public string? Size { get; set; }
+ public long? Size { get; set; }
/// Hash extension
[XmlAttribute("crc16")]
@@ -77,7 +78,7 @@ namespace SabreTools.Data.Models.Logiqx
/// (baddump|nodump|good|verified) "good"
[XmlAttribute("status")]
- public string? Status { get; set; }
+ public ItemStatus? Status { get; set; }
/// No-Intro extension
[XmlAttribute("serial")]
@@ -92,10 +93,10 @@ namespace SabreTools.Data.Models.Logiqx
/// Boolean; RomVault extension
[XmlAttribute("inverted")]
- public string? Inverted { get; set; }
+ public bool? Inverted { get; set; }
/// Boolean; RomVault extension
[XmlAttribute("mia")]
- public string? MIA { get; set; }
+ public bool? MIA { get; set; }
}
}
diff --git a/SabreTools.Data.Models/Logiqx/RomCenter.cs b/SabreTools.Data.Models/Logiqx/RomCenter.cs
index 157776dc..84e4554b 100644
--- a/SabreTools.Data.Models/Logiqx/RomCenter.cs
+++ b/SabreTools.Data.Models/Logiqx/RomCenter.cs
@@ -1,5 +1,6 @@
using System.Xml;
using System.Xml.Serialization;
+using SabreTools.Data.Models.Metadata;
namespace SabreTools.Data.Models.Logiqx
{
@@ -11,26 +12,26 @@ namespace SabreTools.Data.Models.Logiqx
/// (none|split|merged|unmerged|fullmerged|device|full) "split"
[XmlAttribute("rommode")]
- public string? RomMode { get; set; }
+ public MergingFlag RomMode { get; set; }
/// (none|split|merged|unmerged|fullmerged|device|full) "split"
[XmlAttribute("biosmode")]
- public string? BiosMode { get; set; }
+ public MergingFlag BiosMode { get; set; }
/// (none|split|merged|unmerged|fullmerged|device|full) "merged"
[XmlAttribute("samplemode")]
- public string? SampleMode { get; set; }
+ public MergingFlag SampleMode { get; set; }
/// (yes|no) "no"
[XmlAttribute("lockrommode")]
- public string? LockRomMode { get; set; }
+ public bool? LockRomMode { get; set; }
/// (yes|no) "no"
[XmlAttribute("lockbiosmode")]
- public string? LockBiosMode { get; set; }
+ public bool? LockBiosMode { get; set; }
/// (yes|no) "no"
[XmlAttribute("locksamplemode")]
- public string? LockSampleMode { get; set; }
+ public bool? LockSampleMode { get; set; }
}
}
diff --git a/SabreTools.Data.Models/Logiqx/RomVault.cs b/SabreTools.Data.Models/Logiqx/RomVault.cs
new file mode 100644
index 00000000..3bccee00
--- /dev/null
+++ b/SabreTools.Data.Models/Logiqx/RomVault.cs
@@ -0,0 +1,25 @@
+using System.Xml;
+using System.Xml.Serialization;
+using SabreTools.Data.Models.Metadata;
+
+namespace SabreTools.Data.Models.Logiqx
+{
+ [XmlRoot("romvault")]
+ public class RomVault
+ {
+ [XmlAttribute("header")]
+ public string? Header { get; set; }
+
+ /// (none|split|merged|nonmerged|fullmerged|device|full) "split"
+ [XmlAttribute("forcemerging")]
+ public MergingFlag ForceMerging { get; set; }
+
+ /// (obsolete|required|ignore) "obsolete"
+ [XmlAttribute("forcenodump")]
+ public NodumpFlag ForceNodump { get; set; }
+
+ /// (zip|unzip) "zip"
+ [XmlAttribute("forcepacking")]
+ public PackingFlag ForcePacking { get; set; }
+ }
+}
diff --git a/SabreTools.Data.Models/Logiqx/SoftwareList.cs b/SabreTools.Data.Models/Logiqx/SoftwareList.cs
index fb06ff48..69d23183 100644
--- a/SabreTools.Data.Models/Logiqx/SoftwareList.cs
+++ b/SabreTools.Data.Models/Logiqx/SoftwareList.cs
@@ -1,5 +1,6 @@
using System.Xml;
using System.Xml.Serialization;
+using SabreTools.Data.Models.Metadata;
namespace SabreTools.Data.Models.Logiqx
{
@@ -17,7 +18,7 @@ namespace SabreTools.Data.Models.Logiqx
/// (original|compatible)
[Required]
[XmlAttribute("status")]
- public string? Status { get; set; }
+ public SoftwareListStatus? Status { get; set; }
[XmlAttribute("filter")]
public string? Filter { get; set; }
diff --git a/SabreTools.Data.Models/Metadata/Adjuster.cs b/SabreTools.Data.Models/Metadata/Adjuster.cs
index 7b4c8e96..35ed6e8b 100644
--- a/SabreTools.Data.Models/Metadata/Adjuster.cs
+++ b/SabreTools.Data.Models/Metadata/Adjuster.cs
@@ -1,25 +1,60 @@
+using System;
using System.Xml.Serialization;
using Newtonsoft.Json;
namespace SabreTools.Data.Models.Metadata
{
[JsonObject("adjuster"), XmlRoot("adjuster")]
- public class Adjuster : DatItem
+ public class Adjuster : DatItem, ICloneable, IEquatable
{
- #region Keys
+ #region Properties
- // Condition
- [NoFilter]
- public const string ConditionKey = "condition";
+ public Condition? Condition { get; set; }
- /// bool
- public const string DefaultKey = "default";
+ /// (yes|no) "no"
+ public bool? Default { get; set; }
- /// string
- public const string NameKey = "name";
+ public string? Name { get; set; }
#endregion
- public Adjuster() => Type = ItemType.Adjuster;
+ public Adjuster() => ItemType = ItemType.Adjuster;
+
+ ///
+ public object Clone()
+ {
+ var obj = new Adjuster();
+
+ obj.Condition = Condition?.Clone() as Condition;
+ obj.Default = Default;
+ obj.Name = Name;
+
+ return obj;
+ }
+
+ ///
+ public bool Equals(Adjuster? other)
+ {
+ // Null never matches
+ if (other is null)
+ return false;
+
+ // Properties
+ if (Default != other.Default)
+ 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;
+
+ // Sub-items
+ if ((Condition is null) ^ (other.Condition is null))
+ return false;
+ else if (Condition is not null && other.Condition is not null && Condition.Equals(other.Condition))
+ return false;
+
+ return true;
+ }
}
}
diff --git a/SabreTools.Data.Models/Metadata/Analog.cs b/SabreTools.Data.Models/Metadata/Analog.cs
index b02d99bc..c99da0f0 100644
--- a/SabreTools.Data.Models/Metadata/Analog.cs
+++ b/SabreTools.Data.Models/Metadata/Analog.cs
@@ -1,18 +1,44 @@
-using System.Xml.Serialization;
+using System;
+using System.Xml.Serialization;
using Newtonsoft.Json;
namespace SabreTools.Data.Models.Metadata
{
[JsonObject("analog"), XmlRoot("analog")]
- public class Analog : DatItem
+ public class Analog : DatItem, ICloneable, IEquatable
{
- #region Keys
+ #region Properties
- /// string
- public const string MaskKey = "mask";
+ public string? Mask { get; set; }
#endregion
- public Analog() => Type = ItemType.Analog;
+ public Analog() => ItemType = ItemType.Analog;
+
+ ///
+ public object Clone()
+ {
+ var obj = new Analog();
+
+ obj.Mask = Mask;
+
+ return obj;
+ }
+
+ ///
+ public bool Equals(Analog? other)
+ {
+ // Null never matches
+ if (other is null)
+ return false;
+
+ // Properties
+ if ((Mask is null) ^ (other.Mask is null))
+ return false;
+ else if (Mask is not null && !Mask.Equals(other.Mask, StringComparison.OrdinalIgnoreCase))
+ return false;
+
+ return true;
+ }
}
}
diff --git a/SabreTools.Data.Models/Metadata/Archive.cs b/SabreTools.Data.Models/Metadata/Archive.cs
index d80c9ecd..d46641c2 100644
--- a/SabreTools.Data.Models/Metadata/Archive.cs
+++ b/SabreTools.Data.Models/Metadata/Archive.cs
@@ -1,114 +1,310 @@
-using System.Xml.Serialization;
+using System;
+using System.Xml.Serialization;
using Newtonsoft.Json;
namespace SabreTools.Data.Models.Metadata
{
[JsonObject("archive"), XmlRoot("archive")]
- public class Archive : DatItem
+ public class Archive : DatItem, ICloneable, IEquatable
{
- #region Keys
+ #region Properties
- /// string, No-Intro DB extension
- public const string NumberKey = "number";
+ /// No-Intro DB extension
+ public string? Additional { get; set; }
- /// string, No-Intro DB extension
- public const string CloneKey = "clone";
+ /// (0|1) "0", No-Intro DB extension
+ public bool? Adult { get; set; }
- /// string, No-Intro DB extension
- public const string RegParentKey = "regparent";
+ /// (0|1) "0", No-Intro DB extension
+ public bool? Alt { get; set; }
- /// string, No-Intro DB extension
- public const string MergeOfKey = "mergeof";
+ /// (0|1) "0", No-Intro DB extension
+ public bool? Bios { get; set; }
- /// string, No-Intro DB extension
- public const string MergeNameKey = "mergename";
+ /// No-Intro DB extension
+ public string? Categories { get; set; }
- /// string
- public const string NameKey = "name";
+ /// No-Intro DB extension
+ public string? CloneTag { get; set; }
- /// string, No-Intro DB extension
- public const string NameAltKey = "name_alt";
+ /// (0|1) "0", No-Intro DB extension
+ public bool? Complete { get; set; }
- /// string, No-Intro DB extension
- public const string RegionKey = "region";
+ /// (0|1) "0", No-Intro DB extension
+ public bool? Dat { get; set; }
- /// string, No-Intro DB extension
- public const string LanguagesKey = "languages";
+ /// No-Intro DB extension
+ public string? DatterNote { get; set; }
- /// byte, No-Intro DB extension
- public const string ShowLangKey = "showlang";
+ /// No-Intro DB extension
+ public string? Description { get; set; }
- /// string, No-Intro DB extension
- public const string LangCheckedKey = "langchecked";
+ /// No-Intro DB extension
+ public string? DevStatus { get; set; }
- /// string, No-Intro DB extension
- public const string Version1Key = "version1";
+ /// No-Intro DB extension
+ public string? GameId1 { get; set; }
- /// string, No-Intro DB extension
- public const string Version2Key = "version2";
+ /// No-Intro DB extension
+ public string? GameId2 { get; set; }
- /// string, No-Intro DB extension
- public const string DevStatusKey = "devstatus";
+ /// No-Intro DB extension
+ public string? LangChecked { get; set; }
- /// string, No-Intro DB extension
- public const string AdditionalKey = "additional";
+ /// No-Intro DB extension
+ public string? Languages { get; set; }
- /// string, No-Intro DB extension
- public const string Special1Key = "special1";
+ /// (0|1) "0", No-Intro DB extension
+ public bool? Licensed { get; set; }
- /// string, No-Intro DB extension
- public const string Special2Key = "special2";
+ /// (0|1) "0", No-Intro DB extension
+ public bool? Listed { get; set; }
- /// byte, No-Intro DB extension
- public const string AltKey = "alt";
+ /// No-Intro DB extension
+ public string? MergeOf { get; set; }
- /// string, No-Intro DB extension
- public const string GameId1Key = "gameid1";
+ /// No-Intro DB extension
+ public string? MergeName { get; set; }
- /// string, No-Intro DB extension
- public const string GameId2Key = "gameid2";
+ public string? Name { get; set; }
- /// string, No-Intro DB extension
- public const string DescriptionKey = "description";
+ /// No-Intro DB extension
+ public string? NameAlt { get; set; }
- /// byte, No-Intro DB extension
- public const string BiosKey = "bios";
+ /// No-Intro DB extension
+ public string? Number { get; set; }
- /// byte, No-Intro DB extension
- public const string LicensedKey = "licensed";
+ /// (0|1) "0", No-Intro DB extension
+ public bool? Physical { get; set; }
- /// byte, No-Intro DB extension
- public const string PirateKey = "pirate";
+ /// (0|1) "0", No-Intro DB extension
+ public bool? Pirate { get; set; }
- /// byte, No-Intro DB extension
- public const string PhysicalKey = "physical";
+ /// (0|1) "0", No-Intro DB extension
+ public bool? Private { get; set; }
- /// byte, No-Intro DB extension
- public const string CompleteKey = "complete";
+ /// No-Intro DB extension
+ public string? Region { get; set; }
- /// byte, No-Intro DB extension
- public const string AdultKey = "adult";
+ /// No-Intro DB extension
+ public string? RegParent { get; set; }
- /// byte, No-Intro DB extension
- public const string DatKey = "dat";
+ /// (0|1) "0", No-Intro DB extension
+ public bool? ShowLang { get; set; }
- /// byte, No-Intro DB extension
- public const string ListedKey = "listed";
+ /// No-Intro DB extension
+ public string? Special1 { get; set; }
- /// byte, No-Intro DB extension
- public const string PrivateKey = "private";
+ /// No-Intro DB extension
+ public string? Special2 { get; set; }
- /// string, No-Intro DB extension
- public const string StickyNoteKey = "stickynote";
+ /// No-Intro DB extension
+ public string? StickyNote { get; set; }
- /// string, No-Intro DB extension
- public const string DatterNoteKey = "datternote";
+ /// No-Intro DB extension
+ public string? Version1 { get; set; }
- /// string, No-Intro DB extension
- public const string CategoriesKey = "categories";
+ /// No-Intro DB extension
+ public string? Version2 { get; set; }
#endregion
- public Archive() => Type = ItemType.Archive;
+ public Archive() => ItemType = ItemType.Archive;
+
+ ///
+ public object Clone()
+ {
+ var obj = new Archive();
+
+ obj.Additional = Additional;
+ obj.Adult = Adult;
+ obj.Alt = Alt;
+ obj.Bios = Bios;
+ obj.Categories = Categories;
+ obj.CloneTag = CloneTag;
+ obj.Complete = Complete;
+ obj.Dat = Dat;
+ obj.DatterNote = DatterNote;
+ obj.Description = Description;
+ obj.DevStatus = DevStatus;
+ obj.GameId1 = GameId1;
+ obj.GameId2 = GameId2;
+ obj.LangChecked = LangChecked;
+ obj.Languages = Languages;
+ obj.Licensed = Licensed;
+ obj.Listed = Listed;
+ obj.MergeOf = MergeOf;
+ obj.MergeName = MergeName;
+ obj.Name = Name;
+ obj.NameAlt = NameAlt;
+ obj.Number = Number;
+ obj.Physical = Physical;
+ obj.Pirate = Pirate;
+ obj.Private = Private;
+ obj.Region = Region;
+ obj.RegParent = RegParent;
+ obj.ShowLang = ShowLang;
+ obj.Special1 = Special1;
+ obj.Special2 = Special2;
+ obj.StickyNote = StickyNote;
+ obj.Version1 = Version1;
+ obj.Version2 = Version2;
+
+ return obj;
+ }
+
+ ///
+ public bool Equals(Archive? other)
+ {
+ // Null never matches
+ if (other is null)
+ return false;
+
+ // Properties
+ if ((Additional is null) ^ (other.Additional is null))
+ return false;
+ else if (Additional is not null && !Additional.Equals(other.Additional, StringComparison.OrdinalIgnoreCase))
+ return false;
+
+ if (Adult != other.Adult)
+ return false;
+
+ if (Alt != other.Alt)
+ return false;
+
+ if (Bios != other.Bios)
+ return false;
+
+ if ((Categories is null) ^ (other.Categories is null))
+ return false;
+ else if (Categories is not null && !Categories.Equals(other.Categories, StringComparison.OrdinalIgnoreCase))
+ return false;
+
+ if ((CloneTag is null) ^ (other.CloneTag is null))
+ return false;
+ else if (CloneTag is not null && !CloneTag.Equals(other.CloneTag, StringComparison.OrdinalIgnoreCase))
+ return false;
+
+ if (Complete != other.Complete)
+ return false;
+
+ if (Dat != other.Dat)
+ return false;
+
+ if ((DatterNote is null) ^ (other.DatterNote is null))
+ return false;
+ else if (DatterNote is not null && !DatterNote.Equals(other.DatterNote, StringComparison.OrdinalIgnoreCase))
+ 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 ((DevStatus is null) ^ (other.DevStatus is null))
+ return false;
+ else if (DevStatus is not null && !DevStatus.Equals(other.DevStatus, StringComparison.OrdinalIgnoreCase))
+ return false;
+
+ if ((GameId1 is null) ^ (other.GameId1 is null))
+ return false;
+ else if (GameId1 is not null && !GameId1.Equals(other.GameId1, StringComparison.OrdinalIgnoreCase))
+ return false;
+
+ if ((GameId2 is null) ^ (other.GameId2 is null))
+ return false;
+ else if (GameId2 is not null && !GameId2.Equals(other.GameId2, StringComparison.OrdinalIgnoreCase))
+ return false;
+
+ if ((LangChecked is null) ^ (other.LangChecked is null))
+ return false;
+ else if (LangChecked is not null && !LangChecked.Equals(other.LangChecked, StringComparison.OrdinalIgnoreCase))
+ return false;
+
+ if ((Languages is null) ^ (other.Languages is null))
+ return false;
+ else if (Languages is not null && !Languages.Equals(other.Languages, StringComparison.OrdinalIgnoreCase))
+ return false;
+
+ if (Licensed != other.Licensed)
+ return false;
+
+ if (Listed != other.Listed)
+ return false;
+
+ if ((MergeOf is null) ^ (other.MergeOf is null))
+ return false;
+ else if (MergeOf is not null && !MergeOf.Equals(other.MergeOf, StringComparison.OrdinalIgnoreCase))
+ return false;
+
+ if ((MergeName is null) ^ (other.MergeName is null))
+ return false;
+ else if (MergeName is not null && !MergeName.Equals(other.MergeName, 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 ((NameAlt is null) ^ (other.NameAlt is null))
+ return false;
+ else if (NameAlt is not null && !NameAlt.Equals(other.NameAlt, StringComparison.OrdinalIgnoreCase))
+ return false;
+
+ if ((Number is null) ^ (other.Number is null))
+ return false;
+ else if (Number is not null && !Number.Equals(other.Number, StringComparison.OrdinalIgnoreCase))
+ return false;
+
+ if (Physical != other.Physical)
+ return false;
+
+ if (Pirate != other.Pirate)
+ return false;
+
+ if (Private != other.Private)
+ return false;
+
+ if ((Region is null) ^ (other.Region is null))
+ return false;
+ else if (Region is not null && !Region.Equals(other.Region, StringComparison.OrdinalIgnoreCase))
+ return false;
+
+ if ((RegParent is null) ^ (other.RegParent is null))
+ return false;
+ else if (RegParent is not null && !RegParent.Equals(other.RegParent, StringComparison.OrdinalIgnoreCase))
+ return false;
+
+ if (ShowLang != other.ShowLang)
+ return false;
+
+ if ((Special1 is null) ^ (other.Special1 is null))
+ return false;
+ else if (Special1 is not null && !Special1.Equals(other.Special1, StringComparison.OrdinalIgnoreCase))
+ return false;
+
+ if ((Special2 is null) ^ (other.Special2 is null))
+ return false;
+ else if (Special2 is not null && !Special2.Equals(other.Special2, StringComparison.OrdinalIgnoreCase))
+ return false;
+
+ if ((StickyNote is null) ^ (other.StickyNote is null))
+ return false;
+ else if (StickyNote is not null && !StickyNote.Equals(other.StickyNote, StringComparison.OrdinalIgnoreCase))
+ return false;
+
+ if ((Version1 is null) ^ (other.Version1 is null))
+ return false;
+ else if (Version1 is not null && !Version1.Equals(other.Version1, StringComparison.OrdinalIgnoreCase))
+ return false;
+
+ if ((Version2 is null) ^ (other.Version2 is null))
+ return false;
+ else if (Version2 is not null && !Version2.Equals(other.Version2, StringComparison.OrdinalIgnoreCase))
+ return false;
+
+ return true;
+ }
}
}
diff --git a/SabreTools.Data.Models/Metadata/BiosSet.cs b/SabreTools.Data.Models/Metadata/BiosSet.cs
index 08600ba8..d8d89f38 100644
--- a/SabreTools.Data.Models/Metadata/BiosSet.cs
+++ b/SabreTools.Data.Models/Metadata/BiosSet.cs
@@ -1,24 +1,59 @@
+using System;
using System.Xml.Serialization;
using Newtonsoft.Json;
namespace SabreTools.Data.Models.Metadata
{
[JsonObject("biosset"), XmlRoot("biosset")]
- public class BiosSet : DatItem
+ public class BiosSet : DatItem, ICloneable, IEquatable
{
- #region Keys
+ #region Properties
- /// bool
- public const string DefaultKey = "default";
+ /// (yes|no) "no"
+ public bool? Default { get; set; }
- /// string
- public const string DescriptionKey = "description";
+ public string? Description { get; set; }
- /// string
- public const string NameKey = "name";
+ public string? Name { get; set; }
#endregion
- public BiosSet() => Type = ItemType.BiosSet;
+ public BiosSet() => ItemType = ItemType.BiosSet;
+
+ ///
+ public object Clone()
+ {
+ var obj = new BiosSet();
+
+ obj.Default = Default;
+ obj.Description = Description;
+ obj.Name = Name;
+
+ return obj;
+ }
+
+ ///
+ public bool Equals(BiosSet? other)
+ {
+ // Null never matches
+ if (other is null)
+ return false;
+
+ // Properties
+ if (Default != other.Default)
+ 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 ((Name is null) ^ (other.Name is null))
+ return false;
+ else if (Name is not null && !Name.Equals(other.Name, StringComparison.OrdinalIgnoreCase))
+ return false;
+
+ return true;
+ }
}
}
diff --git a/SabreTools.Data.Models/Metadata/Blank.cs b/SabreTools.Data.Models/Metadata/Blank.cs
index 411f0273..8d095192 100644
--- a/SabreTools.Data.Models/Metadata/Blank.cs
+++ b/SabreTools.Data.Models/Metadata/Blank.cs
@@ -1,11 +1,18 @@
+using System;
using System.Xml.Serialization;
using Newtonsoft.Json;
namespace SabreTools.Data.Models.Metadata
{
[JsonObject("blank"), XmlRoot("blank")]
- public class Blank : DatItem
+ public class Blank : DatItem, ICloneable, IEquatable
{
- public Blank() => Type = ItemType.Blank;
+ public Blank() => ItemType = ItemType.Blank;
+
+ ///
+ public object Clone() => new Blank();
+
+ ///
+ public bool Equals(Blank? other) => other is not null;
}
}
diff --git a/SabreTools.Data.Models/Metadata/Chip.cs b/SabreTools.Data.Models/Metadata/Chip.cs
index c3a512b0..e55ac97f 100644
--- a/SabreTools.Data.Models/Metadata/Chip.cs
+++ b/SabreTools.Data.Models/Metadata/Chip.cs
@@ -1,33 +1,80 @@
+using System;
using System.Xml.Serialization;
using Newtonsoft.Json;
namespace SabreTools.Data.Models.Metadata
{
[JsonObject("chip"), XmlRoot("chip")]
- public class Chip : DatItem
+ public class Chip : DatItem, ICloneable, IEquatable
{
- #region Keys
-
- /// long
- public const string ClockKey = "clock";
-
- /// string
- public const string FlagsKey = "flags";
-
- /// string
- public const string NameKey = "name";
-
- /// (yes|no) "no"
- public const string SoundOnlyKey = "soundonly";
-
- /// string
- public const string TagKey = "tag";
+ #region Properties
/// (cpu|audio)
- public const string ChipTypeKey = "type";
+ public ChipType? ChipType { get; set; }
+
+ public long? Clock { get; set; }
+
+ public string? Flags { get; set; }
+
+ public string? Name { get; set; }
+
+ /// (yes|no) "no"
+ public bool? SoundOnly { get; set; }
+
+ public string? Tag { get; set; }
#endregion
- public Chip() => Type = ItemType.Chip;
+ public Chip() => ItemType = ItemType.Chip;
+
+ ///
+ public object Clone()
+ {
+ var obj = new Chip();
+
+ obj.ChipType = ChipType;
+ obj.Clock = Clock;
+ obj.Flags = Flags;
+ obj.Name = Name;
+ obj.SoundOnly = SoundOnly;
+ obj.Tag = Tag;
+
+ return obj;
+ }
+
+ ///
+ public bool Equals(Chip? other)
+ {
+ // Null never matches
+ if (other is null)
+ return false;
+
+ // Properties
+ if (ChipType != other.ChipType)
+ return false;
+
+ if (Clock != other.Clock)
+ return false;
+
+ if ((Flags is null) ^ (other.Flags is null))
+ return false;
+ else if (Flags is not null && !Flags.Equals(other.Flags, 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 (SoundOnly != other.SoundOnly)
+ return false;
+
+ if ((Tag is null) ^ (other.Tag is null))
+ return false;
+ else if (Tag is not null && !Tag.Equals(other.Tag, StringComparison.OrdinalIgnoreCase))
+ return false;
+
+ return true;
+ }
}
}
diff --git a/SabreTools.Data.Models/Metadata/Condition.cs b/SabreTools.Data.Models/Metadata/Condition.cs
index ead68ff2..b6daea52 100644
--- a/SabreTools.Data.Models/Metadata/Condition.cs
+++ b/SabreTools.Data.Models/Metadata/Condition.cs
@@ -1,27 +1,67 @@
+using System;
using System.Xml.Serialization;
using Newtonsoft.Json;
namespace SabreTools.Data.Models.Metadata
{
[JsonObject("condition"), XmlRoot("condition")]
- public class Condition : DatItem
+ public class Condition : DatItem, ICloneable, IEquatable
{
- #region Keys
+ #region Properties
- /// string
- public const string ValueKey = "clock";
-
- /// string
- public const string MaskKey = "mask";
+ public string? Mask { get; set; }
/// (eq|ne|gt|le|lt|ge)
- public const string RelationKey = "relation";
+ public Relation? Relation { get; set; }
- /// string
- public const string TagKey = "tag";
+ public string? Tag { get; set; }
+
+ public string? Value { get; set; }
#endregion
- public Condition() => Type = ItemType.Condition;
+ public Condition() => ItemType = ItemType.Condition;
+
+ ///
+ public object Clone()
+ {
+ var obj = new Condition();
+
+ obj.Mask = Mask;
+ obj.Relation = Relation;
+ obj.Tag = Tag;
+ obj.Value = Value;
+
+ return obj;
+ }
+
+ ///
+ public bool Equals(Condition? other)
+ {
+ // Null never matches
+ if (other is null)
+ return false;
+
+ // Properties
+ if ((Mask is null) ^ (other.Mask is null))
+ return false;
+ else if (Mask is not null && !Mask.Equals(other.Mask, StringComparison.OrdinalIgnoreCase))
+ return false;
+
+ if (Relation != other.Relation)
+ return false;
+
+ if ((Tag is null) ^ (other.Tag is null))
+ return false;
+ else if (Tag is not null && !Tag.Equals(other.Tag, StringComparison.OrdinalIgnoreCase))
+ return false;
+
+ if ((Value is null) ^ (other.Value is null))
+ return false;
+ else if (Value is not null && !Value.Equals(other.Value, StringComparison.OrdinalIgnoreCase))
+ return false;
+
+ return true;
+ }
}
}
diff --git a/SabreTools.Data.Models/Metadata/ConfLocation.cs b/SabreTools.Data.Models/Metadata/ConfLocation.cs
index d26305c6..bea51e61 100644
--- a/SabreTools.Data.Models/Metadata/ConfLocation.cs
+++ b/SabreTools.Data.Models/Metadata/ConfLocation.cs
@@ -1,24 +1,57 @@
+using System;
using System.Xml.Serialization;
using Newtonsoft.Json;
namespace SabreTools.Data.Models.Metadata
{
[JsonObject("conflocation"), XmlRoot("conflocation")]
- public class ConfLocation : DatItem
+ public class ConfLocation : DatItem, ICloneable, IEquatable
{
- #region Keys
+ #region Properties
/// (yes|no) "no"
- public const string InvertedKey = "inverted";
+ public bool? Inverted { get; set; }
- /// string
- public const string NameKey = "name";
+ public string? Name { get; set; }
- /// string, possibly long
- public const string NumberKey = "number";
+ public long? Number { get; set; }
#endregion
- public ConfLocation() => Type = ItemType.ConfLocation;
+ public ConfLocation() => ItemType = ItemType.ConfLocation;
+
+ ///
+ public object Clone()
+ {
+ var obj = new ConfLocation();
+
+ obj.Inverted = Inverted;
+ obj.Name = Name;
+ obj.Number = Number;
+
+ return obj;
+ }
+
+ ///
+ public bool Equals(ConfLocation? other)
+ {
+ // Null never matches
+ if (other is null)
+ return false;
+
+ // Properties
+ if (Inverted != other.Inverted)
+ 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 (Number != other.Number)
+ return false;
+
+ return true;
+ }
}
}
diff --git a/SabreTools.Data.Models/Metadata/ConfSetting.cs b/SabreTools.Data.Models/Metadata/ConfSetting.cs
index f5e1d706..8a0676c2 100644
--- a/SabreTools.Data.Models/Metadata/ConfSetting.cs
+++ b/SabreTools.Data.Models/Metadata/ConfSetting.cs
@@ -1,28 +1,68 @@
+using System;
using System.Xml.Serialization;
using Newtonsoft.Json;
namespace SabreTools.Data.Models.Metadata
{
[JsonObject("confsetting"), XmlRoot("confsetting")]
- public class ConfSetting : DatItem
+ public class ConfSetting : DatItem, ICloneable, IEquatable
{
- #region Keys
+ #region Properties
- /// Condition
- [NoFilter]
- public const string ConditionKey = "condition";
+ public Condition? Condition { get; set; }
/// (yes|no) "no"
- public const string DefaultKey = "default";
+ public bool? Default { get; set; }
- /// string
- public const string NameKey = "name";
+ public string? Name { get; set; }
- /// string
- public const string ValueKey = "value";
+ public string? Value { get; set; }
#endregion
- public ConfSetting() => Type = ItemType.ConfSetting;
+ public ConfSetting() => ItemType = ItemType.ConfSetting;
+
+ ///
+ public object Clone()
+ {
+ var obj = new ConfSetting();
+
+ obj.Condition = Condition?.Clone() as Condition;
+ obj.Default = Default;
+ obj.Name = Name;
+ obj.Value = Value;
+
+ return obj;
+ }
+
+ ///
+ public bool Equals(ConfSetting? other)
+ {
+ // Null never matches
+ if (other is null)
+ return false;
+
+ // Properties
+ if (Default != other.Default)
+ 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 ((Value is null) ^ (other.Value is null))
+ return false;
+ else if (Value is not null && !Value.Equals(other.Value, StringComparison.OrdinalIgnoreCase))
+ return false;
+
+ // Sub-items
+ if ((Condition is null) ^ (other.Condition is null))
+ return false;
+ else if (Condition is not null && other.Condition is not null && Condition.Equals(other.Condition))
+ return false;
+
+ return true;
+ }
}
}
diff --git a/SabreTools.Data.Models/Metadata/Configuration.cs b/SabreTools.Data.Models/Metadata/Configuration.cs
index baeea5ed..13bf012f 100644
--- a/SabreTools.Data.Models/Metadata/Configuration.cs
+++ b/SabreTools.Data.Models/Metadata/Configuration.cs
@@ -1,36 +1,79 @@
+using System;
using System.Xml.Serialization;
using Newtonsoft.Json;
namespace SabreTools.Data.Models.Metadata
{
[JsonObject("configuration"), XmlRoot("configuration")]
- public class Configuration : DatItem
+ public class Configuration : DatItem, ICloneable, IEquatable
{
- #region Keys
+ #region Properties
- /// Condition
- [NoFilter]
- public const string ConditionKey = "condition";
+ public Condition? Condition { get; set; }
- /// ConfLocation[]
- [NoFilter]
- public const string ConfLocationKey = "conflocation";
+ public ConfLocation[]? ConfLocation { get; set; }
- /// ConfSetting[]
- [NoFilter]
- public const string ConfSettingKey = "confsetting";
+ public ConfSetting[]? ConfSetting { get; set; }
- /// string
- public const string MaskKey = "mask";
+ public string? Mask { get; set; }
- /// string
- public const string NameKey = "name";
+ public string? Name { get; set; }
- /// string
- public const string TagKey = "tag";
+ public string? Tag { get; set; }
#endregion
- public Configuration() => Type = ItemType.Configuration;
+ public Configuration() => ItemType = ItemType.Configuration;
+
+ ///
+ public object Clone()
+ {
+ var obj = new Configuration();
+
+ obj.Condition = Condition?.Clone() as Condition;
+ if (ConfLocation is not null)
+ obj.ConfLocation = Array.ConvertAll(ConfLocation, i => (ConfLocation)i.Clone());
+ if (ConfSetting is not null)
+ obj.ConfSetting = Array.ConvertAll(ConfSetting, i => (ConfSetting)i.Clone());
+ obj.Mask = Mask;
+ obj.Name = Name;
+ obj.Tag = Tag;
+
+ return obj;
+ }
+
+ ///
+ public bool Equals(Configuration? other)
+ {
+ // Null never matches
+ if (other is null)
+ return false;
+
+ // Properties
+ if ((Mask is null) ^ (other.Mask is null))
+ return false;
+ else if (Mask is not null && !Mask.Equals(other.Mask, 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 ((Tag is null) ^ (other.Tag is null))
+ return false;
+ else if (Tag is not null && !Tag.Equals(other.Tag, StringComparison.OrdinalIgnoreCase))
+ return false;
+
+ // Sub-items
+ if ((Condition is null) ^ (other.Condition is null))
+ return false;
+ else if (Condition is not null && other.Condition is not null && Condition.Equals(other.Condition))
+ return false;
+
+ // TODO: Figure out how to properly check arrays
+
+ return true;
+ }
}
}
diff --git a/SabreTools.Data.Models/Metadata/Control.cs b/SabreTools.Data.Models/Metadata/Control.cs
index b14eee03..11268628 100644
--- a/SabreTools.Data.Models/Metadata/Control.cs
+++ b/SabreTools.Data.Models/Metadata/Control.cs
@@ -1,51 +1,116 @@
+using System;
using System.Xml.Serialization;
using Newtonsoft.Json;
namespace SabreTools.Data.Models.Metadata
{
[JsonObject("control"), XmlRoot("control")]
- public class Control : DatItem
+ public class Control : DatItem, ICloneable, IEquatable
{
- #region Keys
+ #region Properties
- /// long
- public const string ButtonsKey = "buttons";
-
- /// long
- public const string KeyDeltaKey = "keydelta";
-
- /// long
- public const string MaximumKey = "maximum";
-
- /// long
- public const string MinimumKey = "minimum";
-
- /// long
- public const string PlayerKey = "player";
-
- /// long
- public const string ReqButtonsKey = "reqbuttons";
-
- /// (yes|no) "no"
- public const string ReverseKey = "reverse";
-
- /// long
- public const string SensitivityKey = "sensitivity";
+ public long? Buttons { get; set; }
/// (joy|stick|paddle|pedal|lightgun|positional|dial|trackball|mouse|only_buttons|keypad|keyboard|mahjong|hanafuda|gambling)
- public const string ControlTypeKey = "type";
+ public ControlType? ControlType { get; set; }
- /// string, possibly long
- public const string WaysKey = "ways";
+ public long? KeyDelta { get; set; }
- /// string, possibly long
- public const string Ways2Key = "ways2";
+ public long? Maximum { get; set; }
- /// string, possibly long
- public const string Ways3Key = "ways3";
+ public long? Minimum { get; set; }
+
+ public long? Player { get; set; }
+
+ public long? ReqButtons { get; set; }
+
+ /// (yes|no) "no"
+ public bool? Reverse { get; set; }
+
+ public long? Sensitivity { get; set; }
+
+ public string? Ways { get; set; }
+
+ public string? Ways2 { get; set; }
+
+ public string? Ways3 { get; set; }
#endregion
- public Control() => Type = ItemType.Control;
+ public Control() => ItemType = ItemType.Control;
+
+ ///
+ public object Clone()
+ {
+ var obj = new Control();
+
+ obj.Buttons = Buttons;
+ obj.ControlType = ControlType;
+ obj.KeyDelta = KeyDelta;
+ obj.Maximum = Maximum;
+ obj.Minimum = Minimum;
+ obj.Player = Player;
+ obj.ReqButtons = ReqButtons;
+ obj.Reverse = Reverse;
+ obj.Sensitivity = Sensitivity;
+ obj.Ways = Ways;
+ obj.Ways2 = Ways2;
+ obj.Ways3 = Ways3;
+
+ return obj;
+ }
+
+ ///
+ public bool Equals(Control? other)
+ {
+ // Null never matches
+ if (other is null)
+ return false;
+
+ // Properties
+ if (Buttons != other.Buttons)
+ return false;
+
+ if (ControlType != other.ControlType)
+ return false;
+
+ if (KeyDelta != other.KeyDelta)
+ return false;
+
+ if (Maximum != other.Maximum)
+ return false;
+
+ if (Minimum != other.Minimum)
+ return false;
+
+ if (Player != other.Player)
+ return false;
+
+ if (ReqButtons != other.ReqButtons)
+ return false;
+
+ if (Reverse != other.Reverse)
+ return false;
+
+ if (Sensitivity != other.Sensitivity)
+ return false;
+
+ if ((Ways is null) ^ (other.Ways is null))
+ return false;
+ else if (Ways is not null && !Ways.Equals(other.Ways, StringComparison.OrdinalIgnoreCase))
+ return false;
+
+ if ((Ways2 is null) ^ (other.Ways2 is null))
+ return false;
+ else if (Ways2 is not null && !Ways2.Equals(other.Ways2, StringComparison.OrdinalIgnoreCase))
+ return false;
+
+ if ((Ways3 is null) ^ (other.Ways3 is null))
+ return false;
+ else if (Ways3 is not null && !Ways3.Equals(other.Ways3, StringComparison.OrdinalIgnoreCase))
+ return false;
+
+ return true;
+ }
}
}
diff --git a/SabreTools.Data.Models/Metadata/DatItem.cs b/SabreTools.Data.Models/Metadata/DatItem.cs
index 47a1c59e..8b3c2e7e 100644
--- a/SabreTools.Data.Models/Metadata/DatItem.cs
+++ b/SabreTools.Data.Models/Metadata/DatItem.cs
@@ -6,22 +6,12 @@ namespace SabreTools.Data.Models.Metadata
///
/// Format-agnostic representation of item data
///
- public class DatItem : DictionaryBase
+ public abstract class DatItem
{
- #region Common Keys
-
- public const string TypeKey = "_type";
-
- #endregion
-
///
- /// Quick accessor to item type, if it exists
+ /// Quick accessor to item type
///
[JsonProperty("itemtype", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("itemtype")]
- public ItemType? Type
- {
- get => ContainsKey(TypeKey) ? this[TypeKey] as ItemType? : null;
- set => this[TypeKey] = value;
- }
+ public ItemType ItemType { get; protected set; }
}
}
diff --git a/SabreTools.Data.Models/Metadata/DataArea.cs b/SabreTools.Data.Models/Metadata/DataArea.cs
index 2a2b989d..cbbb9944 100644
--- a/SabreTools.Data.Models/Metadata/DataArea.cs
+++ b/SabreTools.Data.Models/Metadata/DataArea.cs
@@ -1,31 +1,71 @@
+using System;
using System.Xml.Serialization;
using Newtonsoft.Json;
namespace SabreTools.Data.Models.Metadata
{
[JsonObject("dataarea"), XmlRoot("dataarea")]
- public class DataArea : DatItem
+ public class DataArea : DatItem, ICloneable, IEquatable
{
- #region Keys
+ #region Properties
/// (big|little) "little"
- public const string EndiannessKey = "endianness";
+ public Endianness? Endianness { get; set; }
- /// string
- public const string NameKey = "name";
+ public string? Name { get; set; }
- /// Rom[]
- [NoFilter]
- public const string RomKey = "rom";
+ public Rom[]? Rom { get; set; }
- /// long
- public const string SizeKey = "size";
+ public long? Size { get; set; }
/// (8|16|32|64) "8"
- public const string WidthKey = "width";
+ public Width? Width { get; set; }
#endregion
- public DataArea() => Type = ItemType.DataArea;
+ public DataArea() => ItemType = ItemType.DataArea;
+
+ ///
+ public object Clone()
+ {
+ var obj = new DataArea();
+
+ obj.Endianness = Endianness;
+ obj.Name = Name;
+ if (Rom is not null)
+ obj.Rom = Array.ConvertAll(Rom, i => (Rom)i.Clone());
+ obj.Size = Size;
+ obj.Width = Width;
+
+ return obj;
+ }
+
+ ///
+ public bool Equals(DataArea? other)
+ {
+ // Null never matches
+ if (other is null)
+ return false;
+
+ // Properties
+ if (Endianness != other.Endianness)
+ 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 (Size != other.Size)
+ return false;
+
+ if (Width != other.Width)
+ return false;
+
+ // Sub-items
+ // TODO: Figure out how to properly check arrays
+
+ return true;
+ }
}
}
diff --git a/SabreTools.Data.Models/Metadata/Device.cs b/SabreTools.Data.Models/Metadata/Device.cs
index b2ba3bdb..8e44cd27 100644
--- a/SabreTools.Data.Models/Metadata/Device.cs
+++ b/SabreTools.Data.Models/Metadata/Device.cs
@@ -1,38 +1,89 @@
+using System;
using System.Xml.Serialization;
using Newtonsoft.Json;
namespace SabreTools.Data.Models.Metadata
{
[JsonObject("device"), XmlRoot("device")]
- public class Device : DatItem
+ public class Device : DatItem, ICloneable, IEquatable
{
- #region Keys
-
- /// Extension[]
- [NoFilter]
- public const string ExtensionKey = "extension";
-
- /// string
- public const string FixedImageKey = "fixed_image";
-
- /// Instance
- [NoFilter]
- public const string InstanceKey = "instance";
-
- /// string
- public const string InterfaceKey = "interface";
-
- /// (0|1) "0"
- public const string MandatoryKey = "mandatory";
-
- /// string
- public const string TagKey = "tag";
+ #region Properties
/// (unknown|cartridge|floppydisk|harddisk|cylinder|cassette|punchcard|punchtape|printout|serial|parallel|snapshot|quickload|memcard|cdrom|magtape|romimage|midiin|midiout|picture|vidfile)
- public const string DeviceTypeKey = "type";
+ public DeviceType? DeviceType { get; set; }
+
+ public Extension[]? Extension { get; set; }
+
+ public string? FixedImage { get; set; }
+
+ public Instance? Instance { get; set; }
+
+ public string? Interface { get; set; }
+
+ /// (0|1) "0"
+ public bool? Mandatory { get; set; }
+
+ public string? Tag { get; set; }
#endregion
- public Device() => Type = ItemType.Device;
+ public Device() => ItemType = ItemType.Device;
+
+ ///
+ public object Clone()
+ {
+ var obj = new Device();
+
+ obj.DeviceType = DeviceType;
+ if (Extension is not null)
+ obj.Extension = Array.ConvertAll(Extension, i => (Extension)i.Clone());
+ obj.FixedImage = FixedImage;
+ obj.Instance = Instance?.Clone() as Instance;
+ obj.Interface = Interface;
+ obj.Mandatory = Mandatory;
+ obj.Tag = Tag;
+
+ return obj;
+ }
+
+ ///
+ public bool Equals(Device? other)
+ {
+ // Null never matches
+ if (other is null)
+ return false;
+
+ // Properties
+ if (DeviceType != other.DeviceType)
+ return false;
+
+ if ((FixedImage is null) ^ (other.FixedImage is null))
+ return false;
+ else if (FixedImage is not null && !FixedImage.Equals(other.FixedImage, StringComparison.OrdinalIgnoreCase))
+ return false;
+
+ if ((Interface is null) ^ (other.Interface is null))
+ return false;
+ else if (Interface is not null && !Interface.Equals(other.Interface, StringComparison.OrdinalIgnoreCase))
+ return false;
+
+ if (Mandatory != other.Mandatory)
+ return false;
+
+ if ((Tag is null) ^ (other.Tag is null))
+ return false;
+ else if (Tag is not null && !Tag.Equals(other.Tag, StringComparison.OrdinalIgnoreCase))
+ return false;
+
+ // Sub-items
+ if ((Instance is null) ^ (other.Instance is null))
+ return false;
+ else if (Instance is not null && other.Instance is not null && Instance.Equals(other.Instance))
+ return false;
+
+ // TODO: Figure out how to properly check arrays
+
+ return true;
+ }
}
}
diff --git a/SabreTools.Data.Models/Metadata/DeviceRef.cs b/SabreTools.Data.Models/Metadata/DeviceRef.cs
index 31223b86..36cfbc7b 100644
--- a/SabreTools.Data.Models/Metadata/DeviceRef.cs
+++ b/SabreTools.Data.Models/Metadata/DeviceRef.cs
@@ -1,18 +1,44 @@
+using System;
using System.Xml.Serialization;
using Newtonsoft.Json;
namespace SabreTools.Data.Models.Metadata
{
[JsonObject("device_ref"), XmlRoot("device_ref")]
- public class DeviceRef : DatItem
+ public class DeviceRef : DatItem, ICloneable, IEquatable
{
- #region Keys
+ #region Properties
- /// string
- public const string NameKey = "name";
+ public string? Name { get; set; }
#endregion
- public DeviceRef() => Type = ItemType.DeviceRef;
+ public DeviceRef() => ItemType = ItemType.DeviceRef;
+
+ ///
+ public object Clone()
+ {
+ var obj = new DeviceRef();
+
+ obj.Name = Name;
+
+ return obj;
+ }
+
+ ///
+ public bool Equals(DeviceRef? other)
+ {
+ // Null never matches
+ if (other is null)
+ return false;
+
+ // Properties
+ if ((Name is null) ^ (other.Name is null))
+ return false;
+ else if (Name is not null && !Name.Equals(other.Name, StringComparison.OrdinalIgnoreCase))
+ return false;
+
+ return true;
+ }
}
}
diff --git a/SabreTools.Data.Models/Metadata/DictionaryBase.cs b/SabreTools.Data.Models/Metadata/DictionaryBase.cs
deleted file mode 100644
index 4548c583..00000000
--- a/SabreTools.Data.Models/Metadata/DictionaryBase.cs
+++ /dev/null
@@ -1,259 +0,0 @@
-using System.Collections.Generic;
-
-namespace SabreTools.Data.Models.Metadata
-{
- ///
- /// Specialized dictionary base for item types
- ///
- public abstract class DictionaryBase : Dictionary
- {
- #region Read
-
- ///
- /// Read a key as the specified type, returning null on error
- ///
- public T? Read(string key)
- {
- try
- {
- if (!ValidateReadKey(key))
- return default;
- if (this[key] is not T)
- return default;
- return (T?)this[key];
- }
- catch
- {
- return default;
- }
- }
-
- ///
- /// Read a key as a bool, returning null on error
- ///
- public bool? ReadBool(string key)
- {
- if (!ValidateReadKey(key))
- return null;
-
- bool? asBool = Read(key);
- if (asBool is not null)
- return asBool;
-
- string? asString = Read(key);
- return asString?.ToLowerInvariant() switch
- {
- "true" or "yes" => true,
- "false" or "no" => false,
- _ => null,
- };
- }
-
- ///
- /// Read a key as a double, returning null on error
- ///
- public double? ReadDouble(string key)
- {
- if (!ValidateReadKey(key))
- return null;
-
- double? asDouble = Read(key);
- if (asDouble is not null)
- return asDouble;
-
- float? asFloat = Read(key);
- if (asFloat is not null)
- return asFloat;
-
-#if NET5_0_OR_GREATER
- System.Half? asHalf = Read(key);
- if (asHalf is not null)
- return (double?)asHalf;
-#endif
-
- string? asString = Read(key);
- if (asString is not null && double.TryParse(asString, out double asStringDouble))
- return asStringDouble;
-
- return null;
- }
-
- ///
- /// Read a key as a long, returning null on error
- ///
- /// TODO: Add logic to convert SI suffixes and hex
- public long? ReadLong(string key)
- {
- if (!ValidateReadKey(key))
- return null;
-
- long? asLong = Read(key);
- if (asLong is not null)
- return asLong;
-
- int? asInt = Read(key);
- if (asInt is not null)
- return asInt;
-
- short? asShort = Read(key);
- if (asShort is not null)
- return asShort;
-
- string? asString = Read(key);
- if (asString is not null && long.TryParse(asString, out long asStringLong))
- return asStringLong;
-
- return null;
- }
-
- ///
- /// Read a key as a string, returning null on error
- ///
- public string? ReadString(string key)
- {
- if (!ValidateReadKey(key))
- return null;
-
- string? asString = Read(key);
- if (asString is not null)
- return asString;
-
- string[]? asArray = Read(key);
- if (asArray is not null)
-#if NETFRAMEWORK || NETSTANDARD2_0
- return string.Join(",", asArray);
-#else
- return string.Join(',', asArray);
-#endif
-
- // TODO: Add byte array conversion here
- // TODO: Add byte array read helper
-
- return this[key]!.ToString();
- }
-
- ///
- /// Read a key as a T[], returning null on error
- ///
- public T[]? ReadArray(string key)
- {
- if (!ValidateReadKey(key))
- return null;
-
- var items = Read(key);
- if (items is not null)
- return items;
-
- var single = Read(key);
- if (single is not null)
- return [single];
-
- return null;
- }
-
- ///
- /// Read a key as a string[], returning null on error
- ///
- public string[]? ReadStringArray(string key)
- {
- if (!ValidateReadKey(key))
- return null;
-
- string[]? asArray = Read(key);
- if (asArray is not null)
- return asArray;
-
- string? asString = Read(key);
- if (asString is not null)
- return [asString];
-
- asString = this[key]!.ToString();
- if (asString is not null)
- return [asString];
-
- return null;
- }
-
- ///
- /// Check if a key is valid for read
- ///
- private bool ValidateReadKey(string key)
- {
- if (string.IsNullOrEmpty(key))
- return false;
- else if (!ContainsKey(key))
- return false;
- else if (this[key] is null)
- return false;
-
- return true;
- }
-
- #endregion
-
- #region Write
-
- ///
- /// Remove a key, if possible
- ///
- public new bool Remove(string? fieldName)
- {
- // If the item or field name are missing, we can't do anything
- if (string.IsNullOrEmpty(fieldName))
- return false;
-
- // If the key doesn't exist, then it's already removed
- if (!ContainsKey(fieldName!))
- return true;
-
- // Remove the key
- base.Remove(fieldName!);
- return true;
- }
-
- ///
- /// Replace a field from another item
- ///
- public bool Replace(DictionaryBase? from, string fieldName)
- {
- // If the source item is invalid
- if (from is null)
- return false;
-
- // If the field name is missing, we can't do anything
- if (string.IsNullOrEmpty(fieldName))
- return false;
-
- // If the types of the items are not the same, we can't do anything
- if (from.GetType() != GetType())
- return false;
-
- // If the key doesn't exist in the source, we can't do anything
- if (!from.TryGetValue(fieldName!, out var value))
- return false;
-
- // Set the key
- this[fieldName!] = value;
- return true;
- }
-
- ///
- /// Write a key as the specified type, returning false on error
- ///
- /// Field to set
- /// Value to set
- /// True if the value was set, false otherwise
- public bool Write(string fieldName, T? value)
- {
- // Invalid field cannot be processed
- if (fieldName is null)
- return false;
-
- // Set the value based on the type
- this[fieldName] = value;
- return true;
- }
-
- #endregion
- }
-}
diff --git a/SabreTools.Data.Models/Metadata/DipLocation.cs b/SabreTools.Data.Models/Metadata/DipLocation.cs
index 24570ba9..5926d140 100644
--- a/SabreTools.Data.Models/Metadata/DipLocation.cs
+++ b/SabreTools.Data.Models/Metadata/DipLocation.cs
@@ -1,24 +1,57 @@
+using System;
using System.Xml.Serialization;
using Newtonsoft.Json;
namespace SabreTools.Data.Models.Metadata
{
[JsonObject("diplocation"), XmlRoot("diplocation")]
- public class DipLocation : DatItem
+ public class DipLocation : DatItem, ICloneable, IEquatable
{
- #region Keys
+ #region Properties
/// (yes|no) "no"
- public const string InvertedKey = "inverted";
+ public bool? Inverted { get; set; }
- /// string
- public const string NameKey = "name";
+ public string? Name { get; set; }
- /// string, possibly long
- public const string NumberKey = "number";
+ public long? Number { get; set; }
#endregion
- public DipLocation() => Type = ItemType.DipLocation;
+ public DipLocation() => ItemType = ItemType.DipLocation;
+
+ ///
+ public object Clone()
+ {
+ var obj = new DipLocation();
+
+ obj.Inverted = Inverted;
+ obj.Name = Name;
+ obj.Number = Number;
+
+ return obj;
+ }
+
+ ///
+ public bool Equals(DipLocation? other)
+ {
+ // Null never matches
+ if (other is null)
+ return false;
+
+ // Properties
+ if (Inverted != other.Inverted)
+ 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 (Number != other.Number)
+ return false;
+
+ return true;
+ }
}
}
diff --git a/SabreTools.Data.Models/Metadata/DipSwitch.cs b/SabreTools.Data.Models/Metadata/DipSwitch.cs
index a363539a..93cc798f 100644
--- a/SabreTools.Data.Models/Metadata/DipSwitch.cs
+++ b/SabreTools.Data.Models/Metadata/DipSwitch.cs
@@ -1,42 +1,87 @@
+using System;
using System.Xml.Serialization;
using Newtonsoft.Json;
namespace SabreTools.Data.Models.Metadata
{
[JsonObject("dipswitch"), XmlRoot("dipswitch")]
- public class DipSwitch : DatItem
+ public class DipSwitch : DatItem, ICloneable, IEquatable
{
- #region Keys
+ #region Properties
- /// Condition
- [NoFilter]
- public const string ConditionKey = "condition";
+ public Condition? Condition { get; set; }
/// (yes|no) "no"
- public const string DefaultKey = "default";
+ public bool? Default { get; set; }
- /// DipLocation[]
- [NoFilter]
- public const string DipLocationKey = "diplocation";
+ public DipLocation[]? DipLocation { get; set; }
- /// DipValue[]
- [NoFilter]
- public const string DipValueKey = "dipvalue";
+ public DipValue[]? DipValue { get; set; }
- /// string[]
- public const string EntryKey = "entry";
+ public string[]? Entry { get; set; }
- /// string
- public const string MaskKey = "mask";
+ public string? Mask { get; set; }
- /// string
- public const string NameKey = "name";
+ public string? Name { get; set; }
- /// string
- public const string TagKey = "tag";
+ public string? Tag { get; set; }
#endregion
- public DipSwitch() => Type = ItemType.DipSwitch;
+ public DipSwitch() => ItemType = ItemType.DipSwitch;
+
+ ///
+ public object Clone()
+ {
+ var obj = new DipSwitch();
+
+ obj.Condition = Condition?.Clone() as Condition;
+ obj.Default = Default;
+ if (DipLocation is not null)
+ obj.DipLocation = Array.ConvertAll(DipLocation, i => (DipLocation)i.Clone());
+ if (DipValue is not null)
+ obj.DipValue = Array.ConvertAll(DipValue, i => (DipValue)i.Clone());
+ if (Entry is not null)
+ obj.Entry = Array.ConvertAll(Entry, i => i);
+ obj.Mask = Mask;
+ obj.Name = Name;
+ obj.Tag = Tag;
+
+ return obj;
+ }
+
+ ///
+ public bool Equals(DipSwitch? other)
+ {
+ // Null never matches
+ if (other is null)
+ return false;
+
+ // Properties
+ if ((Mask is null) ^ (other.Mask is null))
+ return false;
+ else if (Mask is not null && !Mask.Equals(other.Mask, 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 ((Tag is null) ^ (other.Tag is null))
+ return false;
+ else if (Tag is not null && !Tag.Equals(other.Tag, StringComparison.OrdinalIgnoreCase))
+ return false;
+
+ // Sub-items
+ if ((Condition is null) ^ (other.Condition is null))
+ return false;
+ else if (Condition is not null && other.Condition is not null && Condition.Equals(other.Condition))
+ return false;
+
+ // TODO: Figure out how to properly check arrays
+
+ return true;
+ }
}
}
diff --git a/SabreTools.Data.Models/Metadata/DipValue.cs b/SabreTools.Data.Models/Metadata/DipValue.cs
index 153c8bcb..c23ed88f 100644
--- a/SabreTools.Data.Models/Metadata/DipValue.cs
+++ b/SabreTools.Data.Models/Metadata/DipValue.cs
@@ -1,28 +1,68 @@
+using System;
using System.Xml.Serialization;
using Newtonsoft.Json;
namespace SabreTools.Data.Models.Metadata
{
[JsonObject("dipvalue"), XmlRoot("dipvalue")]
- public class DipValue : DatItem
+ public class DipValue : DatItem, ICloneable, IEquatable
{
- #region Keys
+ #region Properties
- /// Condition
- [NoFilter]
- public const string ConditionKey = "condition";
+ public Condition? Condition { get; set; }
/// (yes|no) "no"
- public const string DefaultKey = "default";
+ public bool? Default { get; set; }
- /// string
- public const string NameKey = "name";
+ public string? Name { get; set; }
- /// string
- public const string ValueKey = "value";
+ public string? Value { get; set; }
#endregion
- public DipValue() => Type = ItemType.DipValue;
+ public DipValue() => ItemType = ItemType.DipValue;
+
+ ///
+ public object Clone()
+ {
+ var obj = new DipValue();
+
+ obj.Condition = Condition?.Clone() as Condition;
+ obj.Default = Default;
+ obj.Name = Name;
+ obj.Value = Value;
+
+ return obj;
+ }
+
+ ///
+ public bool Equals(DipValue? other)
+ {
+ // Null never matches
+ if (other is null)
+ return false;
+
+ // Properties
+ if (Default != other.Default)
+ 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 ((Value is null) ^ (other.Value is null))
+ return false;
+ else if (Value is not null && !Value.Equals(other.Value, StringComparison.OrdinalIgnoreCase))
+ return false;
+
+ // Sub-items
+ if ((Condition is null) ^ (other.Condition is null))
+ return false;
+ else if (Condition is not null && other.Condition is not null && Condition.Equals(other.Condition))
+ return false;
+
+ return true;
+ }
}
}
diff --git a/SabreTools.Data.Models/Metadata/Disk.cs b/SabreTools.Data.Models/Metadata/Disk.cs
index 006218c5..c012e119 100644
--- a/SabreTools.Data.Models/Metadata/Disk.cs
+++ b/SabreTools.Data.Models/Metadata/Disk.cs
@@ -1,45 +1,59 @@
+using System;
using System.Xml.Serialization;
using Newtonsoft.Json;
namespace SabreTools.Data.Models.Metadata
{
+ // TODO: IEquatable
[JsonObject("disk"), XmlRoot(elementName: "disk")]
- public class Disk : DatItem
+ public class Disk : DatItem, ICloneable
{
- #region Keys
+ #region Properties
- /// string
- public const string FlagsKey = "flags";
+ public string? Flags { get; set; }
- /// string, possibly long
- public const string IndexKey = "index";
+ public long? Index { get; set; }
- /// string
- public const string MD5Key = "md5";
+ public string? MD5 { get; set; }
- /// string
- public const string MergeKey = "merge";
+ public string? Merge { get; set; }
- /// string
- public const string NameKey = "name";
+ public string? Name { get; set; }
/// (yes|no) "no"
- public const string OptionalKey = "optional";
+ public bool? Optional { get; set; }
- /// string
- public const string RegionKey = "region";
+ public string? Region { get; set; }
- /// string
- public const string SHA1Key = "sha1";
+ public string? SHA1 { get; set; }
/// (baddump|nodump|good|verified) "good"
- public const string StatusKey = "status";
+ public ItemStatus? Status { get; set; }
/// (yes|no) "no"
- public const string WritableKey = "writable";
+ public bool? Writable { get; set; }
#endregion
- public Disk() => Type = ItemType.Disk;
+ public Disk() => ItemType = ItemType.Disk;
+
+ ///
+ public object Clone()
+ {
+ var obj = new Disk();
+
+ obj.Flags = Flags;
+ obj.Index = Index;
+ obj.MD5 = MD5;
+ obj.Merge = Merge;
+ obj.Name = Name;
+ obj.Optional = Optional;
+ obj.Region = Region;
+ obj.SHA1 = SHA1;
+ obj.Status = Status;
+ obj.Writable = Writable;
+
+ return obj;
+ }
}
}
diff --git a/SabreTools.Data.Models/Metadata/DiskArea.cs b/SabreTools.Data.Models/Metadata/DiskArea.cs
index 0c1c73ba..b82b168a 100644
--- a/SabreTools.Data.Models/Metadata/DiskArea.cs
+++ b/SabreTools.Data.Models/Metadata/DiskArea.cs
@@ -1,22 +1,51 @@
+using System;
using System.Xml.Serialization;
using Newtonsoft.Json;
namespace SabreTools.Data.Models.Metadata
{
[JsonObject("diskarea"), XmlRoot("diskarea")]
- public class DiskArea : DatItem
+ public class DiskArea : DatItem, ICloneable, IEquatable
{
- #region Keys
+ #region Properties
- /// Disk[]
- [NoFilter]
- public const string DiskKey = "disk";
+ public Disk[]? Disk { get; set; }
- /// string
- public const string NameKey = "name";
+ public string? Name { get; set; }
#endregion
- public DiskArea() => Type = ItemType.DiskArea;
+ public DiskArea() => ItemType = ItemType.DiskArea;
+
+ ///
+ public object Clone()
+ {
+ var obj = new DiskArea();
+
+ if (Disk is not null)
+ obj.Disk = Array.ConvertAll(Disk, i => (Disk)i.Clone());
+ obj.Name = Name;
+
+ return obj;
+ }
+
+ ///
+ public bool Equals(DiskArea? other)
+ {
+ // Null never matches
+ if (other is null)
+ return false;
+
+ // Properties
+ if ((Name is null) ^ (other.Name is null))
+ return false;
+ else if (Name is not null && !Name.Equals(other.Name, StringComparison.OrdinalIgnoreCase))
+ return false;
+
+ // Sub-items
+ // TODO: Figure out how to properly check arrays
+
+ return true;
+ }
}
}
diff --git a/SabreTools.Data.Models/Metadata/Display.cs b/SabreTools.Data.Models/Metadata/Display.cs
index 286b72cc..a4d594d2 100644
--- a/SabreTools.Data.Models/Metadata/Display.cs
+++ b/SabreTools.Data.Models/Metadata/Display.cs
@@ -1,57 +1,165 @@
+using System;
using System.Xml.Serialization;
using Newtonsoft.Json;
namespace SabreTools.Data.Models.Metadata
{
[JsonObject("display"), XmlRoot("display")]
- public class Display : DatItem
+ public class Display : DatItem, ICloneable, IEquatable, IEquatable