Fix issues found during testing

This commit is contained in:
Matt Nadareski
2023-08-15 01:38:01 -04:00
parent 3d99cf828f
commit ede4487cf0
56 changed files with 203 additions and 116 deletions

View File

@@ -121,23 +121,23 @@ namespace SabreTools.DatFiles.Formats
{
var row = new Models.AttractMode.Row
{
Name = rom.Machine?.Name,
Title = rom.Machine?.Description,
Name = rom.Machine.Name,
Title = rom.Machine.Description,
Emulator = Header.FileName,
CloneOf = rom.Machine?.CloneOf,
Year = rom.Machine?.Year,
Manufacturer = rom.Machine?.Manufacturer,
Category = rom.Machine?.Category,
Players = rom.Machine?.Players,
Rotation = rom.Machine?.Rotation,
Control = rom.Machine?.Control,
Status = rom.Machine?.Status,
DisplayCount = rom.Machine?.DisplayCount,
DisplayType = rom.Machine?.DisplayType,
CloneOf = rom.Machine.CloneOf,
Year = rom.Machine.Year,
Manufacturer = rom.Machine.Manufacturer,
Category = rom.Machine.Category,
Players = rom.Machine.Players,
Rotation = rom.Machine.Rotation,
Control = rom.Machine.Control,
Status = rom.Machine.Status,
DisplayCount = rom.Machine.DisplayCount,
DisplayType = rom.Machine.DisplayType,
AltRomname = rom.AltName,
AltTitle = rom.AltTitle,
Extra = rom.Machine?.Comment,
Buttons = rom.Machine?.Buttons,
Extra = rom.Machine.Comment,
Buttons = rom.Machine.Buttons,
// TODO: Add extended fields
};
return row;

View File

@@ -139,7 +139,7 @@ namespace SabreTools.DatFiles.Formats
var row = new Models.EverdriveSMDB.Row
{
SHA256 = rom.SHA256,
Name = $"{rom.Machine?.Name ?? string.Empty}/{rom.Name}",
Name = $"{rom.Machine.Name ?? string.Empty}/{rom.Name}",
SHA1 = rom.SHA1,
MD5 = rom.MD5,
CRC32 = rom.CRC,

View File

@@ -63,7 +63,7 @@ namespace SabreTools.DatFiles.Formats
WriteDatItem(sw, datItem, lastgame);
// Set the new data to compare against
lastgame = datItem.Machine?.Name;
lastgame = datItem.Machine.Name;
}
}
@@ -94,8 +94,8 @@ namespace SabreTools.DatFiles.Formats
// Romba mode automatically uses item name
if (Header.OutputDepot?.IsActive == true || Header.UseRomName)
sw.Write($"{datItem.GetName() ?? string.Empty}\n");
else if (!Header.UseRomName && datItem.Machine?.Name != lastgame)
sw.Write($"{datItem.Machine?.Name ?? string.Empty}\n");
else if (!Header.UseRomName && datItem.Machine.Name != lastgame)
sw.Write($"{datItem.Machine.Name ?? string.Empty}\n");
sw.Flush();
}

View File

@@ -183,14 +183,14 @@ namespace SabreTools.DatFiles.Formats
{
var rom = new Models.RomCenter.Rom
{
ParentName = item.Machine?.CloneOf,
//ParentDescription = item.Machine?.CloneOfDescription, // TODO: Add to internal model or find mapping
GameName = item.Machine?.Name,
GameDescription = item.Machine?.Description,
ParentName = item.Machine.CloneOf,
//ParentDescription = item.Machine.CloneOfDescription, // TODO: Add to internal model or find mapping
GameName = item.Machine.Name,
GameDescription = item.Machine.Description,
RomName = item.Name,
RomCRC = item.CRC,
RomSize = item.Size?.ToString(),
RomOf = item.Machine?.RomOf,
RomOf = item.Machine.RomOf,
MergeName = item.MergeTag,
};
return rom;

View File

@@ -395,11 +395,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.Name?.ToLowerInvariant())
WriteEndGame(jtw);
// 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.Name?.ToLowerInvariant())
WriteStartGame(jtw, datItem);
// Check for a "null" item
@@ -410,7 +410,7 @@ namespace SabreTools.DatFiles.Formats
WriteDatItem(jtw, datItem);
// Set the new data to compare against
lastgame = datItem.Machine?.Name;
lastgame = datItem.Machine.Name;
}
}
@@ -457,7 +457,7 @@ namespace SabreTools.DatFiles.Formats
private void WriteStartGame(JsonTextWriter jtw, DatItem datItem)
{
// No game should start with a path separator
if (!string.IsNullOrWhiteSpace(datItem.Machine?.Name))
if (!string.IsNullOrWhiteSpace(datItem.Machine.Name))
datItem.Machine.Name = datItem.Machine.Name.TrimStart(Path.DirectorySeparatorChar) ?? string.Empty;
// Build the state

View File

@@ -223,11 +223,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.Name?.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.Name?.ToLowerInvariant())
WriteStartGame(xtw, datItem);
// Check for a "null" item
@@ -238,7 +238,7 @@ namespace SabreTools.DatFiles.Formats
WriteDatItem(xtw, datItem);
// Set the new data to compare against
lastgame = datItem.Machine?.Name;
lastgame = datItem.Machine.Name;
}
}

View File

@@ -162,8 +162,8 @@ namespace SabreTools.DatFiles.Formats
FileName = Header.FileName,
InternalName = Header.Name,
Description = Header.Description,
GameName = disk.Machine?.Name,
GameDescription = disk.Machine?.Description,
GameName = disk.Machine.Name,
GameDescription = disk.Machine.Description,
Type = disk.ItemType.FromItemType(),
RomName = string.Empty,
DiskName = disk.Name,
@@ -190,8 +190,8 @@ namespace SabreTools.DatFiles.Formats
FileName = Header.FileName,
InternalName = Header.Name,
Description = Header.Description,
GameName = media.Machine?.Name,
GameDescription = media.Machine?.Description,
GameName = media.Machine.Name,
GameDescription = media.Machine.Description,
Type = media.ItemType.FromItemType(),
RomName = string.Empty,
DiskName = media.Name,
@@ -218,8 +218,8 @@ namespace SabreTools.DatFiles.Formats
FileName = Header.FileName,
InternalName = Header.Name,
Description = Header.Description,
GameName = rom.Machine?.Name,
GameDescription = rom.Machine?.Description,
GameName = rom.Machine.Name,
GameDescription = rom.Machine.Description,
Type = rom.ItemType.FromItemType(),
RomName = rom.Name,
DiskName = string.Empty,