mirror of
https://github.com/SabreTools/SabreTools.Serialization.git
synced 2026-09-21 14:25:03 +00:00
Add set type RomVault game extension field
This commit is contained in:
@@ -55,6 +55,11 @@ namespace SabreTools.Data.Models.Logiqx
|
||||
[XmlAttribute("runnable")]
|
||||
public Runnable? Runnable { get; set; }
|
||||
|
||||
/// <remarks>(dir|zip|7z), RomVault extension</remarks>
|
||||
/// TODO: Turn this into an enum like the other flags
|
||||
[XmlAttribute("type")]
|
||||
public string? SetType { get; set; }
|
||||
|
||||
[XmlElement("comment")]
|
||||
public string[]? Comment { get; set; }
|
||||
|
||||
|
||||
@@ -159,6 +159,9 @@ namespace SabreTools.Data.Models.Metadata
|
||||
|
||||
public string? Serial { get; set; }
|
||||
|
||||
/// <remarks>(dir|zip|7z), RomVault extension</remarks>
|
||||
public string? SetType { get; set; }
|
||||
|
||||
public SharedFeat[]? SharedFeat { get; set; }
|
||||
|
||||
public Slot[]? Slot { get; set; }
|
||||
@@ -298,6 +301,7 @@ namespace SabreTools.Data.Models.Metadata
|
||||
obj.SaveType = SaveType;
|
||||
obj.Score = Score;
|
||||
obj.Serial = Serial;
|
||||
obj.SetType = SetType;
|
||||
if (SharedFeat is not null)
|
||||
obj.SharedFeat = Array.ConvertAll(SharedFeat, i => (SharedFeat)i.Clone());
|
||||
if (Slot is not null)
|
||||
@@ -569,6 +573,11 @@ namespace SabreTools.Data.Models.Metadata
|
||||
else if (Serial is not null && !Serial.Equals(other.Serial, StringComparison.OrdinalIgnoreCase))
|
||||
return false;
|
||||
|
||||
if ((SetType is null) ^ (other.SetType is null))
|
||||
return false;
|
||||
else if (SetType is not null && !SetType.Equals(other.SetType, StringComparison.OrdinalIgnoreCase))
|
||||
return false;
|
||||
|
||||
if ((Source is null) ^ (other.Source is null))
|
||||
return false;
|
||||
else if (Source is not null && !Source.Equals(other.Source, StringComparison.OrdinalIgnoreCase))
|
||||
|
||||
@@ -329,6 +329,7 @@ namespace SabreTools.Metadata.DatFiles.Test
|
||||
SaveType = "savetype",
|
||||
Score = "score",
|
||||
Serial = "serial",
|
||||
SetType = "dir",
|
||||
SharedFeat = [CreateMetadataSharedFeat()],
|
||||
Slot = [CreateMetadataSlot()],
|
||||
SoftwareList = [CreateMetadataSoftwareList()],
|
||||
@@ -1095,6 +1096,8 @@ namespace SabreTools.Metadata.DatFiles.Test
|
||||
Assert.Equal("sampleof", machine.SampleOf);
|
||||
Assert.Equal("savetype", machine.SaveType);
|
||||
Assert.Equal("score", machine.Score);
|
||||
Assert.Equal("serial", machine.Serial);
|
||||
Assert.Equal("dir", machine.SetType);
|
||||
Assert.Equal("source", machine.Source);
|
||||
Assert.Equal("sourcefile", machine.SourceFile);
|
||||
Assert.Equal("sourcerom", machine.SourceRom);
|
||||
|
||||
@@ -438,6 +438,7 @@ namespace SabreTools.Metadata.DatFiles.Test
|
||||
Assert.Equal("savetype", machine.SaveType);
|
||||
Assert.Equal("score", machine.Score);
|
||||
Assert.Equal("serial", machine.Serial);
|
||||
Assert.Equal("dir", machine.SetType);
|
||||
Assert.Equal("source", machine.Source);
|
||||
Assert.Equal("sourcefile", machine.SourceFile);
|
||||
Assert.Equal("sourcerom", machine.SourceRom);
|
||||
|
||||
@@ -320,6 +320,12 @@ namespace SabreTools.Metadata.DatItems
|
||||
set => _internal.Serial = value;
|
||||
}
|
||||
|
||||
public string? SetType
|
||||
{
|
||||
get => _internal.SetType;
|
||||
set => _internal.SetType = value;
|
||||
}
|
||||
|
||||
public string? Source
|
||||
{
|
||||
get => _internal.Source;
|
||||
|
||||
@@ -1294,6 +1294,8 @@ namespace SabreTools.Metadata.Filter.Test
|
||||
[InlineData("machine.sampleof", "sampleof")]
|
||||
[InlineData("machine.savetype", "savetype")]
|
||||
[InlineData("machine.score", "score")]
|
||||
[InlineData("machine.serial", "serial")]
|
||||
[InlineData("machine.settype", "dir")]
|
||||
[InlineData("machine.source", "source")]
|
||||
[InlineData("machine.sourcefile", "sourcefile")]
|
||||
[InlineData("machine.sourcerom", "sourcerom")]
|
||||
@@ -1364,6 +1366,7 @@ namespace SabreTools.Metadata.Filter.Test
|
||||
SaveType = "savetype",
|
||||
Score = "score",
|
||||
Serial = "serial",
|
||||
SetType = "dir",
|
||||
Source = "source",
|
||||
SourceFile = "sourcefile",
|
||||
SourceRom = "sourcerom",
|
||||
|
||||
@@ -424,6 +424,8 @@ namespace SabreTools.Metadata.Filter
|
||||
"sampleof",
|
||||
"savetype",
|
||||
"score",
|
||||
"serial",
|
||||
"settype",
|
||||
"source",
|
||||
"sourcefile",
|
||||
"sourcerom",
|
||||
|
||||
@@ -1610,6 +1610,9 @@ namespace SabreTools.Metadata.Filter
|
||||
case "serial":
|
||||
checkValue = obj.Serial;
|
||||
return true;
|
||||
case "settype":
|
||||
checkValue = obj.SetType;
|
||||
return true;
|
||||
case "source":
|
||||
checkValue = obj.Source;
|
||||
return true;
|
||||
|
||||
@@ -255,6 +255,7 @@ namespace SabreTools.Serialization.CrossModel.Test
|
||||
gameBase.Id = "id";
|
||||
gameBase.CloneOfId = "cloneofid";
|
||||
gameBase.Runnable = Data.Models.Metadata.Runnable.Yes;
|
||||
gameBase.SetType = "dir";
|
||||
gameBase.Comment = ["comment"];
|
||||
gameBase.Description = "description";
|
||||
gameBase.Year = "year";
|
||||
@@ -385,6 +386,7 @@ namespace SabreTools.Serialization.CrossModel.Test
|
||||
Assert.Equal("id", gb.Id);
|
||||
Assert.Equal("cloneofid", gb.CloneOfId);
|
||||
Assert.Equal(Data.Models.Metadata.Runnable.Yes, gb.Runnable);
|
||||
Assert.Equal("dir", gb.SetType);
|
||||
|
||||
Assert.NotNull(gb.Comment);
|
||||
string comment = Assert.Single(gb.Comment);
|
||||
|
||||
@@ -133,6 +133,7 @@ namespace SabreTools.Serialization.CrossModel
|
||||
gameBase.Id = item.Id;
|
||||
gameBase.CloneOfId = item.CloneOfId;
|
||||
gameBase.Runnable = item.Runnable;
|
||||
gameBase.SetType = item.SetType;
|
||||
gameBase.Comment = item.Comment;
|
||||
gameBase.Description = item.Description;
|
||||
gameBase.Year = item.Year;
|
||||
|
||||
@@ -163,6 +163,7 @@ namespace SabreTools.Serialization.CrossModel
|
||||
Runnable = item.Runnable,
|
||||
SampleOf = item.SampleOf,
|
||||
Score = item.Trurip?.Score,
|
||||
SetType = item.SetType,
|
||||
Source = item.Trurip?.Source,
|
||||
SourceFile = item.SourceFile,
|
||||
Subgenre = item.Trurip?.Subgenre,
|
||||
|
||||
@@ -320,6 +320,7 @@ namespace SabreTools.Serialization.Readers.Test
|
||||
gameBase.Id = "id";
|
||||
gameBase.CloneOfId = "cloneofid";
|
||||
gameBase.Runnable = Data.Models.Metadata.Runnable.Yes;
|
||||
gameBase.SetType = "dir";
|
||||
gameBase.Comment = ["comment"];
|
||||
gameBase.Description = "description";
|
||||
gameBase.Year = "year";
|
||||
@@ -435,6 +436,7 @@ namespace SabreTools.Serialization.Readers.Test
|
||||
Assert.Equal("id", gb.Id);
|
||||
Assert.Equal("cloneofid", gb.CloneOfId);
|
||||
Assert.Equal(Data.Models.Metadata.Runnable.Yes, gb.Runnable);
|
||||
Assert.Equal("dir", gb.SetType);
|
||||
|
||||
Assert.NotNull(gb.Comment);
|
||||
string comment = Assert.Single(gb.Comment);
|
||||
|
||||
@@ -524,6 +524,7 @@ namespace SabreTools.Serialization.Readers
|
||||
obj.Id = reader.GetAttribute("id");
|
||||
obj.CloneOfId = reader.GetAttribute("cloneofid");
|
||||
obj.Runnable = reader.GetAttribute("runnable").AsRunnable();
|
||||
obj.SetType = reader.GetAttribute("type");
|
||||
|
||||
// Handle empty elements
|
||||
if (reader.IsEmptyElement)
|
||||
|
||||
@@ -362,6 +362,7 @@ namespace SabreTools.Serialization.Writers
|
||||
writer.WriteOptionalAttributeString("id", obj.Id);
|
||||
writer.WriteOptionalAttributeString("cloneofid", obj.CloneOfId);
|
||||
writer.WriteOptionalAttributeString("runnable", obj.Runnable?.AsStringValue());
|
||||
writer.WriteOptionalAttributeString("type", obj.SetType);
|
||||
|
||||
if (obj.Comment is not null && obj.Comment.Length > 0)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user