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,
|
||||
|
||||
Source = new Source
|
||||
{
|
||||
Index = indexId,
|
||||
Name = filename,
|
||||
},
|
||||
Source = new Source { Index = indexId, Name = filename },
|
||||
};
|
||||
rom.SetName(name);
|
||||
|
||||
|
||||
@@ -95,11 +95,7 @@ namespace SabreTools.DatFiles.Formats
|
||||
AltTitle = row.AltTitle,
|
||||
// TODO: Add extended fields
|
||||
|
||||
Source = new Source
|
||||
{
|
||||
Index = indexId,
|
||||
Name = filename,
|
||||
},
|
||||
Source = new Source { Index = indexId, Name = filename },
|
||||
};
|
||||
rom.SetName("-");
|
||||
|
||||
|
||||
@@ -140,11 +140,7 @@ namespace SabreTools.DatFiles.Formats
|
||||
{
|
||||
var blank = new Blank
|
||||
{
|
||||
Source = new Source
|
||||
{
|
||||
Index = indexId,
|
||||
Name = filename,
|
||||
},
|
||||
Source = new Source { Index = indexId, Name = filename },
|
||||
};
|
||||
|
||||
blank.CopyMachineInformation(machine);
|
||||
@@ -177,11 +173,7 @@ namespace SabreTools.DatFiles.Formats
|
||||
Date = release.Date,
|
||||
Default = release.Default?.AsYesNo(),
|
||||
|
||||
Source = new Source
|
||||
{
|
||||
Index = indexId,
|
||||
Name = filename,
|
||||
},
|
||||
Source = new Source { Index = indexId, Name = filename },
|
||||
};
|
||||
item.SetName(release.Name);
|
||||
|
||||
@@ -213,11 +205,7 @@ namespace SabreTools.DatFiles.Formats
|
||||
Description = biosset.Description,
|
||||
Default = biosset.Default?.AsYesNo(),
|
||||
|
||||
Source = new Source
|
||||
{
|
||||
Index = indexId,
|
||||
Name = filename,
|
||||
},
|
||||
Source = new Source { Index = indexId, Name = filename },
|
||||
};
|
||||
item.SetName(biosset.Name);
|
||||
|
||||
@@ -267,11 +255,7 @@ namespace SabreTools.DatFiles.Formats
|
||||
Inverted = rom.Inverted?.AsYesNo(),
|
||||
MIA = rom.MIA?.AsYesNo(),
|
||||
|
||||
Source = new Source
|
||||
{
|
||||
Index = indexId,
|
||||
Name = filename,
|
||||
},
|
||||
Source = new Source { Index = indexId, Name = filename },
|
||||
};
|
||||
item.SetName(rom.Name);
|
||||
|
||||
@@ -306,11 +290,7 @@ namespace SabreTools.DatFiles.Formats
|
||||
ItemStatus = disk.Status?.AsEnumValue<ItemStatus>() ?? ItemStatus.NULL,
|
||||
//Flags = disk.Flags, // TODO: Add to internal model
|
||||
|
||||
Source = new Source
|
||||
{
|
||||
Index = indexId,
|
||||
Name = filename,
|
||||
},
|
||||
Source = new Source { Index = indexId, Name = filename },
|
||||
};
|
||||
item.SetName(disk.Name);
|
||||
|
||||
@@ -344,11 +324,7 @@ namespace SabreTools.DatFiles.Formats
|
||||
SHA256 = medium.SHA256,
|
||||
SpamSum = medium.SpamSum,
|
||||
|
||||
Source = new Source
|
||||
{
|
||||
Index = indexId,
|
||||
Name = filename,
|
||||
},
|
||||
Source = new Source { Index = indexId, Name = filename },
|
||||
};
|
||||
item.SetName(medium.Name);
|
||||
|
||||
@@ -377,11 +353,7 @@ namespace SabreTools.DatFiles.Formats
|
||||
{
|
||||
var item = new Archive
|
||||
{
|
||||
Source = new Source
|
||||
{
|
||||
Index = indexId,
|
||||
Name = filename,
|
||||
},
|
||||
Source = new Source { Index = indexId, Name = filename },
|
||||
};
|
||||
item.SetName(archive.Name);
|
||||
|
||||
@@ -414,11 +386,7 @@ namespace SabreTools.DatFiles.Formats
|
||||
//Flags = chip.Flags, // TODO: Add to internal model
|
||||
Clock = NumberHelper.ConvertToInt64(chip.Clock),
|
||||
|
||||
Source = new Source
|
||||
{
|
||||
Index = indexId,
|
||||
Name = filename,
|
||||
},
|
||||
Source = new Source { Index = indexId, Name = filename },
|
||||
};
|
||||
item.SetName(chip.Name);
|
||||
|
||||
@@ -454,11 +422,7 @@ namespace SabreTools.DatFiles.Formats
|
||||
//AspectY = video.AspectY, // TODO: Add to internal model or find mapping
|
||||
Refresh = NumberHelper.ConvertToDouble(video.Freq),
|
||||
|
||||
Source = new Source
|
||||
{
|
||||
Index = indexId,
|
||||
Name = filename,
|
||||
},
|
||||
Source = new Source { Index = indexId, Name = filename },
|
||||
};
|
||||
|
||||
switch (video.Orientation)
|
||||
@@ -496,11 +460,7 @@ namespace SabreTools.DatFiles.Formats
|
||||
{
|
||||
Channels = NumberHelper.ConvertToInt64(sound.Channels),
|
||||
|
||||
Source = new Source
|
||||
{
|
||||
Index = indexId,
|
||||
Name = filename,
|
||||
},
|
||||
Source = new Source { Index = indexId, Name = filename },
|
||||
};
|
||||
|
||||
item.CopyMachineInformation(machine);
|
||||
@@ -538,11 +498,7 @@ namespace SabreTools.DatFiles.Formats
|
||||
Tilt = input.Tilt?.AsYesNo(),
|
||||
Service = input.Service?.AsYesNo(),
|
||||
|
||||
Source = new Source
|
||||
{
|
||||
Index = indexId,
|
||||
Name = filename,
|
||||
},
|
||||
Source = new Source { Index = indexId, Name = filename },
|
||||
};
|
||||
|
||||
item.CopyMachineInformation(machine);
|
||||
@@ -571,11 +527,7 @@ namespace SabreTools.DatFiles.Formats
|
||||
{
|
||||
Values = [],
|
||||
|
||||
Source = new Source
|
||||
{
|
||||
Index = indexId,
|
||||
Name = filename,
|
||||
},
|
||||
Source = new Source { Index = indexId, Name = filename },
|
||||
};
|
||||
item.SetName(dipswitch.Name);
|
||||
|
||||
@@ -620,11 +572,7 @@ namespace SabreTools.DatFiles.Formats
|
||||
//PaletteSize = driver.PaletteSize, // TODO: Add to internal model or find mapping
|
||||
//Blit = driver.Blit, // TODO: Add to internal model or find mapping
|
||||
|
||||
Source = new Source
|
||||
{
|
||||
Index = indexId,
|
||||
Name = filename,
|
||||
},
|
||||
Source = new Source { Index = indexId, Name = filename },
|
||||
};
|
||||
|
||||
item.CopyMachineInformation(machine);
|
||||
|
||||
@@ -109,11 +109,7 @@ namespace SabreTools.DatFiles.Formats
|
||||
{
|
||||
var blank = new Blank
|
||||
{
|
||||
Source = new Source
|
||||
{
|
||||
Index = indexId,
|
||||
Name = filename,
|
||||
},
|
||||
Source = new Source { Index = indexId, Name = filename },
|
||||
};
|
||||
|
||||
blank.CopyMachineInformation(machine);
|
||||
@@ -145,11 +141,7 @@ namespace SabreTools.DatFiles.Formats
|
||||
CRC = rom.CRC,
|
||||
Date = rom.Date,
|
||||
|
||||
Source = new Source
|
||||
{
|
||||
Index = indexId,
|
||||
Name = filename,
|
||||
},
|
||||
Source = new Source { Index = indexId, Name = filename },
|
||||
};
|
||||
item.SetName(rom.Name);
|
||||
|
||||
|
||||
@@ -107,11 +107,7 @@ namespace SabreTools.DatFiles.Formats
|
||||
SHA256 = row.SHA256,
|
||||
ItemStatus = ItemStatus.None,
|
||||
|
||||
Source = new Source
|
||||
{
|
||||
Index = indexId,
|
||||
Name = filename,
|
||||
},
|
||||
Source = new Source { Index = indexId, Name = filename },
|
||||
};
|
||||
rom.SetName(name);
|
||||
|
||||
|
||||
@@ -149,11 +149,7 @@ namespace SabreTools.DatFiles.Formats
|
||||
Size = null,
|
||||
CRC = sfv.Hash,
|
||||
|
||||
Source = new Source
|
||||
{
|
||||
Index = indexId,
|
||||
Name = filename,
|
||||
},
|
||||
Source = new Source { Index = indexId, Name = filename },
|
||||
};
|
||||
rom.SetName(itemName);
|
||||
|
||||
@@ -200,11 +196,7 @@ namespace SabreTools.DatFiles.Formats
|
||||
{
|
||||
MD5 = md5.Hash,
|
||||
|
||||
Source = new Source
|
||||
{
|
||||
Index = indexId,
|
||||
Name = filename,
|
||||
},
|
||||
Source = new Source { Index = indexId, Name = filename },
|
||||
};
|
||||
disk.SetName(itemName);
|
||||
|
||||
@@ -217,11 +209,7 @@ namespace SabreTools.DatFiles.Formats
|
||||
{
|
||||
MD5 = md5.Hash,
|
||||
|
||||
Source = new Source
|
||||
{
|
||||
Index = indexId,
|
||||
Name = filename,
|
||||
},
|
||||
Source = new Source { Index = indexId, Name = filename },
|
||||
};
|
||||
media.SetName(itemName);
|
||||
|
||||
@@ -235,11 +223,7 @@ namespace SabreTools.DatFiles.Formats
|
||||
Size = null,
|
||||
MD5 = md5.Hash,
|
||||
|
||||
Source = new Source
|
||||
{
|
||||
Index = indexId,
|
||||
Name = filename,
|
||||
},
|
||||
Source = new Source { Index = indexId, Name = filename },
|
||||
};
|
||||
rom.SetName(itemName);
|
||||
|
||||
@@ -286,11 +270,7 @@ namespace SabreTools.DatFiles.Formats
|
||||
{
|
||||
SHA1 = sha1.Hash,
|
||||
|
||||
Source = new Source
|
||||
{
|
||||
Index = indexId,
|
||||
Name = filename,
|
||||
},
|
||||
Source = new Source { Index = indexId, Name = filename },
|
||||
};
|
||||
disk.SetName(itemName);
|
||||
|
||||
@@ -303,11 +283,7 @@ namespace SabreTools.DatFiles.Formats
|
||||
{
|
||||
SHA1 = sha1.Hash,
|
||||
|
||||
Source = new Source
|
||||
{
|
||||
Index = indexId,
|
||||
Name = filename,
|
||||
},
|
||||
Source = new Source { Index = indexId, Name = filename },
|
||||
};
|
||||
media.SetName(itemName);
|
||||
|
||||
@@ -321,11 +297,7 @@ namespace SabreTools.DatFiles.Formats
|
||||
Size = null,
|
||||
SHA1 = sha1.Hash,
|
||||
|
||||
Source = new Source
|
||||
{
|
||||
Index = indexId,
|
||||
Name = filename,
|
||||
},
|
||||
Source = new Source { Index = indexId, Name = filename },
|
||||
};
|
||||
rom.SetName(itemName);
|
||||
|
||||
@@ -372,11 +344,7 @@ namespace SabreTools.DatFiles.Formats
|
||||
{
|
||||
SHA256 = sha256.Hash,
|
||||
|
||||
Source = new Source
|
||||
{
|
||||
Index = indexId,
|
||||
Name = filename,
|
||||
},
|
||||
Source = new Source { Index = indexId, Name = filename },
|
||||
};
|
||||
media.SetName(itemName);
|
||||
|
||||
@@ -391,11 +359,7 @@ namespace SabreTools.DatFiles.Formats
|
||||
Size = null,
|
||||
SHA256 = sha256.Hash,
|
||||
|
||||
Source = new Source
|
||||
{
|
||||
Index = indexId,
|
||||
Name = filename,
|
||||
},
|
||||
Source = new Source { Index = indexId, Name = filename },
|
||||
};
|
||||
rom.SetName(itemName);
|
||||
|
||||
@@ -445,11 +409,7 @@ namespace SabreTools.DatFiles.Formats
|
||||
Size = null,
|
||||
SHA384 = sha384.Hash,
|
||||
|
||||
Source = new Source
|
||||
{
|
||||
Index = indexId,
|
||||
Name = filename,
|
||||
},
|
||||
Source = new Source { Index = indexId, Name = filename },
|
||||
};
|
||||
rom.SetName(itemName);
|
||||
|
||||
@@ -499,11 +459,7 @@ namespace SabreTools.DatFiles.Formats
|
||||
Size = null,
|
||||
SHA512 = sha512.Hash,
|
||||
|
||||
Source = new Source
|
||||
{
|
||||
Index = indexId,
|
||||
Name = filename,
|
||||
},
|
||||
Source = new Source { Index = indexId, Name = filename },
|
||||
};
|
||||
rom.SetName(itemName);
|
||||
|
||||
@@ -550,11 +506,7 @@ namespace SabreTools.DatFiles.Formats
|
||||
{
|
||||
SpamSum = spamsum.Hash,
|
||||
|
||||
Source = new Source
|
||||
{
|
||||
Index = indexId,
|
||||
Name = filename,
|
||||
},
|
||||
Source = new Source { Index = indexId, Name = filename },
|
||||
};
|
||||
media.SetName(itemName);
|
||||
|
||||
@@ -569,11 +521,7 @@ namespace SabreTools.DatFiles.Formats
|
||||
Size = null,
|
||||
SpamSum = spamsum.Hash,
|
||||
|
||||
Source = new Source
|
||||
{
|
||||
Index = indexId,
|
||||
Name = filename,
|
||||
},
|
||||
Source = new Source { Index = indexId, Name = filename },
|
||||
};
|
||||
rom.SetName(itemName);
|
||||
|
||||
|
||||
@@ -118,11 +118,7 @@ namespace SabreTools.DatFiles.Formats
|
||||
{
|
||||
ItemStatus = ItemStatus.None,
|
||||
|
||||
Source = new Source
|
||||
{
|
||||
Index = indexId,
|
||||
Name = filename,
|
||||
},
|
||||
Source = new Source { Index = indexId, Name = filename },
|
||||
};
|
||||
disk.SetName(row.Name);
|
||||
|
||||
@@ -148,11 +144,7 @@ namespace SabreTools.DatFiles.Formats
|
||||
SHA1 = row.SHA1,
|
||||
ItemStatus = ItemStatus.None,
|
||||
|
||||
Source = new Source
|
||||
{
|
||||
Index = indexId,
|
||||
Name = filename,
|
||||
},
|
||||
Source = new Source { Index = indexId, Name = filename },
|
||||
};
|
||||
rom.SetName(row.Name);
|
||||
|
||||
@@ -172,11 +164,7 @@ namespace SabreTools.DatFiles.Formats
|
||||
{
|
||||
ItemStatus = ItemStatus.BadDump,
|
||||
|
||||
Source = new Source
|
||||
{
|
||||
Index = indexId,
|
||||
Name = filename,
|
||||
},
|
||||
Source = new Source { Index = indexId, Name = filename },
|
||||
};
|
||||
disk.SetName(row.Name);
|
||||
|
||||
@@ -200,11 +188,7 @@ namespace SabreTools.DatFiles.Formats
|
||||
SHA1 = null,
|
||||
ItemStatus = ItemStatus.Nodump,
|
||||
|
||||
Source = new Source
|
||||
{
|
||||
Index = indexId,
|
||||
Name = filename,
|
||||
},
|
||||
Source = new Source { Index = indexId, Name = filename },
|
||||
};
|
||||
disk.SetName(row.Name);
|
||||
|
||||
@@ -225,11 +209,7 @@ namespace SabreTools.DatFiles.Formats
|
||||
SHA1 = row.SHA1,
|
||||
ItemStatus = ItemStatus.BadDump,
|
||||
|
||||
Source = new Source
|
||||
{
|
||||
Index = indexId,
|
||||
Name = filename,
|
||||
},
|
||||
Source = new Source { Index = indexId, Name = filename },
|
||||
};
|
||||
rom.SetName(row.Name);
|
||||
|
||||
@@ -249,11 +229,7 @@ namespace SabreTools.DatFiles.Formats
|
||||
SHA1 = null,
|
||||
ItemStatus = ItemStatus.Nodump,
|
||||
|
||||
Source = new Source
|
||||
{
|
||||
Index = indexId,
|
||||
Name = filename,
|
||||
},
|
||||
Source = new Source { Index = indexId, Name = filename },
|
||||
};
|
||||
rom.SetName(row.Name);
|
||||
|
||||
|
||||
@@ -144,11 +144,7 @@ namespace SabreTools.DatFiles.Formats
|
||||
{
|
||||
var blank = new Blank
|
||||
{
|
||||
Source = new Source
|
||||
{
|
||||
Index = indexId,
|
||||
Name = filename,
|
||||
},
|
||||
Source = new Source { Index = indexId, Name = filename },
|
||||
};
|
||||
|
||||
blank.CopyMachineInformation(machine);
|
||||
@@ -179,11 +175,7 @@ namespace SabreTools.DatFiles.Formats
|
||||
Description = biosset.Description,
|
||||
Default = biosset.Default?.AsYesNo(),
|
||||
|
||||
Source = new Source
|
||||
{
|
||||
Index = indexId,
|
||||
Name = filename,
|
||||
},
|
||||
Source = new Source { Index = indexId, Name = filename },
|
||||
};
|
||||
item.SetName(biosset.Name);
|
||||
|
||||
@@ -224,11 +216,7 @@ namespace SabreTools.DatFiles.Formats
|
||||
//Dispose = rom.Dispose.AsYesNo(), // TODO: Add to internal model
|
||||
//SoundOnly = rom.SoundOnly.AsYesNo(), // TODO: Add to internal model
|
||||
|
||||
Source = new Source
|
||||
{
|
||||
Index = indexId,
|
||||
Name = filename,
|
||||
},
|
||||
Source = new Source { Index = indexId, Name = filename },
|
||||
};
|
||||
item.SetName(rom.Name);
|
||||
|
||||
@@ -266,11 +254,7 @@ namespace SabreTools.DatFiles.Formats
|
||||
ItemStatus = disk.Status.AsEnumValue<ItemStatus>(),
|
||||
Optional = disk.Optional.AsYesNo(),
|
||||
|
||||
Source = new Source
|
||||
{
|
||||
Index = indexId,
|
||||
Name = filename,
|
||||
},
|
||||
Source = new Source { Index = indexId, Name = filename },
|
||||
};
|
||||
item.SetName(disk.Name);
|
||||
|
||||
@@ -299,11 +283,7 @@ namespace SabreTools.DatFiles.Formats
|
||||
{
|
||||
var item = new DeviceReference
|
||||
{
|
||||
Source = new Source
|
||||
{
|
||||
Index = indexId,
|
||||
Name = filename,
|
||||
},
|
||||
Source = new Source { Index = indexId, Name = filename },
|
||||
};
|
||||
item.SetName(deviceref.Name);
|
||||
|
||||
@@ -332,11 +312,7 @@ namespace SabreTools.DatFiles.Formats
|
||||
{
|
||||
var item = new Sample
|
||||
{
|
||||
Source = new Source
|
||||
{
|
||||
Index = indexId,
|
||||
Name = filename,
|
||||
},
|
||||
Source = new Source { Index = indexId, Name = filename },
|
||||
};
|
||||
item.SetName(sample.Name);
|
||||
|
||||
@@ -370,11 +346,7 @@ namespace SabreTools.DatFiles.Formats
|
||||
//SoundOnly = chip.SoundOnly, // TODO: Add to internal model
|
||||
Clock = NumberHelper.ConvertToInt64(chip.Clock),
|
||||
|
||||
Source = new Source
|
||||
{
|
||||
Index = indexId,
|
||||
Name = filename,
|
||||
},
|
||||
Source = new Source { Index = indexId, Name = filename },
|
||||
};
|
||||
item.SetName(chip.Name);
|
||||
|
||||
@@ -418,11 +390,7 @@ namespace SabreTools.DatFiles.Formats
|
||||
VBEnd = NumberHelper.ConvertToInt64(display.VBEnd),
|
||||
VBStart = NumberHelper.ConvertToInt64(display.VBStart),
|
||||
|
||||
Source = new Source
|
||||
{
|
||||
Index = indexId,
|
||||
Name = filename,
|
||||
},
|
||||
Source = new Source { Index = indexId, Name = filename },
|
||||
};
|
||||
|
||||
item.CopyMachineInformation(machine);
|
||||
@@ -457,11 +425,7 @@ namespace SabreTools.DatFiles.Formats
|
||||
//AspectY = video.AspectY, // TODO: Add to internal model or find mapping
|
||||
Refresh = NumberHelper.ConvertToDouble(video.Refresh),
|
||||
|
||||
Source = new Source
|
||||
{
|
||||
Index = indexId,
|
||||
Name = filename,
|
||||
},
|
||||
Source = new Source { Index = indexId, Name = filename },
|
||||
};
|
||||
|
||||
switch (video.Orientation)
|
||||
@@ -499,11 +463,7 @@ namespace SabreTools.DatFiles.Formats
|
||||
{
|
||||
Channels = NumberHelper.ConvertToInt64(sound.Channels),
|
||||
|
||||
Source = new Source
|
||||
{
|
||||
Index = indexId,
|
||||
Name = filename,
|
||||
},
|
||||
Source = new Source { Index = indexId, Name = filename },
|
||||
};
|
||||
|
||||
item.CopyMachineInformation(machine);
|
||||
@@ -535,11 +495,7 @@ namespace SabreTools.DatFiles.Formats
|
||||
//Buttons = input.Buttons, // TODO: Add to internal model
|
||||
Coins = NumberHelper.ConvertToInt64(input.Coins),
|
||||
|
||||
Source = new Source
|
||||
{
|
||||
Index = indexId,
|
||||
Name = filename,
|
||||
},
|
||||
Source = new Source { Index = indexId, Name = filename },
|
||||
};
|
||||
|
||||
var controls = new List<Control>();
|
||||
@@ -593,11 +549,7 @@ namespace SabreTools.DatFiles.Formats
|
||||
Tag = dipswitch.Tag,
|
||||
Mask = dipswitch.Mask,
|
||||
|
||||
Source = new Source
|
||||
{
|
||||
Index = indexId,
|
||||
Name = filename,
|
||||
},
|
||||
Source = new Source { Index = indexId, Name = filename },
|
||||
};
|
||||
item.SetName(dipswitch.Name);
|
||||
|
||||
@@ -685,11 +637,7 @@ namespace SabreTools.DatFiles.Formats
|
||||
Tag = configuration.Tag,
|
||||
Mask = configuration.Mask,
|
||||
|
||||
Source = new Source
|
||||
{
|
||||
Index = indexId,
|
||||
Name = filename,
|
||||
},
|
||||
Source = new Source { Index = indexId, Name = filename },
|
||||
};
|
||||
item.SetName(configuration.Name);
|
||||
|
||||
@@ -775,11 +723,7 @@ namespace SabreTools.DatFiles.Formats
|
||||
{
|
||||
Tag = port.Tag,
|
||||
|
||||
Source = new Source
|
||||
{
|
||||
Index = indexId,
|
||||
Name = filename,
|
||||
},
|
||||
Source = new Source { Index = indexId, Name = filename },
|
||||
};
|
||||
|
||||
var analogs = new List<Analog>();
|
||||
@@ -818,17 +762,9 @@ namespace SabreTools.DatFiles.Formats
|
||||
containsItems = true;
|
||||
foreach (var adjuster in adjusters)
|
||||
{
|
||||
var item = new Adjuster
|
||||
{
|
||||
Default = adjuster.Default.AsYesNo(),
|
||||
|
||||
Source = new Source
|
||||
{
|
||||
Index = indexId,
|
||||
Name = filename,
|
||||
},
|
||||
};
|
||||
var item = new Adjuster { Source = new Source { Index = indexId, Name = filename } };
|
||||
item.SetName(adjuster.Name);
|
||||
item.SetFieldValue<bool?>(Models.Metadata.Adjuster.DefaultKey, adjuster.Default.AsYesNo());
|
||||
|
||||
if (adjuster.Condition != null)
|
||||
{
|
||||
@@ -839,7 +775,7 @@ namespace SabreTools.DatFiles.Formats
|
||||
Relation = adjuster.Condition.Relation.AsEnumValue<Relation>(),
|
||||
Value = adjuster.Condition.Value,
|
||||
};
|
||||
item.Conditions = [condition];
|
||||
item.SetFieldValue<Condition[]?>(Models.Metadata.Adjuster.ConditionKey, [condition]);
|
||||
}
|
||||
|
||||
item.CopyMachineInformation(machine);
|
||||
@@ -877,11 +813,7 @@ namespace SabreTools.DatFiles.Formats
|
||||
NoSoundHardware = driver.NoSoundHardware.AsYesNo(),
|
||||
Incomplete = driver.Incomplete.AsYesNo(),
|
||||
|
||||
Source = new Source
|
||||
{
|
||||
Index = indexId,
|
||||
Name = filename,
|
||||
},
|
||||
Source = new Source { Index = indexId, Name = filename },
|
||||
};
|
||||
|
||||
item.CopyMachineInformation(machine);
|
||||
@@ -912,11 +844,7 @@ namespace SabreTools.DatFiles.Formats
|
||||
Status = feature.Status.AsEnumValue<FeatureStatus>(),
|
||||
Overall = feature.Overall.AsEnumValue<FeatureStatus>(),
|
||||
|
||||
Source = new Source
|
||||
{
|
||||
Index = indexId,
|
||||
Name = filename,
|
||||
},
|
||||
Source = new Source { Index = indexId, Name = filename },
|
||||
};
|
||||
|
||||
item.CopyMachineInformation(machine);
|
||||
@@ -950,11 +878,7 @@ namespace SabreTools.DatFiles.Formats
|
||||
Mandatory = NumberHelper.ConvertToInt64(device.Mandatory),
|
||||
Interface = device.Interface,
|
||||
|
||||
Source = new Source
|
||||
{
|
||||
Index = indexId,
|
||||
Name = filename,
|
||||
},
|
||||
Source = new Source { Index = indexId, Name = filename },
|
||||
};
|
||||
|
||||
if (device.Instance != null)
|
||||
@@ -1003,11 +927,7 @@ namespace SabreTools.DatFiles.Formats
|
||||
{
|
||||
var item = new Slot
|
||||
{
|
||||
Source = new Source
|
||||
{
|
||||
Index = indexId,
|
||||
Name = filename,
|
||||
},
|
||||
Source = new Source { Index = indexId, Name = filename },
|
||||
};
|
||||
item.SetName(slot.Name);
|
||||
|
||||
@@ -1055,11 +975,7 @@ namespace SabreTools.DatFiles.Formats
|
||||
Status = softwarelist.Status.AsEnumValue<SoftwareListStatus>(),
|
||||
Filter = softwarelist.Filter,
|
||||
|
||||
Source = new Source
|
||||
{
|
||||
Index = indexId,
|
||||
Name = filename,
|
||||
},
|
||||
Source = new Source { Index = indexId, Name = filename },
|
||||
};
|
||||
item.SetName(softwarelist.Name);
|
||||
|
||||
@@ -1091,11 +1007,7 @@ namespace SabreTools.DatFiles.Formats
|
||||
Default = ramoption.Default.AsYesNo(),
|
||||
Content = ramoption.Content,
|
||||
|
||||
Source = new Source
|
||||
{
|
||||
Index = indexId,
|
||||
Name = filename,
|
||||
},
|
||||
Source = new Source { Index = indexId, Name = filename },
|
||||
};
|
||||
item.SetName(ramoption.Name);
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ using SabreTools.Core;
|
||||
using SabreTools.Core.Tools;
|
||||
using SabreTools.DatItems;
|
||||
using SabreTools.DatItems.Formats;
|
||||
using SabreTools.Serialization.CrossModel;
|
||||
|
||||
namespace SabreTools.DatFiles.Formats
|
||||
{
|
||||
@@ -802,12 +803,12 @@ namespace SabreTools.DatFiles.Formats
|
||||
var adjuster = new Models.Listxml.Adjuster
|
||||
{
|
||||
Name = item.GetName(),
|
||||
Default = item.Default.FromYesNo(),
|
||||
Default = item.GetFieldValue<bool?>(Models.Metadata.Adjuster.DefaultKey).FromYesNo(),
|
||||
};
|
||||
|
||||
if (item.ConditionsSpecified)
|
||||
{
|
||||
var conditionItem = item.Conditions?.FirstOrDefault();
|
||||
var conditionItem = item.GetFieldValue<Condition[]?>(Models.Metadata.Adjuster.ConditionKey)?.FirstOrDefault();
|
||||
var condition = new Models.Listxml.Condition
|
||||
{
|
||||
Tag = conditionItem?.Tag,
|
||||
|
||||
@@ -288,11 +288,7 @@ namespace SabreTools.DatFiles.Formats
|
||||
{
|
||||
var blank = new Blank
|
||||
{
|
||||
Source = new Source
|
||||
{
|
||||
Index = indexId,
|
||||
Name = filename,
|
||||
},
|
||||
Source = new Source { Index = indexId, Name = filename },
|
||||
};
|
||||
|
||||
blank.CopyMachineInformation(machine);
|
||||
@@ -325,11 +321,7 @@ namespace SabreTools.DatFiles.Formats
|
||||
Date = release.Date,
|
||||
Default = release.Default?.AsYesNo(),
|
||||
|
||||
Source = new Source
|
||||
{
|
||||
Index = indexId,
|
||||
Name = filename,
|
||||
},
|
||||
Source = new Source { Index = indexId, Name = filename },
|
||||
};
|
||||
item.SetName(release.Name);
|
||||
|
||||
@@ -361,11 +353,7 @@ namespace SabreTools.DatFiles.Formats
|
||||
Description = biosset.Description,
|
||||
Default = biosset.Default?.AsYesNo(),
|
||||
|
||||
Source = new Source
|
||||
{
|
||||
Index = indexId,
|
||||
Name = filename,
|
||||
},
|
||||
Source = new Source { Index = indexId, Name = filename },
|
||||
};
|
||||
item.SetName(biosset.Name);
|
||||
|
||||
@@ -412,11 +400,7 @@ namespace SabreTools.DatFiles.Formats
|
||||
Inverted = rom.Inverted?.AsYesNo(),
|
||||
MIA = rom.MIA?.AsYesNo(),
|
||||
|
||||
Source = new Source
|
||||
{
|
||||
Index = indexId,
|
||||
Name = filename,
|
||||
},
|
||||
Source = new Source { Index = indexId, Name = filename },
|
||||
};
|
||||
item.SetName(rom.Name);
|
||||
|
||||
@@ -450,11 +434,7 @@ namespace SabreTools.DatFiles.Formats
|
||||
MergeTag = disk.Merge,
|
||||
ItemStatus = disk.Status?.AsEnumValue<ItemStatus>() ?? ItemStatus.NULL,
|
||||
|
||||
Source = new Source
|
||||
{
|
||||
Index = indexId,
|
||||
Name = filename,
|
||||
},
|
||||
Source = new Source { Index = indexId, Name = filename },
|
||||
};
|
||||
item.SetName(disk.Name);
|
||||
|
||||
@@ -488,11 +468,7 @@ namespace SabreTools.DatFiles.Formats
|
||||
SHA256 = medium.SHA256,
|
||||
SpamSum = medium.SpamSum,
|
||||
|
||||
Source = new Source
|
||||
{
|
||||
Index = indexId,
|
||||
Name = filename,
|
||||
},
|
||||
Source = new Source { Index = indexId, Name = filename },
|
||||
};
|
||||
item.SetName(medium.Name);
|
||||
|
||||
@@ -521,11 +497,7 @@ namespace SabreTools.DatFiles.Formats
|
||||
{
|
||||
var item = new DeviceReference
|
||||
{
|
||||
Source = new Source
|
||||
{
|
||||
Index = indexId,
|
||||
Name = filename,
|
||||
},
|
||||
Source = new Source { Index = indexId, Name = filename },
|
||||
};
|
||||
item.SetName(deviceref.Name);
|
||||
|
||||
@@ -554,11 +526,7 @@ namespace SabreTools.DatFiles.Formats
|
||||
{
|
||||
var item = new Sample
|
||||
{
|
||||
Source = new Source
|
||||
{
|
||||
Index = indexId,
|
||||
Name = filename,
|
||||
},
|
||||
Source = new Source { Index = indexId, Name = filename },
|
||||
};
|
||||
item.SetName(sample.Name);
|
||||
|
||||
@@ -587,11 +555,7 @@ namespace SabreTools.DatFiles.Formats
|
||||
{
|
||||
var item = new Archive
|
||||
{
|
||||
Source = new Source
|
||||
{
|
||||
Index = indexId,
|
||||
Name = filename,
|
||||
},
|
||||
Source = new Source { Index = indexId, Name = filename },
|
||||
};
|
||||
item.SetName(archive.Name);
|
||||
|
||||
@@ -627,11 +591,7 @@ namespace SabreTools.DatFiles.Formats
|
||||
NoSoundHardware = driver.NoSoundHardware?.AsYesNo(),
|
||||
Incomplete = driver.Incomplete?.AsYesNo(),
|
||||
|
||||
Source = new Source
|
||||
{
|
||||
Index = indexId,
|
||||
Name = filename,
|
||||
},
|
||||
Source = new Source { Index = indexId, Name = filename },
|
||||
};
|
||||
|
||||
item.CopyMachineInformation(machine);
|
||||
@@ -662,11 +622,7 @@ namespace SabreTools.DatFiles.Formats
|
||||
Status = softwarelist.Status?.AsEnumValue<SoftwareListStatus>() ?? SoftwareListStatus.None,
|
||||
Filter = softwarelist.Filter,
|
||||
|
||||
Source = new Source
|
||||
{
|
||||
Index = indexId,
|
||||
Name = filename,
|
||||
},
|
||||
Source = new Source { Index = indexId, Name = filename },
|
||||
};
|
||||
item.SetName(softwarelist.Name);
|
||||
|
||||
|
||||
@@ -331,11 +331,7 @@ namespace SabreTools.DatFiles.Formats
|
||||
{
|
||||
var blank = new Blank
|
||||
{
|
||||
Source = new Source
|
||||
{
|
||||
Index = indexId,
|
||||
Name = filename,
|
||||
},
|
||||
Source = new Source { Index = indexId, Name = filename },
|
||||
};
|
||||
|
||||
blank.CopyMachineInformation(machine);
|
||||
@@ -374,11 +370,7 @@ namespace SabreTools.DatFiles.Formats
|
||||
CRC = crc.Content,
|
||||
ItemStatus = ItemStatus.None,
|
||||
|
||||
Source = new Source
|
||||
{
|
||||
Index = indexId,
|
||||
Name = filename,
|
||||
},
|
||||
Source = new Source { Index = indexId, Name = filename },
|
||||
};
|
||||
item.SetName(name);
|
||||
|
||||
|
||||
@@ -103,11 +103,7 @@ namespace SabreTools.DatFiles.Formats
|
||||
{
|
||||
var blank = new Blank
|
||||
{
|
||||
Source = new Source
|
||||
{
|
||||
Index = indexId,
|
||||
Name = filename,
|
||||
},
|
||||
Source = new Source { Index = indexId, Name = filename },
|
||||
};
|
||||
|
||||
blank.CopyMachineInformation(machine);
|
||||
@@ -148,11 +144,7 @@ namespace SabreTools.DatFiles.Formats
|
||||
SHA1 = rom.Hash,
|
||||
Remark = rom.Remark,
|
||||
|
||||
Source = new Source
|
||||
{
|
||||
Index = indexId,
|
||||
Name = filename,
|
||||
},
|
||||
Source = new Source { Index = indexId, Name = filename },
|
||||
};
|
||||
item.SetName(name);
|
||||
|
||||
|
||||
@@ -123,11 +123,7 @@ namespace SabreTools.DatFiles.Formats
|
||||
RomOf = rom.RomOf,
|
||||
},
|
||||
|
||||
Source = new Source
|
||||
{
|
||||
Index = indexId,
|
||||
Name = filename,
|
||||
},
|
||||
Source = new Source { Index = indexId, Name = filename },
|
||||
};
|
||||
item.SetName(rom.RomName);
|
||||
|
||||
|
||||
@@ -88,11 +88,7 @@ namespace SabreTools.DatFiles.Formats
|
||||
SHA1 = row.SHA1,
|
||||
ItemStatus = row.Status.AsEnumValue<ItemStatus>(),
|
||||
|
||||
Source = new Source
|
||||
{
|
||||
Index = indexId,
|
||||
Name = filename,
|
||||
},
|
||||
Source = new Source { Index = indexId, Name = filename },
|
||||
};
|
||||
item.SetName(row.DiskName);
|
||||
break;
|
||||
@@ -105,11 +101,7 @@ namespace SabreTools.DatFiles.Formats
|
||||
SHA256 = row.SHA256,
|
||||
SpamSum = row.SpamSum,
|
||||
|
||||
Source = new Source
|
||||
{
|
||||
Index = indexId,
|
||||
Name = filename,
|
||||
},
|
||||
Source = new Source { Index = indexId, Name = filename },
|
||||
};
|
||||
item.SetName(row.DiskName);
|
||||
break;
|
||||
@@ -126,11 +118,7 @@ namespace SabreTools.DatFiles.Formats
|
||||
SpamSum = row.SpamSum,
|
||||
ItemStatus = row.Status.AsEnumValue<ItemStatus>(),
|
||||
|
||||
Source = new Source
|
||||
{
|
||||
Index = indexId,
|
||||
Name = filename,
|
||||
},
|
||||
Source = new Source { Index = indexId, Name = filename },
|
||||
};
|
||||
item.SetName(row.RomName);
|
||||
break;
|
||||
|
||||
@@ -108,11 +108,7 @@ namespace SabreTools.DatFiles.Formats
|
||||
{
|
||||
Value = info.Value,
|
||||
|
||||
Source = new Source
|
||||
{
|
||||
Index = indexId,
|
||||
Name = filename,
|
||||
},
|
||||
Source = new Source { Index = indexId, Name = filename },
|
||||
};
|
||||
infoItem.SetName(info.Name);
|
||||
|
||||
@@ -127,11 +123,7 @@ namespace SabreTools.DatFiles.Formats
|
||||
{
|
||||
Value = sharedfeat.Value,
|
||||
|
||||
Source = new Source
|
||||
{
|
||||
Index = indexId,
|
||||
Name = filename,
|
||||
},
|
||||
Source = new Source { Index = indexId, Name = filename },
|
||||
};
|
||||
sharedfeatItem.SetName(sharedfeat.Name);
|
||||
|
||||
@@ -150,11 +142,7 @@ namespace SabreTools.DatFiles.Formats
|
||||
{
|
||||
var blank = new Blank
|
||||
{
|
||||
Source = new Source
|
||||
{
|
||||
Index = indexId,
|
||||
Name = filename,
|
||||
},
|
||||
Source = new Source { Index = indexId, Name = filename },
|
||||
};
|
||||
|
||||
blank.CopyMachineInformation(machine);
|
||||
@@ -184,11 +172,7 @@ namespace SabreTools.DatFiles.Formats
|
||||
Interface = part.Interface,
|
||||
Features = CreateFeatures(part.Feature, machine, filename, indexId, statsOnly),
|
||||
|
||||
Source = new Source
|
||||
{
|
||||
Index = indexId,
|
||||
Name = filename,
|
||||
},
|
||||
Source = new Source { Index = indexId, Name = filename },
|
||||
};
|
||||
item.SetName(part.Name);
|
||||
|
||||
@@ -221,11 +205,7 @@ namespace SabreTools.DatFiles.Formats
|
||||
{
|
||||
Value = feature.Value,
|
||||
|
||||
Source = new Source
|
||||
{
|
||||
Index = indexId,
|
||||
Name = filename,
|
||||
},
|
||||
Source = new Source { Index = indexId, Name = filename },
|
||||
};
|
||||
item.SetName(feature.Name);
|
||||
|
||||
@@ -260,11 +240,7 @@ namespace SabreTools.DatFiles.Formats
|
||||
Width = NumberHelper.ConvertToInt64(dataarea.Width),
|
||||
Endianness = dataarea.Endianness.AsEnumValue<Endianness>(),
|
||||
|
||||
Source = new Source
|
||||
{
|
||||
Index = indexId,
|
||||
Name = filename,
|
||||
},
|
||||
Source = new Source { Index = indexId, Name = filename },
|
||||
};
|
||||
item.SetName(dataarea.Name);
|
||||
|
||||
@@ -306,11 +282,7 @@ namespace SabreTools.DatFiles.Formats
|
||||
Part = part,
|
||||
DataArea = dataarea,
|
||||
|
||||
Source = new Source
|
||||
{
|
||||
Index = indexId,
|
||||
Name = filename,
|
||||
},
|
||||
Source = new Source { Index = indexId, Name = filename },
|
||||
};
|
||||
item.SetName(rom.Name);
|
||||
|
||||
@@ -339,11 +311,7 @@ namespace SabreTools.DatFiles.Formats
|
||||
{
|
||||
var item = new DiskArea
|
||||
{
|
||||
Source = new Source
|
||||
{
|
||||
Index = indexId,
|
||||
Name = filename,
|
||||
},
|
||||
Source = new Source { Index = indexId, Name = filename },
|
||||
};
|
||||
item.SetName(diskarea.Name);
|
||||
|
||||
@@ -382,11 +350,7 @@ namespace SabreTools.DatFiles.Formats
|
||||
Part = part,
|
||||
DiskArea = diskarea,
|
||||
|
||||
Source = new Source
|
||||
{
|
||||
Index = indexId,
|
||||
Name = filename,
|
||||
},
|
||||
Source = new Source { Index = indexId, Name = filename },
|
||||
};
|
||||
item.SetName(disk.Name);
|
||||
|
||||
@@ -421,11 +385,7 @@ namespace SabreTools.DatFiles.Formats
|
||||
|
||||
Part = part,
|
||||
|
||||
Source = new Source
|
||||
{
|
||||
Index = indexId,
|
||||
Name = filename,
|
||||
},
|
||||
Source = new Source { Index = indexId, Name = filename },
|
||||
};
|
||||
item.SetName(dipswitch.Name);
|
||||
|
||||
@@ -455,11 +415,7 @@ namespace SabreTools.DatFiles.Formats
|
||||
Value = dipvalue.Value,
|
||||
Default = dipvalue.Default.AsYesNo(),
|
||||
|
||||
Source = new Source
|
||||
{
|
||||
Index = indexId,
|
||||
Name = filename,
|
||||
},
|
||||
Source = new Source { Index = indexId, Name = filename },
|
||||
};
|
||||
item.SetName(dipvalue.Name);
|
||||
|
||||
|
||||
@@ -248,7 +248,7 @@ namespace SabreTools.DatFiles
|
||||
// Field.DatItem_Conditions does not apply here
|
||||
if (adjuster.ConditionsSpecified)
|
||||
{
|
||||
foreach (Condition subCondition in adjuster.Conditions!)
|
||||
foreach (Condition subCondition in adjuster.GetFieldValue<Condition[]?>(Models.Metadata.Adjuster.ConditionKey)!)
|
||||
{
|
||||
SetFields(subCondition);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user