mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
Add setters and getters for Machine
This commit is contained in:
@@ -227,11 +227,11 @@ namespace SabreTools.DatFiles.Formats
|
||||
DatItem datItem = datItems[index];
|
||||
|
||||
// If we have a different game and we're not at the start of the list, output the end of last item
|
||||
if (lastgame != null && lastgame.ToLowerInvariant() != datItem.Machine.Name?.ToLowerInvariant())
|
||||
if (lastgame != null && lastgame.ToLowerInvariant() != datItem.Machine.GetFieldValue<string?>(Models.Metadata.Machine.NameKey)?.ToLowerInvariant())
|
||||
WriteEndGame(xtw);
|
||||
|
||||
// If we have a new game, output the beginning of the new item
|
||||
if (lastgame == null || lastgame.ToLowerInvariant() != datItem.Machine.Name?.ToLowerInvariant())
|
||||
if (lastgame == null || lastgame.ToLowerInvariant() != datItem.Machine.GetFieldValue<string?>(Models.Metadata.Machine.NameKey)?.ToLowerInvariant())
|
||||
WriteStartGame(xtw, datItem);
|
||||
|
||||
// Check for a "null" item
|
||||
@@ -242,7 +242,7 @@ namespace SabreTools.DatFiles.Formats
|
||||
WriteDatItem(xtw, datItem);
|
||||
|
||||
// Set the new data to compare against
|
||||
lastgame = datItem.Machine.Name;
|
||||
lastgame = datItem.Machine.GetFieldValue<string?>(Models.Metadata.Machine.NameKey);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -292,7 +292,7 @@ namespace SabreTools.DatFiles.Formats
|
||||
private static void WriteStartGame(XmlTextWriter xtw, DatItem datItem)
|
||||
{
|
||||
// No game should start with a path separator
|
||||
datItem.Machine!.Name = datItem.Machine.Name?.TrimStart(Path.DirectorySeparatorChar) ?? string.Empty;
|
||||
datItem.Machine!.SetFieldValue<string?>(Models.Metadata.Machine.NameKey, datItem.Machine.GetFieldValue<string?>(Models.Metadata.Machine.NameKey)?.TrimStart(Path.DirectorySeparatorChar) ?? string.Empty);
|
||||
|
||||
// Write the machine
|
||||
xtw.WriteStartElement("directory");
|
||||
|
||||
Reference in New Issue
Block a user