mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
Fix tests, migrate Adjuster
This commit is contained in:
@@ -169,11 +169,7 @@ namespace SabreTools.DatFiles.Formats
|
|||||||
|
|
||||||
ItemStatus = ItemStatus.None,
|
ItemStatus = ItemStatus.None,
|
||||||
|
|
||||||
Source = new Source
|
Source = new Source { Index = indexId, Name = filename },
|
||||||
{
|
|
||||||
Index = indexId,
|
|
||||||
Name = filename,
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
rom.SetName(name);
|
rom.SetName(name);
|
||||||
|
|
||||||
|
|||||||
@@ -95,11 +95,7 @@ namespace SabreTools.DatFiles.Formats
|
|||||||
AltTitle = row.AltTitle,
|
AltTitle = row.AltTitle,
|
||||||
// TODO: Add extended fields
|
// TODO: Add extended fields
|
||||||
|
|
||||||
Source = new Source
|
Source = new Source { Index = indexId, Name = filename },
|
||||||
{
|
|
||||||
Index = indexId,
|
|
||||||
Name = filename,
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
rom.SetName("-");
|
rom.SetName("-");
|
||||||
|
|
||||||
|
|||||||
@@ -140,11 +140,7 @@ namespace SabreTools.DatFiles.Formats
|
|||||||
{
|
{
|
||||||
var blank = new Blank
|
var blank = new Blank
|
||||||
{
|
{
|
||||||
Source = new Source
|
Source = new Source { Index = indexId, Name = filename },
|
||||||
{
|
|
||||||
Index = indexId,
|
|
||||||
Name = filename,
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
|
|
||||||
blank.CopyMachineInformation(machine);
|
blank.CopyMachineInformation(machine);
|
||||||
@@ -177,11 +173,7 @@ namespace SabreTools.DatFiles.Formats
|
|||||||
Date = release.Date,
|
Date = release.Date,
|
||||||
Default = release.Default?.AsYesNo(),
|
Default = release.Default?.AsYesNo(),
|
||||||
|
|
||||||
Source = new Source
|
Source = new Source { Index = indexId, Name = filename },
|
||||||
{
|
|
||||||
Index = indexId,
|
|
||||||
Name = filename,
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
item.SetName(release.Name);
|
item.SetName(release.Name);
|
||||||
|
|
||||||
@@ -213,11 +205,7 @@ namespace SabreTools.DatFiles.Formats
|
|||||||
Description = biosset.Description,
|
Description = biosset.Description,
|
||||||
Default = biosset.Default?.AsYesNo(),
|
Default = biosset.Default?.AsYesNo(),
|
||||||
|
|
||||||
Source = new Source
|
Source = new Source { Index = indexId, Name = filename },
|
||||||
{
|
|
||||||
Index = indexId,
|
|
||||||
Name = filename,
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
item.SetName(biosset.Name);
|
item.SetName(biosset.Name);
|
||||||
|
|
||||||
@@ -267,11 +255,7 @@ namespace SabreTools.DatFiles.Formats
|
|||||||
Inverted = rom.Inverted?.AsYesNo(),
|
Inverted = rom.Inverted?.AsYesNo(),
|
||||||
MIA = rom.MIA?.AsYesNo(),
|
MIA = rom.MIA?.AsYesNo(),
|
||||||
|
|
||||||
Source = new Source
|
Source = new Source { Index = indexId, Name = filename },
|
||||||
{
|
|
||||||
Index = indexId,
|
|
||||||
Name = filename,
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
item.SetName(rom.Name);
|
item.SetName(rom.Name);
|
||||||
|
|
||||||
@@ -306,11 +290,7 @@ namespace SabreTools.DatFiles.Formats
|
|||||||
ItemStatus = disk.Status?.AsEnumValue<ItemStatus>() ?? ItemStatus.NULL,
|
ItemStatus = disk.Status?.AsEnumValue<ItemStatus>() ?? ItemStatus.NULL,
|
||||||
//Flags = disk.Flags, // TODO: Add to internal model
|
//Flags = disk.Flags, // TODO: Add to internal model
|
||||||
|
|
||||||
Source = new Source
|
Source = new Source { Index = indexId, Name = filename },
|
||||||
{
|
|
||||||
Index = indexId,
|
|
||||||
Name = filename,
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
item.SetName(disk.Name);
|
item.SetName(disk.Name);
|
||||||
|
|
||||||
@@ -344,11 +324,7 @@ namespace SabreTools.DatFiles.Formats
|
|||||||
SHA256 = medium.SHA256,
|
SHA256 = medium.SHA256,
|
||||||
SpamSum = medium.SpamSum,
|
SpamSum = medium.SpamSum,
|
||||||
|
|
||||||
Source = new Source
|
Source = new Source { Index = indexId, Name = filename },
|
||||||
{
|
|
||||||
Index = indexId,
|
|
||||||
Name = filename,
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
item.SetName(medium.Name);
|
item.SetName(medium.Name);
|
||||||
|
|
||||||
@@ -377,11 +353,7 @@ namespace SabreTools.DatFiles.Formats
|
|||||||
{
|
{
|
||||||
var item = new Archive
|
var item = new Archive
|
||||||
{
|
{
|
||||||
Source = new Source
|
Source = new Source { Index = indexId, Name = filename },
|
||||||
{
|
|
||||||
Index = indexId,
|
|
||||||
Name = filename,
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
item.SetName(archive.Name);
|
item.SetName(archive.Name);
|
||||||
|
|
||||||
@@ -414,11 +386,7 @@ namespace SabreTools.DatFiles.Formats
|
|||||||
//Flags = chip.Flags, // TODO: Add to internal model
|
//Flags = chip.Flags, // TODO: Add to internal model
|
||||||
Clock = NumberHelper.ConvertToInt64(chip.Clock),
|
Clock = NumberHelper.ConvertToInt64(chip.Clock),
|
||||||
|
|
||||||
Source = new Source
|
Source = new Source { Index = indexId, Name = filename },
|
||||||
{
|
|
||||||
Index = indexId,
|
|
||||||
Name = filename,
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
item.SetName(chip.Name);
|
item.SetName(chip.Name);
|
||||||
|
|
||||||
@@ -454,11 +422,7 @@ namespace SabreTools.DatFiles.Formats
|
|||||||
//AspectY = video.AspectY, // TODO: Add to internal model or find mapping
|
//AspectY = video.AspectY, // TODO: Add to internal model or find mapping
|
||||||
Refresh = NumberHelper.ConvertToDouble(video.Freq),
|
Refresh = NumberHelper.ConvertToDouble(video.Freq),
|
||||||
|
|
||||||
Source = new Source
|
Source = new Source { Index = indexId, Name = filename },
|
||||||
{
|
|
||||||
Index = indexId,
|
|
||||||
Name = filename,
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
|
|
||||||
switch (video.Orientation)
|
switch (video.Orientation)
|
||||||
@@ -496,11 +460,7 @@ namespace SabreTools.DatFiles.Formats
|
|||||||
{
|
{
|
||||||
Channels = NumberHelper.ConvertToInt64(sound.Channels),
|
Channels = NumberHelper.ConvertToInt64(sound.Channels),
|
||||||
|
|
||||||
Source = new Source
|
Source = new Source { Index = indexId, Name = filename },
|
||||||
{
|
|
||||||
Index = indexId,
|
|
||||||
Name = filename,
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
|
|
||||||
item.CopyMachineInformation(machine);
|
item.CopyMachineInformation(machine);
|
||||||
@@ -538,11 +498,7 @@ namespace SabreTools.DatFiles.Formats
|
|||||||
Tilt = input.Tilt?.AsYesNo(),
|
Tilt = input.Tilt?.AsYesNo(),
|
||||||
Service = input.Service?.AsYesNo(),
|
Service = input.Service?.AsYesNo(),
|
||||||
|
|
||||||
Source = new Source
|
Source = new Source { Index = indexId, Name = filename },
|
||||||
{
|
|
||||||
Index = indexId,
|
|
||||||
Name = filename,
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
|
|
||||||
item.CopyMachineInformation(machine);
|
item.CopyMachineInformation(machine);
|
||||||
@@ -571,11 +527,7 @@ namespace SabreTools.DatFiles.Formats
|
|||||||
{
|
{
|
||||||
Values = [],
|
Values = [],
|
||||||
|
|
||||||
Source = new Source
|
Source = new Source { Index = indexId, Name = filename },
|
||||||
{
|
|
||||||
Index = indexId,
|
|
||||||
Name = filename,
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
item.SetName(dipswitch.Name);
|
item.SetName(dipswitch.Name);
|
||||||
|
|
||||||
@@ -620,11 +572,7 @@ namespace SabreTools.DatFiles.Formats
|
|||||||
//PaletteSize = driver.PaletteSize, // TODO: Add to internal model or find mapping
|
//PaletteSize = driver.PaletteSize, // TODO: Add to internal model or find mapping
|
||||||
//Blit = driver.Blit, // TODO: Add to internal model or find mapping
|
//Blit = driver.Blit, // TODO: Add to internal model or find mapping
|
||||||
|
|
||||||
Source = new Source
|
Source = new Source { Index = indexId, Name = filename },
|
||||||
{
|
|
||||||
Index = indexId,
|
|
||||||
Name = filename,
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
|
|
||||||
item.CopyMachineInformation(machine);
|
item.CopyMachineInformation(machine);
|
||||||
|
|||||||
@@ -109,11 +109,7 @@ namespace SabreTools.DatFiles.Formats
|
|||||||
{
|
{
|
||||||
var blank = new Blank
|
var blank = new Blank
|
||||||
{
|
{
|
||||||
Source = new Source
|
Source = new Source { Index = indexId, Name = filename },
|
||||||
{
|
|
||||||
Index = indexId,
|
|
||||||
Name = filename,
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
|
|
||||||
blank.CopyMachineInformation(machine);
|
blank.CopyMachineInformation(machine);
|
||||||
@@ -145,11 +141,7 @@ namespace SabreTools.DatFiles.Formats
|
|||||||
CRC = rom.CRC,
|
CRC = rom.CRC,
|
||||||
Date = rom.Date,
|
Date = rom.Date,
|
||||||
|
|
||||||
Source = new Source
|
Source = new Source { Index = indexId, Name = filename },
|
||||||
{
|
|
||||||
Index = indexId,
|
|
||||||
Name = filename,
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
item.SetName(rom.Name);
|
item.SetName(rom.Name);
|
||||||
|
|
||||||
|
|||||||
@@ -107,11 +107,7 @@ namespace SabreTools.DatFiles.Formats
|
|||||||
SHA256 = row.SHA256,
|
SHA256 = row.SHA256,
|
||||||
ItemStatus = ItemStatus.None,
|
ItemStatus = ItemStatus.None,
|
||||||
|
|
||||||
Source = new Source
|
Source = new Source { Index = indexId, Name = filename },
|
||||||
{
|
|
||||||
Index = indexId,
|
|
||||||
Name = filename,
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
rom.SetName(name);
|
rom.SetName(name);
|
||||||
|
|
||||||
|
|||||||
@@ -149,11 +149,7 @@ namespace SabreTools.DatFiles.Formats
|
|||||||
Size = null,
|
Size = null,
|
||||||
CRC = sfv.Hash,
|
CRC = sfv.Hash,
|
||||||
|
|
||||||
Source = new Source
|
Source = new Source { Index = indexId, Name = filename },
|
||||||
{
|
|
||||||
Index = indexId,
|
|
||||||
Name = filename,
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
rom.SetName(itemName);
|
rom.SetName(itemName);
|
||||||
|
|
||||||
@@ -200,11 +196,7 @@ namespace SabreTools.DatFiles.Formats
|
|||||||
{
|
{
|
||||||
MD5 = md5.Hash,
|
MD5 = md5.Hash,
|
||||||
|
|
||||||
Source = new Source
|
Source = new Source { Index = indexId, Name = filename },
|
||||||
{
|
|
||||||
Index = indexId,
|
|
||||||
Name = filename,
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
disk.SetName(itemName);
|
disk.SetName(itemName);
|
||||||
|
|
||||||
@@ -217,11 +209,7 @@ namespace SabreTools.DatFiles.Formats
|
|||||||
{
|
{
|
||||||
MD5 = md5.Hash,
|
MD5 = md5.Hash,
|
||||||
|
|
||||||
Source = new Source
|
Source = new Source { Index = indexId, Name = filename },
|
||||||
{
|
|
||||||
Index = indexId,
|
|
||||||
Name = filename,
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
media.SetName(itemName);
|
media.SetName(itemName);
|
||||||
|
|
||||||
@@ -235,11 +223,7 @@ namespace SabreTools.DatFiles.Formats
|
|||||||
Size = null,
|
Size = null,
|
||||||
MD5 = md5.Hash,
|
MD5 = md5.Hash,
|
||||||
|
|
||||||
Source = new Source
|
Source = new Source { Index = indexId, Name = filename },
|
||||||
{
|
|
||||||
Index = indexId,
|
|
||||||
Name = filename,
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
rom.SetName(itemName);
|
rom.SetName(itemName);
|
||||||
|
|
||||||
@@ -286,11 +270,7 @@ namespace SabreTools.DatFiles.Formats
|
|||||||
{
|
{
|
||||||
SHA1 = sha1.Hash,
|
SHA1 = sha1.Hash,
|
||||||
|
|
||||||
Source = new Source
|
Source = new Source { Index = indexId, Name = filename },
|
||||||
{
|
|
||||||
Index = indexId,
|
|
||||||
Name = filename,
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
disk.SetName(itemName);
|
disk.SetName(itemName);
|
||||||
|
|
||||||
@@ -303,11 +283,7 @@ namespace SabreTools.DatFiles.Formats
|
|||||||
{
|
{
|
||||||
SHA1 = sha1.Hash,
|
SHA1 = sha1.Hash,
|
||||||
|
|
||||||
Source = new Source
|
Source = new Source { Index = indexId, Name = filename },
|
||||||
{
|
|
||||||
Index = indexId,
|
|
||||||
Name = filename,
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
media.SetName(itemName);
|
media.SetName(itemName);
|
||||||
|
|
||||||
@@ -321,11 +297,7 @@ namespace SabreTools.DatFiles.Formats
|
|||||||
Size = null,
|
Size = null,
|
||||||
SHA1 = sha1.Hash,
|
SHA1 = sha1.Hash,
|
||||||
|
|
||||||
Source = new Source
|
Source = new Source { Index = indexId, Name = filename },
|
||||||
{
|
|
||||||
Index = indexId,
|
|
||||||
Name = filename,
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
rom.SetName(itemName);
|
rom.SetName(itemName);
|
||||||
|
|
||||||
@@ -372,11 +344,7 @@ namespace SabreTools.DatFiles.Formats
|
|||||||
{
|
{
|
||||||
SHA256 = sha256.Hash,
|
SHA256 = sha256.Hash,
|
||||||
|
|
||||||
Source = new Source
|
Source = new Source { Index = indexId, Name = filename },
|
||||||
{
|
|
||||||
Index = indexId,
|
|
||||||
Name = filename,
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
media.SetName(itemName);
|
media.SetName(itemName);
|
||||||
|
|
||||||
@@ -391,11 +359,7 @@ namespace SabreTools.DatFiles.Formats
|
|||||||
Size = null,
|
Size = null,
|
||||||
SHA256 = sha256.Hash,
|
SHA256 = sha256.Hash,
|
||||||
|
|
||||||
Source = new Source
|
Source = new Source { Index = indexId, Name = filename },
|
||||||
{
|
|
||||||
Index = indexId,
|
|
||||||
Name = filename,
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
rom.SetName(itemName);
|
rom.SetName(itemName);
|
||||||
|
|
||||||
@@ -445,11 +409,7 @@ namespace SabreTools.DatFiles.Formats
|
|||||||
Size = null,
|
Size = null,
|
||||||
SHA384 = sha384.Hash,
|
SHA384 = sha384.Hash,
|
||||||
|
|
||||||
Source = new Source
|
Source = new Source { Index = indexId, Name = filename },
|
||||||
{
|
|
||||||
Index = indexId,
|
|
||||||
Name = filename,
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
rom.SetName(itemName);
|
rom.SetName(itemName);
|
||||||
|
|
||||||
@@ -499,11 +459,7 @@ namespace SabreTools.DatFiles.Formats
|
|||||||
Size = null,
|
Size = null,
|
||||||
SHA512 = sha512.Hash,
|
SHA512 = sha512.Hash,
|
||||||
|
|
||||||
Source = new Source
|
Source = new Source { Index = indexId, Name = filename },
|
||||||
{
|
|
||||||
Index = indexId,
|
|
||||||
Name = filename,
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
rom.SetName(itemName);
|
rom.SetName(itemName);
|
||||||
|
|
||||||
@@ -550,11 +506,7 @@ namespace SabreTools.DatFiles.Formats
|
|||||||
{
|
{
|
||||||
SpamSum = spamsum.Hash,
|
SpamSum = spamsum.Hash,
|
||||||
|
|
||||||
Source = new Source
|
Source = new Source { Index = indexId, Name = filename },
|
||||||
{
|
|
||||||
Index = indexId,
|
|
||||||
Name = filename,
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
media.SetName(itemName);
|
media.SetName(itemName);
|
||||||
|
|
||||||
@@ -569,11 +521,7 @@ namespace SabreTools.DatFiles.Formats
|
|||||||
Size = null,
|
Size = null,
|
||||||
SpamSum = spamsum.Hash,
|
SpamSum = spamsum.Hash,
|
||||||
|
|
||||||
Source = new Source
|
Source = new Source { Index = indexId, Name = filename },
|
||||||
{
|
|
||||||
Index = indexId,
|
|
||||||
Name = filename,
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
rom.SetName(itemName);
|
rom.SetName(itemName);
|
||||||
|
|
||||||
|
|||||||
@@ -118,11 +118,7 @@ namespace SabreTools.DatFiles.Formats
|
|||||||
{
|
{
|
||||||
ItemStatus = ItemStatus.None,
|
ItemStatus = ItemStatus.None,
|
||||||
|
|
||||||
Source = new Source
|
Source = new Source { Index = indexId, Name = filename },
|
||||||
{
|
|
||||||
Index = indexId,
|
|
||||||
Name = filename,
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
disk.SetName(row.Name);
|
disk.SetName(row.Name);
|
||||||
|
|
||||||
@@ -148,11 +144,7 @@ namespace SabreTools.DatFiles.Formats
|
|||||||
SHA1 = row.SHA1,
|
SHA1 = row.SHA1,
|
||||||
ItemStatus = ItemStatus.None,
|
ItemStatus = ItemStatus.None,
|
||||||
|
|
||||||
Source = new Source
|
Source = new Source { Index = indexId, Name = filename },
|
||||||
{
|
|
||||||
Index = indexId,
|
|
||||||
Name = filename,
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
rom.SetName(row.Name);
|
rom.SetName(row.Name);
|
||||||
|
|
||||||
@@ -172,11 +164,7 @@ namespace SabreTools.DatFiles.Formats
|
|||||||
{
|
{
|
||||||
ItemStatus = ItemStatus.BadDump,
|
ItemStatus = ItemStatus.BadDump,
|
||||||
|
|
||||||
Source = new Source
|
Source = new Source { Index = indexId, Name = filename },
|
||||||
{
|
|
||||||
Index = indexId,
|
|
||||||
Name = filename,
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
disk.SetName(row.Name);
|
disk.SetName(row.Name);
|
||||||
|
|
||||||
@@ -200,11 +188,7 @@ namespace SabreTools.DatFiles.Formats
|
|||||||
SHA1 = null,
|
SHA1 = null,
|
||||||
ItemStatus = ItemStatus.Nodump,
|
ItemStatus = ItemStatus.Nodump,
|
||||||
|
|
||||||
Source = new Source
|
Source = new Source { Index = indexId, Name = filename },
|
||||||
{
|
|
||||||
Index = indexId,
|
|
||||||
Name = filename,
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
disk.SetName(row.Name);
|
disk.SetName(row.Name);
|
||||||
|
|
||||||
@@ -225,11 +209,7 @@ namespace SabreTools.DatFiles.Formats
|
|||||||
SHA1 = row.SHA1,
|
SHA1 = row.SHA1,
|
||||||
ItemStatus = ItemStatus.BadDump,
|
ItemStatus = ItemStatus.BadDump,
|
||||||
|
|
||||||
Source = new Source
|
Source = new Source { Index = indexId, Name = filename },
|
||||||
{
|
|
||||||
Index = indexId,
|
|
||||||
Name = filename,
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
rom.SetName(row.Name);
|
rom.SetName(row.Name);
|
||||||
|
|
||||||
@@ -249,11 +229,7 @@ namespace SabreTools.DatFiles.Formats
|
|||||||
SHA1 = null,
|
SHA1 = null,
|
||||||
ItemStatus = ItemStatus.Nodump,
|
ItemStatus = ItemStatus.Nodump,
|
||||||
|
|
||||||
Source = new Source
|
Source = new Source { Index = indexId, Name = filename },
|
||||||
{
|
|
||||||
Index = indexId,
|
|
||||||
Name = filename,
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
rom.SetName(row.Name);
|
rom.SetName(row.Name);
|
||||||
|
|
||||||
|
|||||||
@@ -144,11 +144,7 @@ namespace SabreTools.DatFiles.Formats
|
|||||||
{
|
{
|
||||||
var blank = new Blank
|
var blank = new Blank
|
||||||
{
|
{
|
||||||
Source = new Source
|
Source = new Source { Index = indexId, Name = filename },
|
||||||
{
|
|
||||||
Index = indexId,
|
|
||||||
Name = filename,
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
|
|
||||||
blank.CopyMachineInformation(machine);
|
blank.CopyMachineInformation(machine);
|
||||||
@@ -179,11 +175,7 @@ namespace SabreTools.DatFiles.Formats
|
|||||||
Description = biosset.Description,
|
Description = biosset.Description,
|
||||||
Default = biosset.Default?.AsYesNo(),
|
Default = biosset.Default?.AsYesNo(),
|
||||||
|
|
||||||
Source = new Source
|
Source = new Source { Index = indexId, Name = filename },
|
||||||
{
|
|
||||||
Index = indexId,
|
|
||||||
Name = filename,
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
item.SetName(biosset.Name);
|
item.SetName(biosset.Name);
|
||||||
|
|
||||||
@@ -224,11 +216,7 @@ namespace SabreTools.DatFiles.Formats
|
|||||||
//Dispose = rom.Dispose.AsYesNo(), // TODO: Add to internal model
|
//Dispose = rom.Dispose.AsYesNo(), // TODO: Add to internal model
|
||||||
//SoundOnly = rom.SoundOnly.AsYesNo(), // TODO: Add to internal model
|
//SoundOnly = rom.SoundOnly.AsYesNo(), // TODO: Add to internal model
|
||||||
|
|
||||||
Source = new Source
|
Source = new Source { Index = indexId, Name = filename },
|
||||||
{
|
|
||||||
Index = indexId,
|
|
||||||
Name = filename,
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
item.SetName(rom.Name);
|
item.SetName(rom.Name);
|
||||||
|
|
||||||
@@ -266,11 +254,7 @@ namespace SabreTools.DatFiles.Formats
|
|||||||
ItemStatus = disk.Status.AsEnumValue<ItemStatus>(),
|
ItemStatus = disk.Status.AsEnumValue<ItemStatus>(),
|
||||||
Optional = disk.Optional.AsYesNo(),
|
Optional = disk.Optional.AsYesNo(),
|
||||||
|
|
||||||
Source = new Source
|
Source = new Source { Index = indexId, Name = filename },
|
||||||
{
|
|
||||||
Index = indexId,
|
|
||||||
Name = filename,
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
item.SetName(disk.Name);
|
item.SetName(disk.Name);
|
||||||
|
|
||||||
@@ -299,11 +283,7 @@ namespace SabreTools.DatFiles.Formats
|
|||||||
{
|
{
|
||||||
var item = new DeviceReference
|
var item = new DeviceReference
|
||||||
{
|
{
|
||||||
Source = new Source
|
Source = new Source { Index = indexId, Name = filename },
|
||||||
{
|
|
||||||
Index = indexId,
|
|
||||||
Name = filename,
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
item.SetName(deviceref.Name);
|
item.SetName(deviceref.Name);
|
||||||
|
|
||||||
@@ -332,11 +312,7 @@ namespace SabreTools.DatFiles.Formats
|
|||||||
{
|
{
|
||||||
var item = new Sample
|
var item = new Sample
|
||||||
{
|
{
|
||||||
Source = new Source
|
Source = new Source { Index = indexId, Name = filename },
|
||||||
{
|
|
||||||
Index = indexId,
|
|
||||||
Name = filename,
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
item.SetName(sample.Name);
|
item.SetName(sample.Name);
|
||||||
|
|
||||||
@@ -370,11 +346,7 @@ namespace SabreTools.DatFiles.Formats
|
|||||||
//SoundOnly = chip.SoundOnly, // TODO: Add to internal model
|
//SoundOnly = chip.SoundOnly, // TODO: Add to internal model
|
||||||
Clock = NumberHelper.ConvertToInt64(chip.Clock),
|
Clock = NumberHelper.ConvertToInt64(chip.Clock),
|
||||||
|
|
||||||
Source = new Source
|
Source = new Source { Index = indexId, Name = filename },
|
||||||
{
|
|
||||||
Index = indexId,
|
|
||||||
Name = filename,
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
item.SetName(chip.Name);
|
item.SetName(chip.Name);
|
||||||
|
|
||||||
@@ -418,11 +390,7 @@ namespace SabreTools.DatFiles.Formats
|
|||||||
VBEnd = NumberHelper.ConvertToInt64(display.VBEnd),
|
VBEnd = NumberHelper.ConvertToInt64(display.VBEnd),
|
||||||
VBStart = NumberHelper.ConvertToInt64(display.VBStart),
|
VBStart = NumberHelper.ConvertToInt64(display.VBStart),
|
||||||
|
|
||||||
Source = new Source
|
Source = new Source { Index = indexId, Name = filename },
|
||||||
{
|
|
||||||
Index = indexId,
|
|
||||||
Name = filename,
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
|
|
||||||
item.CopyMachineInformation(machine);
|
item.CopyMachineInformation(machine);
|
||||||
@@ -457,11 +425,7 @@ namespace SabreTools.DatFiles.Formats
|
|||||||
//AspectY = video.AspectY, // TODO: Add to internal model or find mapping
|
//AspectY = video.AspectY, // TODO: Add to internal model or find mapping
|
||||||
Refresh = NumberHelper.ConvertToDouble(video.Refresh),
|
Refresh = NumberHelper.ConvertToDouble(video.Refresh),
|
||||||
|
|
||||||
Source = new Source
|
Source = new Source { Index = indexId, Name = filename },
|
||||||
{
|
|
||||||
Index = indexId,
|
|
||||||
Name = filename,
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
|
|
||||||
switch (video.Orientation)
|
switch (video.Orientation)
|
||||||
@@ -499,11 +463,7 @@ namespace SabreTools.DatFiles.Formats
|
|||||||
{
|
{
|
||||||
Channels = NumberHelper.ConvertToInt64(sound.Channels),
|
Channels = NumberHelper.ConvertToInt64(sound.Channels),
|
||||||
|
|
||||||
Source = new Source
|
Source = new Source { Index = indexId, Name = filename },
|
||||||
{
|
|
||||||
Index = indexId,
|
|
||||||
Name = filename,
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
|
|
||||||
item.CopyMachineInformation(machine);
|
item.CopyMachineInformation(machine);
|
||||||
@@ -535,11 +495,7 @@ namespace SabreTools.DatFiles.Formats
|
|||||||
//Buttons = input.Buttons, // TODO: Add to internal model
|
//Buttons = input.Buttons, // TODO: Add to internal model
|
||||||
Coins = NumberHelper.ConvertToInt64(input.Coins),
|
Coins = NumberHelper.ConvertToInt64(input.Coins),
|
||||||
|
|
||||||
Source = new Source
|
Source = new Source { Index = indexId, Name = filename },
|
||||||
{
|
|
||||||
Index = indexId,
|
|
||||||
Name = filename,
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
|
|
||||||
var controls = new List<Control>();
|
var controls = new List<Control>();
|
||||||
@@ -593,11 +549,7 @@ namespace SabreTools.DatFiles.Formats
|
|||||||
Tag = dipswitch.Tag,
|
Tag = dipswitch.Tag,
|
||||||
Mask = dipswitch.Mask,
|
Mask = dipswitch.Mask,
|
||||||
|
|
||||||
Source = new Source
|
Source = new Source { Index = indexId, Name = filename },
|
||||||
{
|
|
||||||
Index = indexId,
|
|
||||||
Name = filename,
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
item.SetName(dipswitch.Name);
|
item.SetName(dipswitch.Name);
|
||||||
|
|
||||||
@@ -685,11 +637,7 @@ namespace SabreTools.DatFiles.Formats
|
|||||||
Tag = configuration.Tag,
|
Tag = configuration.Tag,
|
||||||
Mask = configuration.Mask,
|
Mask = configuration.Mask,
|
||||||
|
|
||||||
Source = new Source
|
Source = new Source { Index = indexId, Name = filename },
|
||||||
{
|
|
||||||
Index = indexId,
|
|
||||||
Name = filename,
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
item.SetName(configuration.Name);
|
item.SetName(configuration.Name);
|
||||||
|
|
||||||
@@ -775,11 +723,7 @@ namespace SabreTools.DatFiles.Formats
|
|||||||
{
|
{
|
||||||
Tag = port.Tag,
|
Tag = port.Tag,
|
||||||
|
|
||||||
Source = new Source
|
Source = new Source { Index = indexId, Name = filename },
|
||||||
{
|
|
||||||
Index = indexId,
|
|
||||||
Name = filename,
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
|
|
||||||
var analogs = new List<Analog>();
|
var analogs = new List<Analog>();
|
||||||
@@ -818,17 +762,9 @@ namespace SabreTools.DatFiles.Formats
|
|||||||
containsItems = true;
|
containsItems = true;
|
||||||
foreach (var adjuster in adjusters)
|
foreach (var adjuster in adjusters)
|
||||||
{
|
{
|
||||||
var item = new Adjuster
|
var item = new Adjuster { Source = new Source { Index = indexId, Name = filename } };
|
||||||
{
|
|
||||||
Default = adjuster.Default.AsYesNo(),
|
|
||||||
|
|
||||||
Source = new Source
|
|
||||||
{
|
|
||||||
Index = indexId,
|
|
||||||
Name = filename,
|
|
||||||
},
|
|
||||||
};
|
|
||||||
item.SetName(adjuster.Name);
|
item.SetName(adjuster.Name);
|
||||||
|
item.SetFieldValue<bool?>(Models.Metadata.Adjuster.DefaultKey, adjuster.Default.AsYesNo());
|
||||||
|
|
||||||
if (adjuster.Condition != null)
|
if (adjuster.Condition != null)
|
||||||
{
|
{
|
||||||
@@ -839,7 +775,7 @@ namespace SabreTools.DatFiles.Formats
|
|||||||
Relation = adjuster.Condition.Relation.AsEnumValue<Relation>(),
|
Relation = adjuster.Condition.Relation.AsEnumValue<Relation>(),
|
||||||
Value = adjuster.Condition.Value,
|
Value = adjuster.Condition.Value,
|
||||||
};
|
};
|
||||||
item.Conditions = [condition];
|
item.SetFieldValue<Condition[]?>(Models.Metadata.Adjuster.ConditionKey, [condition]);
|
||||||
}
|
}
|
||||||
|
|
||||||
item.CopyMachineInformation(machine);
|
item.CopyMachineInformation(machine);
|
||||||
@@ -877,11 +813,7 @@ namespace SabreTools.DatFiles.Formats
|
|||||||
NoSoundHardware = driver.NoSoundHardware.AsYesNo(),
|
NoSoundHardware = driver.NoSoundHardware.AsYesNo(),
|
||||||
Incomplete = driver.Incomplete.AsYesNo(),
|
Incomplete = driver.Incomplete.AsYesNo(),
|
||||||
|
|
||||||
Source = new Source
|
Source = new Source { Index = indexId, Name = filename },
|
||||||
{
|
|
||||||
Index = indexId,
|
|
||||||
Name = filename,
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
|
|
||||||
item.CopyMachineInformation(machine);
|
item.CopyMachineInformation(machine);
|
||||||
@@ -912,11 +844,7 @@ namespace SabreTools.DatFiles.Formats
|
|||||||
Status = feature.Status.AsEnumValue<FeatureStatus>(),
|
Status = feature.Status.AsEnumValue<FeatureStatus>(),
|
||||||
Overall = feature.Overall.AsEnumValue<FeatureStatus>(),
|
Overall = feature.Overall.AsEnumValue<FeatureStatus>(),
|
||||||
|
|
||||||
Source = new Source
|
Source = new Source { Index = indexId, Name = filename },
|
||||||
{
|
|
||||||
Index = indexId,
|
|
||||||
Name = filename,
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
|
|
||||||
item.CopyMachineInformation(machine);
|
item.CopyMachineInformation(machine);
|
||||||
@@ -950,11 +878,7 @@ namespace SabreTools.DatFiles.Formats
|
|||||||
Mandatory = NumberHelper.ConvertToInt64(device.Mandatory),
|
Mandatory = NumberHelper.ConvertToInt64(device.Mandatory),
|
||||||
Interface = device.Interface,
|
Interface = device.Interface,
|
||||||
|
|
||||||
Source = new Source
|
Source = new Source { Index = indexId, Name = filename },
|
||||||
{
|
|
||||||
Index = indexId,
|
|
||||||
Name = filename,
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
|
|
||||||
if (device.Instance != null)
|
if (device.Instance != null)
|
||||||
@@ -1003,11 +927,7 @@ namespace SabreTools.DatFiles.Formats
|
|||||||
{
|
{
|
||||||
var item = new Slot
|
var item = new Slot
|
||||||
{
|
{
|
||||||
Source = new Source
|
Source = new Source { Index = indexId, Name = filename },
|
||||||
{
|
|
||||||
Index = indexId,
|
|
||||||
Name = filename,
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
item.SetName(slot.Name);
|
item.SetName(slot.Name);
|
||||||
|
|
||||||
@@ -1055,11 +975,7 @@ namespace SabreTools.DatFiles.Formats
|
|||||||
Status = softwarelist.Status.AsEnumValue<SoftwareListStatus>(),
|
Status = softwarelist.Status.AsEnumValue<SoftwareListStatus>(),
|
||||||
Filter = softwarelist.Filter,
|
Filter = softwarelist.Filter,
|
||||||
|
|
||||||
Source = new Source
|
Source = new Source { Index = indexId, Name = filename },
|
||||||
{
|
|
||||||
Index = indexId,
|
|
||||||
Name = filename,
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
item.SetName(softwarelist.Name);
|
item.SetName(softwarelist.Name);
|
||||||
|
|
||||||
@@ -1091,11 +1007,7 @@ namespace SabreTools.DatFiles.Formats
|
|||||||
Default = ramoption.Default.AsYesNo(),
|
Default = ramoption.Default.AsYesNo(),
|
||||||
Content = ramoption.Content,
|
Content = ramoption.Content,
|
||||||
|
|
||||||
Source = new Source
|
Source = new Source { Index = indexId, Name = filename },
|
||||||
{
|
|
||||||
Index = indexId,
|
|
||||||
Name = filename,
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
item.SetName(ramoption.Name);
|
item.SetName(ramoption.Name);
|
||||||
|
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ using SabreTools.Core;
|
|||||||
using SabreTools.Core.Tools;
|
using SabreTools.Core.Tools;
|
||||||
using SabreTools.DatItems;
|
using SabreTools.DatItems;
|
||||||
using SabreTools.DatItems.Formats;
|
using SabreTools.DatItems.Formats;
|
||||||
|
using SabreTools.Serialization.CrossModel;
|
||||||
|
|
||||||
namespace SabreTools.DatFiles.Formats
|
namespace SabreTools.DatFiles.Formats
|
||||||
{
|
{
|
||||||
@@ -802,12 +803,12 @@ namespace SabreTools.DatFiles.Formats
|
|||||||
var adjuster = new Models.Listxml.Adjuster
|
var adjuster = new Models.Listxml.Adjuster
|
||||||
{
|
{
|
||||||
Name = item.GetName(),
|
Name = item.GetName(),
|
||||||
Default = item.Default.FromYesNo(),
|
Default = item.GetFieldValue<bool?>(Models.Metadata.Adjuster.DefaultKey).FromYesNo(),
|
||||||
};
|
};
|
||||||
|
|
||||||
if (item.ConditionsSpecified)
|
if (item.ConditionsSpecified)
|
||||||
{
|
{
|
||||||
var conditionItem = item.Conditions?.FirstOrDefault();
|
var conditionItem = item.GetFieldValue<Condition[]?>(Models.Metadata.Adjuster.ConditionKey)?.FirstOrDefault();
|
||||||
var condition = new Models.Listxml.Condition
|
var condition = new Models.Listxml.Condition
|
||||||
{
|
{
|
||||||
Tag = conditionItem?.Tag,
|
Tag = conditionItem?.Tag,
|
||||||
|
|||||||
@@ -288,11 +288,7 @@ namespace SabreTools.DatFiles.Formats
|
|||||||
{
|
{
|
||||||
var blank = new Blank
|
var blank = new Blank
|
||||||
{
|
{
|
||||||
Source = new Source
|
Source = new Source { Index = indexId, Name = filename },
|
||||||
{
|
|
||||||
Index = indexId,
|
|
||||||
Name = filename,
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
|
|
||||||
blank.CopyMachineInformation(machine);
|
blank.CopyMachineInformation(machine);
|
||||||
@@ -325,11 +321,7 @@ namespace SabreTools.DatFiles.Formats
|
|||||||
Date = release.Date,
|
Date = release.Date,
|
||||||
Default = release.Default?.AsYesNo(),
|
Default = release.Default?.AsYesNo(),
|
||||||
|
|
||||||
Source = new Source
|
Source = new Source { Index = indexId, Name = filename },
|
||||||
{
|
|
||||||
Index = indexId,
|
|
||||||
Name = filename,
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
item.SetName(release.Name);
|
item.SetName(release.Name);
|
||||||
|
|
||||||
@@ -361,11 +353,7 @@ namespace SabreTools.DatFiles.Formats
|
|||||||
Description = biosset.Description,
|
Description = biosset.Description,
|
||||||
Default = biosset.Default?.AsYesNo(),
|
Default = biosset.Default?.AsYesNo(),
|
||||||
|
|
||||||
Source = new Source
|
Source = new Source { Index = indexId, Name = filename },
|
||||||
{
|
|
||||||
Index = indexId,
|
|
||||||
Name = filename,
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
item.SetName(biosset.Name);
|
item.SetName(biosset.Name);
|
||||||
|
|
||||||
@@ -412,11 +400,7 @@ namespace SabreTools.DatFiles.Formats
|
|||||||
Inverted = rom.Inverted?.AsYesNo(),
|
Inverted = rom.Inverted?.AsYesNo(),
|
||||||
MIA = rom.MIA?.AsYesNo(),
|
MIA = rom.MIA?.AsYesNo(),
|
||||||
|
|
||||||
Source = new Source
|
Source = new Source { Index = indexId, Name = filename },
|
||||||
{
|
|
||||||
Index = indexId,
|
|
||||||
Name = filename,
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
item.SetName(rom.Name);
|
item.SetName(rom.Name);
|
||||||
|
|
||||||
@@ -450,11 +434,7 @@ namespace SabreTools.DatFiles.Formats
|
|||||||
MergeTag = disk.Merge,
|
MergeTag = disk.Merge,
|
||||||
ItemStatus = disk.Status?.AsEnumValue<ItemStatus>() ?? ItemStatus.NULL,
|
ItemStatus = disk.Status?.AsEnumValue<ItemStatus>() ?? ItemStatus.NULL,
|
||||||
|
|
||||||
Source = new Source
|
Source = new Source { Index = indexId, Name = filename },
|
||||||
{
|
|
||||||
Index = indexId,
|
|
||||||
Name = filename,
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
item.SetName(disk.Name);
|
item.SetName(disk.Name);
|
||||||
|
|
||||||
@@ -488,11 +468,7 @@ namespace SabreTools.DatFiles.Formats
|
|||||||
SHA256 = medium.SHA256,
|
SHA256 = medium.SHA256,
|
||||||
SpamSum = medium.SpamSum,
|
SpamSum = medium.SpamSum,
|
||||||
|
|
||||||
Source = new Source
|
Source = new Source { Index = indexId, Name = filename },
|
||||||
{
|
|
||||||
Index = indexId,
|
|
||||||
Name = filename,
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
item.SetName(medium.Name);
|
item.SetName(medium.Name);
|
||||||
|
|
||||||
@@ -521,11 +497,7 @@ namespace SabreTools.DatFiles.Formats
|
|||||||
{
|
{
|
||||||
var item = new DeviceReference
|
var item = new DeviceReference
|
||||||
{
|
{
|
||||||
Source = new Source
|
Source = new Source { Index = indexId, Name = filename },
|
||||||
{
|
|
||||||
Index = indexId,
|
|
||||||
Name = filename,
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
item.SetName(deviceref.Name);
|
item.SetName(deviceref.Name);
|
||||||
|
|
||||||
@@ -554,11 +526,7 @@ namespace SabreTools.DatFiles.Formats
|
|||||||
{
|
{
|
||||||
var item = new Sample
|
var item = new Sample
|
||||||
{
|
{
|
||||||
Source = new Source
|
Source = new Source { Index = indexId, Name = filename },
|
||||||
{
|
|
||||||
Index = indexId,
|
|
||||||
Name = filename,
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
item.SetName(sample.Name);
|
item.SetName(sample.Name);
|
||||||
|
|
||||||
@@ -587,11 +555,7 @@ namespace SabreTools.DatFiles.Formats
|
|||||||
{
|
{
|
||||||
var item = new Archive
|
var item = new Archive
|
||||||
{
|
{
|
||||||
Source = new Source
|
Source = new Source { Index = indexId, Name = filename },
|
||||||
{
|
|
||||||
Index = indexId,
|
|
||||||
Name = filename,
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
item.SetName(archive.Name);
|
item.SetName(archive.Name);
|
||||||
|
|
||||||
@@ -627,11 +591,7 @@ namespace SabreTools.DatFiles.Formats
|
|||||||
NoSoundHardware = driver.NoSoundHardware?.AsYesNo(),
|
NoSoundHardware = driver.NoSoundHardware?.AsYesNo(),
|
||||||
Incomplete = driver.Incomplete?.AsYesNo(),
|
Incomplete = driver.Incomplete?.AsYesNo(),
|
||||||
|
|
||||||
Source = new Source
|
Source = new Source { Index = indexId, Name = filename },
|
||||||
{
|
|
||||||
Index = indexId,
|
|
||||||
Name = filename,
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
|
|
||||||
item.CopyMachineInformation(machine);
|
item.CopyMachineInformation(machine);
|
||||||
@@ -662,11 +622,7 @@ namespace SabreTools.DatFiles.Formats
|
|||||||
Status = softwarelist.Status?.AsEnumValue<SoftwareListStatus>() ?? SoftwareListStatus.None,
|
Status = softwarelist.Status?.AsEnumValue<SoftwareListStatus>() ?? SoftwareListStatus.None,
|
||||||
Filter = softwarelist.Filter,
|
Filter = softwarelist.Filter,
|
||||||
|
|
||||||
Source = new Source
|
Source = new Source { Index = indexId, Name = filename },
|
||||||
{
|
|
||||||
Index = indexId,
|
|
||||||
Name = filename,
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
item.SetName(softwarelist.Name);
|
item.SetName(softwarelist.Name);
|
||||||
|
|
||||||
|
|||||||
@@ -331,11 +331,7 @@ namespace SabreTools.DatFiles.Formats
|
|||||||
{
|
{
|
||||||
var blank = new Blank
|
var blank = new Blank
|
||||||
{
|
{
|
||||||
Source = new Source
|
Source = new Source { Index = indexId, Name = filename },
|
||||||
{
|
|
||||||
Index = indexId,
|
|
||||||
Name = filename,
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
|
|
||||||
blank.CopyMachineInformation(machine);
|
blank.CopyMachineInformation(machine);
|
||||||
@@ -374,11 +370,7 @@ namespace SabreTools.DatFiles.Formats
|
|||||||
CRC = crc.Content,
|
CRC = crc.Content,
|
||||||
ItemStatus = ItemStatus.None,
|
ItemStatus = ItemStatus.None,
|
||||||
|
|
||||||
Source = new Source
|
Source = new Source { Index = indexId, Name = filename },
|
||||||
{
|
|
||||||
Index = indexId,
|
|
||||||
Name = filename,
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
item.SetName(name);
|
item.SetName(name);
|
||||||
|
|
||||||
|
|||||||
@@ -103,11 +103,7 @@ namespace SabreTools.DatFiles.Formats
|
|||||||
{
|
{
|
||||||
var blank = new Blank
|
var blank = new Blank
|
||||||
{
|
{
|
||||||
Source = new Source
|
Source = new Source { Index = indexId, Name = filename },
|
||||||
{
|
|
||||||
Index = indexId,
|
|
||||||
Name = filename,
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
|
|
||||||
blank.CopyMachineInformation(machine);
|
blank.CopyMachineInformation(machine);
|
||||||
@@ -148,11 +144,7 @@ namespace SabreTools.DatFiles.Formats
|
|||||||
SHA1 = rom.Hash,
|
SHA1 = rom.Hash,
|
||||||
Remark = rom.Remark,
|
Remark = rom.Remark,
|
||||||
|
|
||||||
Source = new Source
|
Source = new Source { Index = indexId, Name = filename },
|
||||||
{
|
|
||||||
Index = indexId,
|
|
||||||
Name = filename,
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
item.SetName(name);
|
item.SetName(name);
|
||||||
|
|
||||||
|
|||||||
@@ -123,11 +123,7 @@ namespace SabreTools.DatFiles.Formats
|
|||||||
RomOf = rom.RomOf,
|
RomOf = rom.RomOf,
|
||||||
},
|
},
|
||||||
|
|
||||||
Source = new Source
|
Source = new Source { Index = indexId, Name = filename },
|
||||||
{
|
|
||||||
Index = indexId,
|
|
||||||
Name = filename,
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
item.SetName(rom.RomName);
|
item.SetName(rom.RomName);
|
||||||
|
|
||||||
|
|||||||
@@ -88,11 +88,7 @@ namespace SabreTools.DatFiles.Formats
|
|||||||
SHA1 = row.SHA1,
|
SHA1 = row.SHA1,
|
||||||
ItemStatus = row.Status.AsEnumValue<ItemStatus>(),
|
ItemStatus = row.Status.AsEnumValue<ItemStatus>(),
|
||||||
|
|
||||||
Source = new Source
|
Source = new Source { Index = indexId, Name = filename },
|
||||||
{
|
|
||||||
Index = indexId,
|
|
||||||
Name = filename,
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
item.SetName(row.DiskName);
|
item.SetName(row.DiskName);
|
||||||
break;
|
break;
|
||||||
@@ -105,11 +101,7 @@ namespace SabreTools.DatFiles.Formats
|
|||||||
SHA256 = row.SHA256,
|
SHA256 = row.SHA256,
|
||||||
SpamSum = row.SpamSum,
|
SpamSum = row.SpamSum,
|
||||||
|
|
||||||
Source = new Source
|
Source = new Source { Index = indexId, Name = filename },
|
||||||
{
|
|
||||||
Index = indexId,
|
|
||||||
Name = filename,
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
item.SetName(row.DiskName);
|
item.SetName(row.DiskName);
|
||||||
break;
|
break;
|
||||||
@@ -126,11 +118,7 @@ namespace SabreTools.DatFiles.Formats
|
|||||||
SpamSum = row.SpamSum,
|
SpamSum = row.SpamSum,
|
||||||
ItemStatus = row.Status.AsEnumValue<ItemStatus>(),
|
ItemStatus = row.Status.AsEnumValue<ItemStatus>(),
|
||||||
|
|
||||||
Source = new Source
|
Source = new Source { Index = indexId, Name = filename },
|
||||||
{
|
|
||||||
Index = indexId,
|
|
||||||
Name = filename,
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
item.SetName(row.RomName);
|
item.SetName(row.RomName);
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -108,11 +108,7 @@ namespace SabreTools.DatFiles.Formats
|
|||||||
{
|
{
|
||||||
Value = info.Value,
|
Value = info.Value,
|
||||||
|
|
||||||
Source = new Source
|
Source = new Source { Index = indexId, Name = filename },
|
||||||
{
|
|
||||||
Index = indexId,
|
|
||||||
Name = filename,
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
infoItem.SetName(info.Name);
|
infoItem.SetName(info.Name);
|
||||||
|
|
||||||
@@ -127,11 +123,7 @@ namespace SabreTools.DatFiles.Formats
|
|||||||
{
|
{
|
||||||
Value = sharedfeat.Value,
|
Value = sharedfeat.Value,
|
||||||
|
|
||||||
Source = new Source
|
Source = new Source { Index = indexId, Name = filename },
|
||||||
{
|
|
||||||
Index = indexId,
|
|
||||||
Name = filename,
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
sharedfeatItem.SetName(sharedfeat.Name);
|
sharedfeatItem.SetName(sharedfeat.Name);
|
||||||
|
|
||||||
@@ -150,11 +142,7 @@ namespace SabreTools.DatFiles.Formats
|
|||||||
{
|
{
|
||||||
var blank = new Blank
|
var blank = new Blank
|
||||||
{
|
{
|
||||||
Source = new Source
|
Source = new Source { Index = indexId, Name = filename },
|
||||||
{
|
|
||||||
Index = indexId,
|
|
||||||
Name = filename,
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
|
|
||||||
blank.CopyMachineInformation(machine);
|
blank.CopyMachineInformation(machine);
|
||||||
@@ -184,11 +172,7 @@ namespace SabreTools.DatFiles.Formats
|
|||||||
Interface = part.Interface,
|
Interface = part.Interface,
|
||||||
Features = CreateFeatures(part.Feature, machine, filename, indexId, statsOnly),
|
Features = CreateFeatures(part.Feature, machine, filename, indexId, statsOnly),
|
||||||
|
|
||||||
Source = new Source
|
Source = new Source { Index = indexId, Name = filename },
|
||||||
{
|
|
||||||
Index = indexId,
|
|
||||||
Name = filename,
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
item.SetName(part.Name);
|
item.SetName(part.Name);
|
||||||
|
|
||||||
@@ -221,11 +205,7 @@ namespace SabreTools.DatFiles.Formats
|
|||||||
{
|
{
|
||||||
Value = feature.Value,
|
Value = feature.Value,
|
||||||
|
|
||||||
Source = new Source
|
Source = new Source { Index = indexId, Name = filename },
|
||||||
{
|
|
||||||
Index = indexId,
|
|
||||||
Name = filename,
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
item.SetName(feature.Name);
|
item.SetName(feature.Name);
|
||||||
|
|
||||||
@@ -260,11 +240,7 @@ namespace SabreTools.DatFiles.Formats
|
|||||||
Width = NumberHelper.ConvertToInt64(dataarea.Width),
|
Width = NumberHelper.ConvertToInt64(dataarea.Width),
|
||||||
Endianness = dataarea.Endianness.AsEnumValue<Endianness>(),
|
Endianness = dataarea.Endianness.AsEnumValue<Endianness>(),
|
||||||
|
|
||||||
Source = new Source
|
Source = new Source { Index = indexId, Name = filename },
|
||||||
{
|
|
||||||
Index = indexId,
|
|
||||||
Name = filename,
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
item.SetName(dataarea.Name);
|
item.SetName(dataarea.Name);
|
||||||
|
|
||||||
@@ -306,11 +282,7 @@ namespace SabreTools.DatFiles.Formats
|
|||||||
Part = part,
|
Part = part,
|
||||||
DataArea = dataarea,
|
DataArea = dataarea,
|
||||||
|
|
||||||
Source = new Source
|
Source = new Source { Index = indexId, Name = filename },
|
||||||
{
|
|
||||||
Index = indexId,
|
|
||||||
Name = filename,
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
item.SetName(rom.Name);
|
item.SetName(rom.Name);
|
||||||
|
|
||||||
@@ -339,11 +311,7 @@ namespace SabreTools.DatFiles.Formats
|
|||||||
{
|
{
|
||||||
var item = new DiskArea
|
var item = new DiskArea
|
||||||
{
|
{
|
||||||
Source = new Source
|
Source = new Source { Index = indexId, Name = filename },
|
||||||
{
|
|
||||||
Index = indexId,
|
|
||||||
Name = filename,
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
item.SetName(diskarea.Name);
|
item.SetName(diskarea.Name);
|
||||||
|
|
||||||
@@ -382,11 +350,7 @@ namespace SabreTools.DatFiles.Formats
|
|||||||
Part = part,
|
Part = part,
|
||||||
DiskArea = diskarea,
|
DiskArea = diskarea,
|
||||||
|
|
||||||
Source = new Source
|
Source = new Source { Index = indexId, Name = filename },
|
||||||
{
|
|
||||||
Index = indexId,
|
|
||||||
Name = filename,
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
item.SetName(disk.Name);
|
item.SetName(disk.Name);
|
||||||
|
|
||||||
@@ -421,11 +385,7 @@ namespace SabreTools.DatFiles.Formats
|
|||||||
|
|
||||||
Part = part,
|
Part = part,
|
||||||
|
|
||||||
Source = new Source
|
Source = new Source { Index = indexId, Name = filename },
|
||||||
{
|
|
||||||
Index = indexId,
|
|
||||||
Name = filename,
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
item.SetName(dipswitch.Name);
|
item.SetName(dipswitch.Name);
|
||||||
|
|
||||||
@@ -455,11 +415,7 @@ namespace SabreTools.DatFiles.Formats
|
|||||||
Value = dipvalue.Value,
|
Value = dipvalue.Value,
|
||||||
Default = dipvalue.Default.AsYesNo(),
|
Default = dipvalue.Default.AsYesNo(),
|
||||||
|
|
||||||
Source = new Source
|
Source = new Source { Index = indexId, Name = filename },
|
||||||
{
|
|
||||||
Index = indexId,
|
|
||||||
Name = filename,
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
item.SetName(dipvalue.Name);
|
item.SetName(dipvalue.Name);
|
||||||
|
|
||||||
|
|||||||
@@ -248,7 +248,7 @@ namespace SabreTools.DatFiles
|
|||||||
// Field.DatItem_Conditions does not apply here
|
// Field.DatItem_Conditions does not apply here
|
||||||
if (adjuster.ConditionsSpecified)
|
if (adjuster.ConditionsSpecified)
|
||||||
{
|
{
|
||||||
foreach (Condition subCondition in adjuster.Conditions!)
|
foreach (Condition subCondition in adjuster.GetFieldValue<Condition[]?>(Models.Metadata.Adjuster.ConditionKey)!)
|
||||||
{
|
{
|
||||||
SetFields(subCondition);
|
SetFields(subCondition);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,4 @@
|
|||||||
using System.Collections.Generic;
|
using System.Xml.Serialization;
|
||||||
using System.Linq;
|
|
||||||
using System.Xml.Serialization;
|
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using SabreTools.Core;
|
using SabreTools.Core;
|
||||||
|
|
||||||
@@ -14,31 +12,15 @@ namespace SabreTools.DatItems.Formats
|
|||||||
{
|
{
|
||||||
#region Fields
|
#region Fields
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Determine whether the value is default
|
|
||||||
/// </summary>
|
|
||||||
[JsonProperty("default", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("default")]
|
|
||||||
public bool? Default
|
|
||||||
{
|
|
||||||
get => _internal.ReadBool(Models.Metadata.Adjuster.DefaultKey);
|
|
||||||
set => _internal[Models.Metadata.Adjuster.DefaultKey] = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
public bool DefaultSpecified { get { return Default != null; } }
|
public bool ConditionsSpecified
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Conditions associated with the adjustment
|
|
||||||
/// </summary>
|
|
||||||
[JsonProperty("conditions", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("conditions")]
|
|
||||||
public List<Condition>? Conditions
|
|
||||||
{
|
{
|
||||||
get => _internal.Read<Condition[]>(Models.Metadata.Adjuster.ConditionKey)?.ToList();
|
get
|
||||||
set => _internal[Models.Metadata.Adjuster.ConditionKey] = value?.ToArray();
|
{
|
||||||
|
var conditions = GetFieldValue<Condition[]?>(Models.Metadata.Adjuster.ConditionKey);
|
||||||
|
return conditions != null && conditions.Length > 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[JsonIgnore]
|
|
||||||
public bool ConditionsSpecified { get { return Conditions != null && Conditions.Count > 0; } }
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|||||||
@@ -282,7 +282,7 @@ namespace SabreTools.Filtering
|
|||||||
if (!adjuster.ConditionsSpecified)
|
if (!adjuster.ConditionsSpecified)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
foreach (Condition subCondition in adjuster.Conditions!)
|
foreach (Condition subCondition in adjuster.GetFieldValue<Condition[]?>(Models.Metadata.Adjuster.ConditionKey)!)
|
||||||
{
|
{
|
||||||
RemoveFields(subCondition);
|
RemoveFields(subCondition);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,3 @@
|
|||||||
using System.Collections.Generic;
|
|
||||||
|
|
||||||
using SabreTools.Core;
|
|
||||||
using SabreTools.DatFiles;
|
using SabreTools.DatFiles;
|
||||||
using SabreTools.DatItems;
|
using SabreTools.DatItems;
|
||||||
using SabreTools.DatItems.Formats;
|
using SabreTools.DatItems.Formats;
|
||||||
@@ -24,7 +21,6 @@ namespace SabreTools.Test.DatFiles
|
|||||||
[
|
[
|
||||||
new Rom
|
new Rom
|
||||||
{
|
{
|
||||||
Name = "rom-1",
|
|
||||||
Size = 1024,
|
Size = 1024,
|
||||||
CRC = "DEADBEEF",
|
CRC = "DEADBEEF",
|
||||||
SHA1 = "0000000fbbb37f8488100b1b4697012de631a5e6",
|
SHA1 = "0000000fbbb37f8488100b1b4697012de631a5e6",
|
||||||
@@ -32,18 +28,16 @@ namespace SabreTools.Test.DatFiles
|
|||||||
},
|
},
|
||||||
new Rom
|
new Rom
|
||||||
{
|
{
|
||||||
Name = "rom-2",
|
|
||||||
Size = 1024,
|
Size = 1024,
|
||||||
CRC = "DEADBEEF",
|
CRC = "DEADBEEF",
|
||||||
SHA1 = "000000e948edcb4f7704b8af85a77a3339ecce44",
|
SHA1 = "000000e948edcb4f7704b8af85a77a3339ecce44",
|
||||||
Machine = new Machine { Name = "game-1" },
|
Machine = new Machine { Name = "game-1" },
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
["game-2"] = new ConcurrentList<DatItem>
|
["game-2"] =
|
||||||
{
|
[
|
||||||
new Rom
|
new Rom
|
||||||
{
|
{
|
||||||
Name = "rom-3",
|
|
||||||
Size = 1024,
|
Size = 1024,
|
||||||
CRC = "DEADBEEF",
|
CRC = "DEADBEEF",
|
||||||
SHA1 = "00000ea4014ce66679e7e17d56ac510f67e39e26",
|
SHA1 = "00000ea4014ce66679e7e17d56ac510f67e39e26",
|
||||||
@@ -51,14 +45,17 @@ namespace SabreTools.Test.DatFiles
|
|||||||
},
|
},
|
||||||
new Rom
|
new Rom
|
||||||
{
|
{
|
||||||
Name = "rom-4",
|
|
||||||
Size = 1024,
|
Size = 1024,
|
||||||
CRC = "DEADBEEF",
|
CRC = "DEADBEEF",
|
||||||
SHA1 = "00000151d437442e74e5134023fab8bf694a2487",
|
SHA1 = "00000151d437442e74e5134023fab8bf694a2487",
|
||||||
Machine = new Machine { Name = "game-2" },
|
Machine = new Machine { Name = "game-2" },
|
||||||
},
|
},
|
||||||
},
|
],
|
||||||
};
|
};
|
||||||
|
dict["game-1"]![0].SetName("rom-1");
|
||||||
|
dict["game-1"]![1].SetName("rom-2");
|
||||||
|
dict["game-2"]![0].SetName("rom-3");
|
||||||
|
dict["game-2"]![1].SetName("rom-4");
|
||||||
|
|
||||||
dict.BucketBy(itemKey, DedupeType.None);
|
dict.BucketBy(itemKey, DedupeType.None);
|
||||||
Assert.Equal(expected, dict.Keys.Count);
|
Assert.Equal(expected, dict.Keys.Count);
|
||||||
@@ -70,8 +67,8 @@ namespace SabreTools.Test.DatFiles
|
|||||||
// Setup the dictionary
|
// Setup the dictionary
|
||||||
var dict = new ItemDictionary
|
var dict = new ItemDictionary
|
||||||
{
|
{
|
||||||
["game-1"] = new ConcurrentList<DatItem> { new Rom(), },
|
["game-1"] = [new Rom(),],
|
||||||
["game-2"] = new ConcurrentList<DatItem>(),
|
["game-2"] = [],
|
||||||
["game-3"] = null,
|
["game-3"] = null,
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -85,11 +82,10 @@ namespace SabreTools.Test.DatFiles
|
|||||||
// Setup the dictionary
|
// Setup the dictionary
|
||||||
var dict = new ItemDictionary
|
var dict = new ItemDictionary
|
||||||
{
|
{
|
||||||
["game-1"] = new ConcurrentList<DatItem>
|
["game-1"] =
|
||||||
{
|
[
|
||||||
new Rom
|
new Rom
|
||||||
{
|
{
|
||||||
Name = "rom-1",
|
|
||||||
Size = 1024,
|
Size = 1024,
|
||||||
CRC = "DEADBEEF",
|
CRC = "DEADBEEF",
|
||||||
SHA1 = "0000000fbbb37f8488100b1b4697012de631a5e6",
|
SHA1 = "0000000fbbb37f8488100b1b4697012de631a5e6",
|
||||||
@@ -97,15 +93,16 @@ namespace SabreTools.Test.DatFiles
|
|||||||
},
|
},
|
||||||
new Rom
|
new Rom
|
||||||
{
|
{
|
||||||
Name = "rom-2",
|
|
||||||
Size = 1024,
|
Size = 1024,
|
||||||
CRC = "DEADBEEF",
|
CRC = "DEADBEEF",
|
||||||
SHA1 = "000000e948edcb4f7704b8af85a77a3339ecce44",
|
SHA1 = "000000e948edcb4f7704b8af85a77a3339ecce44",
|
||||||
Machine = new Machine { Name = "game-1" },
|
Machine = new Machine { Name = "game-1" },
|
||||||
Remove = true,
|
Remove = true,
|
||||||
},
|
},
|
||||||
},
|
],
|
||||||
};
|
};
|
||||||
|
dict["game-1"]![0].SetName("rom-1");
|
||||||
|
dict["game-1"]![1].SetName("rom-2");
|
||||||
|
|
||||||
dict.ClearMarked();
|
dict.ClearMarked();
|
||||||
string key = Assert.Single(dict.Keys);
|
string key = Assert.Single(dict.Keys);
|
||||||
@@ -122,32 +119,32 @@ namespace SabreTools.Test.DatFiles
|
|||||||
// Setup the dictionary
|
// Setup the dictionary
|
||||||
var dict = new ItemDictionary
|
var dict = new ItemDictionary
|
||||||
{
|
{
|
||||||
["game-1"] = new ConcurrentList<DatItem>
|
["game-1"] =
|
||||||
{
|
[
|
||||||
new Rom
|
new Rom
|
||||||
{
|
{
|
||||||
Name = "rom-1",
|
|
||||||
Size = 1024,
|
Size = 1024,
|
||||||
SHA1 = "0000000fbbb37f8488100b1b4697012de631a5e6",
|
SHA1 = "0000000fbbb37f8488100b1b4697012de631a5e6",
|
||||||
Machine = new Machine { Name = "game-1" },
|
Machine = new Machine { Name = "game-1" },
|
||||||
},
|
},
|
||||||
new Rom
|
new Rom
|
||||||
{
|
{
|
||||||
Name = "rom-2",
|
|
||||||
Size = 1024,
|
Size = 1024,
|
||||||
SHA1 = "000000e948edcb4f7704b8af85a77a3339ecce44",
|
SHA1 = "000000e948edcb4f7704b8af85a77a3339ecce44",
|
||||||
Machine = new Machine { Name = "game-1" },
|
Machine = new Machine { Name = "game-1" },
|
||||||
},
|
},
|
||||||
},
|
],
|
||||||
};
|
};
|
||||||
|
dict["game-1"]![0].SetName("rom-1");
|
||||||
|
dict["game-1"]![1].SetName("rom-2");
|
||||||
|
|
||||||
var rom = new Rom
|
var rom = new Rom
|
||||||
{
|
{
|
||||||
Name = "rom-1",
|
|
||||||
Size = hasDuplicate ? 1024 : 2048,
|
Size = hasDuplicate ? 1024 : 2048,
|
||||||
SHA1 = "0000000fbbb37f8488100b1b4697012de631a5e6",
|
SHA1 = "0000000fbbb37f8488100b1b4697012de631a5e6",
|
||||||
Machine = new Machine { Name = "game-1" },
|
Machine = new Machine { Name = "game-1" },
|
||||||
};
|
};
|
||||||
|
rom.SetName("rom-1");
|
||||||
|
|
||||||
var actual = dict.GetDuplicates(rom);
|
var actual = dict.GetDuplicates(rom);
|
||||||
Assert.Equal(expected, actual.Count);
|
Assert.Equal(expected, actual.Count);
|
||||||
@@ -161,32 +158,32 @@ namespace SabreTools.Test.DatFiles
|
|||||||
// Setup the dictionary
|
// Setup the dictionary
|
||||||
var dict = new ItemDictionary
|
var dict = new ItemDictionary
|
||||||
{
|
{
|
||||||
["game-1"] = new ConcurrentList<DatItem>
|
["game-1"] =
|
||||||
{
|
[
|
||||||
new Rom
|
new Rom
|
||||||
{
|
{
|
||||||
Name = "rom-1",
|
|
||||||
Size = 1024,
|
Size = 1024,
|
||||||
SHA1 = "0000000fbbb37f8488100b1b4697012de631a5e6",
|
SHA1 = "0000000fbbb37f8488100b1b4697012de631a5e6",
|
||||||
Machine = new Machine { Name = "game-1" },
|
Machine = new Machine { Name = "game-1" },
|
||||||
},
|
},
|
||||||
new Rom
|
new Rom
|
||||||
{
|
{
|
||||||
Name = "rom-2",
|
|
||||||
Size = 1024,
|
Size = 1024,
|
||||||
SHA1 = "000000e948edcb4f7704b8af85a77a3339ecce44",
|
SHA1 = "000000e948edcb4f7704b8af85a77a3339ecce44",
|
||||||
Machine = new Machine { Name = "game-1" },
|
Machine = new Machine { Name = "game-1" },
|
||||||
},
|
},
|
||||||
},
|
],
|
||||||
};
|
};
|
||||||
|
dict["game-1"]![0].SetName("rom-1");
|
||||||
|
dict["game-1"]![1].SetName("rom-2");
|
||||||
|
|
||||||
var rom = new Rom
|
var rom = new Rom
|
||||||
{
|
{
|
||||||
Name = "rom-1",
|
|
||||||
Size = expected ? 1024 : 2048,
|
Size = expected ? 1024 : 2048,
|
||||||
SHA1 = "0000000fbbb37f8488100b1b4697012de631a5e6",
|
SHA1 = "0000000fbbb37f8488100b1b4697012de631a5e6",
|
||||||
Machine = new Machine { Name = "game-1" },
|
Machine = new Machine { Name = "game-1" },
|
||||||
};
|
};
|
||||||
|
rom.SetName("rom-1");
|
||||||
|
|
||||||
bool actual = dict.HasDuplicates(rom);
|
bool actual = dict.HasDuplicates(rom);
|
||||||
Assert.Equal(expected, actual);
|
Assert.Equal(expected, actual);
|
||||||
|
|||||||
@@ -32,15 +32,16 @@ namespace SabreTools.Test.DatFiles
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
private static DatItem CreateDatItem()
|
private static DatItem CreateDatItem()
|
||||||
{
|
{
|
||||||
return new Rom
|
var rom = new Rom
|
||||||
{
|
{
|
||||||
Name = "foo",
|
|
||||||
Machine = new Machine
|
Machine = new Machine
|
||||||
{
|
{
|
||||||
Name = "bar",
|
Name = "bar",
|
||||||
Description = "bar",
|
Description = "bar",
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
rom.SetName("foo");
|
||||||
|
return rom;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -49,30 +49,24 @@ namespace SabreTools.Test.DatItems
|
|||||||
{
|
{
|
||||||
var romA = new Rom
|
var romA = new Rom
|
||||||
{
|
{
|
||||||
Name = "same-name",
|
|
||||||
CRC = "DEADBEEF",
|
CRC = "DEADBEEF",
|
||||||
Machine = new Machine
|
Machine = new Machine
|
||||||
{
|
{
|
||||||
Name = "name-same",
|
Name = "name-same",
|
||||||
},
|
},
|
||||||
Source = new Source
|
Source = new Source { Index = 0 },
|
||||||
{
|
|
||||||
Index = 0,
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
|
romA.SetName("same-name");
|
||||||
var romB = new Rom
|
var romB = new Rom
|
||||||
{
|
{
|
||||||
Name = "same-name",
|
|
||||||
CRC = "DEADBEEF",
|
CRC = "DEADBEEF",
|
||||||
Machine = new Machine
|
Machine = new Machine
|
||||||
{
|
{
|
||||||
Name = "name-same",
|
Name = "name-same",
|
||||||
},
|
},
|
||||||
Source = new Source
|
Source = new Source { Index = 1 },
|
||||||
{
|
|
||||||
Index = 1,
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
|
romB.SetName("same-name");
|
||||||
|
|
||||||
var actual = romA.GetDuplicateStatus(romB);
|
var actual = romA.GetDuplicateStatus(romB);
|
||||||
Assert.Equal(DupeType.External | DupeType.All, actual);
|
Assert.Equal(DupeType.External | DupeType.All, actual);
|
||||||
@@ -83,30 +77,24 @@ namespace SabreTools.Test.DatItems
|
|||||||
{
|
{
|
||||||
var romA = new Rom
|
var romA = new Rom
|
||||||
{
|
{
|
||||||
Name = "same-name",
|
|
||||||
CRC = "DEADBEEF",
|
CRC = "DEADBEEF",
|
||||||
Machine = new Machine
|
Machine = new Machine
|
||||||
{
|
{
|
||||||
Name = "name-same",
|
Name = "name-same",
|
||||||
},
|
},
|
||||||
Source = new Source
|
Source = new Source { Index = 0 },
|
||||||
{
|
|
||||||
Index = 0,
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
|
romA.SetName("same-name");
|
||||||
var romB = new Rom
|
var romB = new Rom
|
||||||
{
|
{
|
||||||
Name = "same-name",
|
|
||||||
CRC = "DEADBEEF",
|
CRC = "DEADBEEF",
|
||||||
Machine = new Machine
|
Machine = new Machine
|
||||||
{
|
{
|
||||||
Name = "not-name-same",
|
Name = "not-name-same",
|
||||||
},
|
},
|
||||||
Source = new Source
|
Source = new Source { Index = 1 },
|
||||||
{
|
|
||||||
Index = 1,
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
|
romB.SetName("same-name");
|
||||||
|
|
||||||
var actual = romA.GetDuplicateStatus(romB);
|
var actual = romA.GetDuplicateStatus(romB);
|
||||||
Assert.Equal(DupeType.External | DupeType.Hash, actual);
|
Assert.Equal(DupeType.External | DupeType.Hash, actual);
|
||||||
@@ -117,30 +105,24 @@ namespace SabreTools.Test.DatItems
|
|||||||
{
|
{
|
||||||
var romA = new Rom
|
var romA = new Rom
|
||||||
{
|
{
|
||||||
Name = "same-name",
|
|
||||||
CRC = "DEADBEEF",
|
CRC = "DEADBEEF",
|
||||||
Machine = new Machine
|
Machine = new Machine
|
||||||
{
|
{
|
||||||
Name = "name-same",
|
Name = "name-same",
|
||||||
},
|
},
|
||||||
Source = new Source
|
Source = new Source { Index = 0 },
|
||||||
{
|
|
||||||
Index = 0,
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
|
romA.SetName("same-name");
|
||||||
var romB = new Rom
|
var romB = new Rom
|
||||||
{
|
{
|
||||||
Name = "same-name",
|
|
||||||
CRC = "DEADBEEF",
|
CRC = "DEADBEEF",
|
||||||
Machine = new Machine
|
Machine = new Machine
|
||||||
{
|
{
|
||||||
Name = "name-same",
|
Name = "name-same",
|
||||||
},
|
},
|
||||||
Source = new Source
|
Source = new Source { Index = 0 },
|
||||||
{
|
|
||||||
Index = 0,
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
|
romB.SetName("same-name");
|
||||||
|
|
||||||
var actual = romA.GetDuplicateStatus(romB);
|
var actual = romA.GetDuplicateStatus(romB);
|
||||||
Assert.Equal(DupeType.Internal | DupeType.All, actual);
|
Assert.Equal(DupeType.Internal | DupeType.All, actual);
|
||||||
@@ -151,30 +133,24 @@ namespace SabreTools.Test.DatItems
|
|||||||
{
|
{
|
||||||
var romA = new Rom
|
var romA = new Rom
|
||||||
{
|
{
|
||||||
Name = "same-name",
|
|
||||||
CRC = "DEADBEEF",
|
CRC = "DEADBEEF",
|
||||||
Machine = new Machine
|
Machine = new Machine
|
||||||
{
|
{
|
||||||
Name = "name-same",
|
Name = "name-same",
|
||||||
},
|
},
|
||||||
Source = new Source
|
Source = new Source { Index = 0 },
|
||||||
{
|
|
||||||
Index = 0,
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
|
romA.SetName("same-name");
|
||||||
var romB = new Rom
|
var romB = new Rom
|
||||||
{
|
{
|
||||||
Name = "same-name",
|
|
||||||
CRC = "DEADBEEF",
|
CRC = "DEADBEEF",
|
||||||
Machine = new Machine
|
Machine = new Machine
|
||||||
{
|
{
|
||||||
Name = "not-name-same",
|
Name = "not-name-same",
|
||||||
},
|
},
|
||||||
Source = new Source
|
Source = new Source { Index = 0 },
|
||||||
{
|
|
||||||
Index = 0,
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
|
romB.SetName("same-name");
|
||||||
|
|
||||||
var actual = romA.GetDuplicateStatus(romB);
|
var actual = romA.GetDuplicateStatus(romB);
|
||||||
Assert.Equal(DupeType.Internal | DupeType.Hash, actual);
|
Assert.Equal(DupeType.Internal | DupeType.Hash, actual);
|
||||||
|
|||||||
@@ -68,15 +68,16 @@ namespace SabreTools.Test.Filter
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
private static DatItem CreateDatItem()
|
private static DatItem CreateDatItem()
|
||||||
{
|
{
|
||||||
return new Rom
|
var rom = new Rom
|
||||||
{
|
{
|
||||||
Name = "foo",
|
|
||||||
Machine = new Machine
|
Machine = new Machine
|
||||||
{
|
{
|
||||||
Name = "bar",
|
Name = "bar",
|
||||||
Description = "bar",
|
Description = "bar",
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
rom.SetName("foo");
|
||||||
|
return rom;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -115,15 +115,16 @@ namespace SabreTools.Test.Filtering
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
private static DatItem CreateDatItem(string name, string machine, string desc)
|
private static DatItem CreateDatItem(string name, string machine, string desc)
|
||||||
{
|
{
|
||||||
return new Rom
|
var rom = new Rom
|
||||||
{
|
{
|
||||||
Name = name,
|
|
||||||
Machine = new Machine
|
Machine = new Machine
|
||||||
{
|
{
|
||||||
Name = machine,
|
Name = machine,
|
||||||
Description = desc,
|
Description = desc,
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
rom.SetName(name);
|
||||||
|
return rom;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -32,15 +32,16 @@ namespace SabreTools.Test.Filtering
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
private static DatItem CreateDatItem()
|
private static DatItem CreateDatItem()
|
||||||
{
|
{
|
||||||
return new Rom
|
var rom = new Rom
|
||||||
{
|
{
|
||||||
Name = "foo",
|
|
||||||
Machine = new Machine
|
Machine = new Machine
|
||||||
{
|
{
|
||||||
Name = "bar",
|
Name = "bar",
|
||||||
Description = "bar",
|
Description = "bar",
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
rom.SetName("foo");
|
||||||
|
return rom;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -40,15 +40,16 @@ namespace SabreTools.Test.Filtering
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
private static DatItem CreateDatItem()
|
private static DatItem CreateDatItem()
|
||||||
{
|
{
|
||||||
return new Rom
|
var rom = new Rom
|
||||||
{
|
{
|
||||||
Name = "foo",
|
|
||||||
Machine = new Machine
|
Machine = new Machine
|
||||||
{
|
{
|
||||||
Name = "bar",
|
Name = "bar",
|
||||||
Description = "bar",
|
Description = "bar",
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
rom.SetName("foo");
|
||||||
|
return rom;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user