mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
Fix JSON read/write, XML write
This commit is contained in:
@@ -721,19 +721,19 @@ namespace SabreTools.Library.DatFiles
|
||||
cmpw.WriteStartElement("disk");
|
||||
cmpw.WriteAttributeString("name", disk.Name);
|
||||
if (!string.IsNullOrWhiteSpace(disk.MD5))
|
||||
cmpw.WriteAttributeString("md5", disk.MD5.ToLowerInvariant());
|
||||
cmpw.WriteAttributeString("md5", disk.MD5?.ToLowerInvariant());
|
||||
#if NET_FRAMEWORK
|
||||
if (!string.IsNullOrWhiteSpace(disk.RIPEMD160))
|
||||
cmpw.WriteAttributeString("ripemd160", disk.RIPEMD160.ToLowerInvariant());
|
||||
cmpw.WriteAttributeString("ripemd160", disk.RIPEMD160?.ToLowerInvariant());
|
||||
#endif
|
||||
if (!string.IsNullOrWhiteSpace(disk.SHA1))
|
||||
cmpw.WriteAttributeString("sha1", disk.SHA1.ToLowerInvariant());
|
||||
cmpw.WriteAttributeString("sha1", disk.SHA1?.ToLowerInvariant());
|
||||
if (!string.IsNullOrWhiteSpace(disk.SHA256))
|
||||
cmpw.WriteAttributeString("sha256", disk.SHA256.ToLowerInvariant());
|
||||
cmpw.WriteAttributeString("sha256", disk.SHA256?.ToLowerInvariant());
|
||||
if (!string.IsNullOrWhiteSpace(disk.SHA384))
|
||||
cmpw.WriteAttributeString("sha384", disk.SHA384.ToLowerInvariant());
|
||||
cmpw.WriteAttributeString("sha384", disk.SHA384?.ToLowerInvariant());
|
||||
if (!string.IsNullOrWhiteSpace(disk.SHA512))
|
||||
cmpw.WriteAttributeString("sha512", disk.SHA512.ToLowerInvariant());
|
||||
cmpw.WriteAttributeString("sha512", disk.SHA512?.ToLowerInvariant());
|
||||
if (disk.ItemStatus != ItemStatus.None)
|
||||
cmpw.WriteAttributeString("flags", disk.ItemStatus.ToString().ToLowerInvariant());
|
||||
cmpw.WriteEndElement();
|
||||
@@ -761,21 +761,21 @@ namespace SabreTools.Library.DatFiles
|
||||
if (rom.Size != -1)
|
||||
cmpw.WriteAttributeString("size", rom.Size.ToString());
|
||||
if (!string.IsNullOrWhiteSpace(rom.CRC))
|
||||
cmpw.WriteAttributeString("crc", rom.CRC.ToLowerInvariant());
|
||||
cmpw.WriteAttributeString("crc", rom.CRC?.ToLowerInvariant());
|
||||
if (!string.IsNullOrWhiteSpace(rom.MD5))
|
||||
cmpw.WriteAttributeString("md5", rom.MD5.ToLowerInvariant());
|
||||
cmpw.WriteAttributeString("md5", rom.MD5?.ToLowerInvariant());
|
||||
#if NET_FRAMEWORK
|
||||
if (!string.IsNullOrWhiteSpace(rom.RIPEMD160))
|
||||
cmpw.WriteAttributeString("ripemd160", rom.RIPEMD160.ToLowerInvariant());
|
||||
cmpw.WriteAttributeString("ripemd160", rom.RIPEMD160?.ToLowerInvariant());
|
||||
#endif
|
||||
if (!string.IsNullOrWhiteSpace(rom.SHA1))
|
||||
cmpw.WriteAttributeString("sha1", rom.SHA1.ToLowerInvariant());
|
||||
cmpw.WriteAttributeString("sha1", rom.SHA1?.ToLowerInvariant());
|
||||
if (!string.IsNullOrWhiteSpace(rom.SHA256))
|
||||
cmpw.WriteAttributeString("sha256", rom.SHA256.ToLowerInvariant());
|
||||
cmpw.WriteAttributeString("sha256", rom.SHA256?.ToLowerInvariant());
|
||||
if (!string.IsNullOrWhiteSpace(rom.SHA384))
|
||||
cmpw.WriteAttributeString("sha384", rom.SHA384.ToLowerInvariant());
|
||||
cmpw.WriteAttributeString("sha384", rom.SHA384?.ToLowerInvariant());
|
||||
if (!string.IsNullOrWhiteSpace(rom.SHA512))
|
||||
cmpw.WriteAttributeString("sha512", rom.SHA512.ToLowerInvariant());
|
||||
cmpw.WriteAttributeString("sha512", rom.SHA512?.ToLowerInvariant());
|
||||
if (!string.IsNullOrWhiteSpace(rom.Date))
|
||||
cmpw.WriteAttributeString("date", rom.Date);
|
||||
if (rom.ItemStatus != ItemStatus.None)
|
||||
|
||||
@@ -2166,7 +2166,7 @@ namespace SabreTools.Library.DatFiles
|
||||
});
|
||||
|
||||
// Now find all folders that are empty, if we are supposed to
|
||||
if (!Header.OutputDepot.IsActive && addBlanks)
|
||||
if (!(Header.OutputDepot?.IsActive ?? false) && addBlanks)
|
||||
{
|
||||
List<string> empties = DirectoryExtensions.ListEmpty(basePath);
|
||||
Parallel.ForEach(empties, Globals.ParallelOptions, dir =>
|
||||
@@ -2245,7 +2245,7 @@ namespace SabreTools.Library.DatFiles
|
||||
bool copyFiles)
|
||||
{
|
||||
// Special case for if we are in Depot mode (all names are supposed to be SHA-1 hashes)
|
||||
if (Header.OutputDepot.IsActive)
|
||||
if (Header.OutputDepot?.IsActive ?? false)
|
||||
{
|
||||
GZipArchive gzarc = new GZipArchive(item);
|
||||
BaseFile baseFile = gzarc.GetTorrentGZFileInfo();
|
||||
@@ -3841,7 +3841,7 @@ namespace SabreTools.Library.DatFiles
|
||||
string post = CreatePrefixPostfix(item, false);
|
||||
|
||||
// If we're in Depot mode, take care of that instead
|
||||
if (Header.OutputDepot.IsActive)
|
||||
if (Header.OutputDepot?.IsActive ?? false)
|
||||
{
|
||||
if (item.ItemType == ItemType.Rom)
|
||||
{
|
||||
@@ -3928,27 +3928,27 @@ namespace SabreTools.Library.DatFiles
|
||||
// Ensure we have the proper values for replacement
|
||||
if (item.ItemType == ItemType.Rom)
|
||||
{
|
||||
crc = ((Rom)item).CRC;
|
||||
md5 = ((Rom)item).MD5;
|
||||
crc = ((Rom)item).CRC ?? string.Empty;
|
||||
md5 = ((Rom)item).MD5 ?? string.Empty;
|
||||
#if NET_FRAMEWORK
|
||||
ripemd160 = ((Rom)item).RIPEMD160;
|
||||
ripemd160 = ((Rom)item).RIPEMD160 ?? string.Empty;
|
||||
#endif
|
||||
sha1 = ((Rom)item).SHA1;
|
||||
sha256 = ((Rom)item).SHA256;
|
||||
sha384 = ((Rom)item).SHA384;
|
||||
sha512 = ((Rom)item).SHA512;
|
||||
sha1 = ((Rom)item).SHA1 ?? string.Empty;
|
||||
sha256 = ((Rom)item).SHA256 ?? string.Empty;
|
||||
sha384 = ((Rom)item).SHA384 ?? string.Empty;
|
||||
sha512 = ((Rom)item).SHA512 ?? string.Empty;
|
||||
size = ((Rom)item).Size.ToString();
|
||||
}
|
||||
else if (item.ItemType == ItemType.Disk)
|
||||
{
|
||||
md5 = ((Disk)item).MD5;
|
||||
md5 = ((Disk)item).MD5 ?? string.Empty;
|
||||
#if NET_FRAMEWORK
|
||||
ripemd160 = ((Disk)item).RIPEMD160;
|
||||
ripemd160 = ((Disk)item).RIPEMD160 ?? string.Empty;
|
||||
#endif
|
||||
sha1 = ((Disk)item).SHA1;
|
||||
sha256 = ((Disk)item).SHA256;
|
||||
sha384 = ((Disk)item).SHA384;
|
||||
sha512 = ((Disk)item).SHA512;
|
||||
sha1 = ((Disk)item).SHA1 ?? string.Empty;
|
||||
sha256 = ((Disk)item).SHA256 ?? string.Empty;
|
||||
sha384 = ((Disk)item).SHA384 ?? string.Empty;
|
||||
sha512 = ((Disk)item).SHA512 ?? string.Empty;
|
||||
}
|
||||
|
||||
// Now do bulk replacement where possible
|
||||
@@ -3956,9 +3956,9 @@ namespace SabreTools.Library.DatFiles
|
||||
.Replace("%game%", game)
|
||||
.Replace("%machine%", game)
|
||||
.Replace("%name%", name)
|
||||
.Replace("%manufacturer%", item.Machine.Manufacturer)
|
||||
.Replace("%publisher%", item.Machine.Publisher)
|
||||
.Replace("%category%", item.Machine.Category)
|
||||
.Replace("%manufacturer%", item.Machine.Manufacturer ?? string.Empty)
|
||||
.Replace("%publisher%", item.Machine.Publisher ?? string.Empty)
|
||||
.Replace("%category%", item.Machine.Category ?? string.Empty)
|
||||
.Replace("%crc%", crc)
|
||||
.Replace("%md5%", md5)
|
||||
.Replace("%ripemd160%", ripemd160)
|
||||
|
||||
@@ -21,106 +21,103 @@ namespace SabreTools.Library.DatFiles
|
||||
/// <summary>
|
||||
/// External name of the DAT
|
||||
/// </summary>
|
||||
[JsonProperty("filename")]
|
||||
[JsonProperty("filename", DefaultValueHandling = DefaultValueHandling.Include)]
|
||||
public string FileName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Internal name of the DAT
|
||||
/// </summary>
|
||||
[JsonProperty("name")]
|
||||
[JsonProperty("name", DefaultValueHandling = DefaultValueHandling.Include)]
|
||||
public string Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// DAT description
|
||||
/// </summary>
|
||||
[JsonProperty("description")]
|
||||
[JsonProperty("description", DefaultValueHandling = DefaultValueHandling.Include)]
|
||||
public string Description { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Root directory for the files; currently TruRip/EmuARC-exclusive
|
||||
/// </summary>
|
||||
[JsonProperty("rootdir")]
|
||||
[JsonProperty("rootdir", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public string RootDir { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// General category of items found in the DAT
|
||||
/// </summary>
|
||||
[JsonProperty("category")]
|
||||
[JsonProperty("category", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public string Category { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Version of the DAT
|
||||
/// </summary>
|
||||
[JsonProperty("version")]
|
||||
[JsonProperty("version", DefaultValueHandling = DefaultValueHandling.Include)]
|
||||
public string Version { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Creation or modification date
|
||||
/// </summary>
|
||||
[JsonProperty("date")]
|
||||
[JsonProperty("date", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public string Date { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// List of authors who contributed to the DAT
|
||||
/// </summary>
|
||||
[JsonProperty("author")]
|
||||
[JsonProperty("author", DefaultValueHandling = DefaultValueHandling.Include)]
|
||||
public string Author { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Email address for DAT author(s)
|
||||
/// </summary>
|
||||
[JsonProperty("email")]
|
||||
[JsonProperty("email", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public string Email { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Author or distribution homepage name
|
||||
/// </summary>
|
||||
[JsonProperty("homepage")]
|
||||
[JsonProperty("homepage", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public string Homepage { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Author or distribution URL
|
||||
/// </summary>
|
||||
[JsonProperty("url")]
|
||||
[JsonProperty("url", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public string Url { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Any comment that does not already fit an existing field
|
||||
/// </summary>
|
||||
[JsonProperty("comment")]
|
||||
[JsonProperty("comment", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public string Comment { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Header skipper to be used when loading the DAT
|
||||
/// </summary>
|
||||
[JsonProperty("header")]
|
||||
[JsonProperty("header", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public string HeaderSkipper { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Classification of the DAT. Generally only used for SuperDAT
|
||||
/// </summary>
|
||||
[JsonProperty("type")]
|
||||
[JsonProperty("type", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public string Type { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Force a merging style when loaded
|
||||
/// </summary>
|
||||
/// TODO: Make nullable
|
||||
[JsonProperty("forcemerging")]
|
||||
[JsonProperty("forcemerging", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public MergingFlag ForceMerging { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Force nodump handling when loaded
|
||||
/// </summary>
|
||||
/// TODO: Make nullable
|
||||
[JsonProperty("forcenodump")]
|
||||
[JsonProperty("forcenodump", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public NodumpFlag ForceNodump { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Force output packing when loaded
|
||||
/// </summary>
|
||||
/// TODO: Make nullable
|
||||
[JsonProperty("forcepacking")]
|
||||
[JsonProperty("forcepacking", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public PackingFlag ForcePacking { get; set; }
|
||||
|
||||
/// <summary>
|
||||
@@ -185,13 +182,13 @@ namespace SabreTools.Library.DatFiles
|
||||
/// Debug build flag
|
||||
/// </summary>
|
||||
/// <remarks>Also in Logiqx</remarks>
|
||||
[JsonProperty("debug")]
|
||||
public bool? Debug { get; set; } = false;
|
||||
[JsonProperty("debug", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public bool? Debug { get; set; } = null;
|
||||
|
||||
/// <summary>
|
||||
/// MAME configuration name
|
||||
/// </summary>
|
||||
[JsonProperty("mameconfig")]
|
||||
[JsonProperty("mameconfig", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public string MameConfig { get; set; }
|
||||
|
||||
#endregion
|
||||
@@ -201,46 +198,46 @@ namespace SabreTools.Library.DatFiles
|
||||
/// <summary>
|
||||
/// Build version
|
||||
/// </summary>
|
||||
[JsonProperty("build")]
|
||||
[JsonProperty("build", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public string Build { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// RomCenter rom mode
|
||||
/// </summary>
|
||||
/// <remarks>(merged|split|unmerged) "split"</remarks>
|
||||
[JsonProperty("rommode")]
|
||||
[JsonProperty("rommode", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public MergingFlag RomMode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// RomCenter bios mode
|
||||
/// </summary>
|
||||
/// <remarks>(merged|split|unmerged) "split"</remarks>
|
||||
[JsonProperty("biosmode")]
|
||||
[JsonProperty("biosmode", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public MergingFlag BiosMode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// RomCenter sample mode
|
||||
/// </summary>
|
||||
/// <remarks>(merged|unmerged) "merged"</remarks>
|
||||
[JsonProperty("samplemode")]
|
||||
[JsonProperty("samplemode", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public MergingFlag SampleMode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// RomCenter lock rom mode
|
||||
/// </summary>
|
||||
[JsonProperty("lockrommode")]
|
||||
[JsonProperty("lockrommode", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public bool? LockRomMode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// RomCenter lock bios mode
|
||||
/// </summary>
|
||||
[JsonProperty("lockbiosmode")]
|
||||
[JsonProperty("lockbiosmode", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public bool? LockBiosMode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// RomCenter lock sample mode
|
||||
/// </summary>
|
||||
[JsonProperty("locksamplemode")]
|
||||
[JsonProperty("locksamplemode", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public bool? LockSampleMode { get; set; }
|
||||
|
||||
#endregion
|
||||
@@ -261,31 +258,31 @@ namespace SabreTools.Library.DatFiles
|
||||
/// System
|
||||
/// </summary>
|
||||
/// <remarks>Known as "plugin" in Logiqx and RomCenter</remarks>
|
||||
[JsonProperty("system")]
|
||||
[JsonProperty("system", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public string System { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Screenshots width
|
||||
/// </summary>
|
||||
[JsonProperty("screenshotswidth")]
|
||||
[JsonProperty("screenshotswidth", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public string ScreenshotsWidth { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Screenshots height
|
||||
/// </summary>
|
||||
[JsonProperty("screenshotsheight")]
|
||||
[JsonProperty("screenshotsheight", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public string ScreenshotsHeight { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// OfflineList info list
|
||||
/// </summary>
|
||||
[JsonProperty("infos")]
|
||||
[JsonProperty("infos", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public List<OfflineListInfo> Infos { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// OfflineList can-open extensions
|
||||
/// </summary>
|
||||
[JsonProperty("canopen")]
|
||||
[JsonProperty("canopen", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public List<string> CanOpen { get; set; }
|
||||
|
||||
// TODO: Implement the following header values:
|
||||
@@ -299,7 +296,7 @@ namespace SabreTools.Library.DatFiles
|
||||
/// <summary>
|
||||
/// Rom title
|
||||
/// </summary>
|
||||
[JsonProperty("romtitle")]
|
||||
[JsonProperty("romtitle", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public string RomTitle { get; set; }
|
||||
|
||||
#endregion
|
||||
@@ -309,7 +306,7 @@ namespace SabreTools.Library.DatFiles
|
||||
/// <summary>
|
||||
/// RomCenter DAT format version
|
||||
/// </summary>
|
||||
[JsonProperty("rcversion")]
|
||||
[JsonProperty("rcversion", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public string RomCenterVersion { get; set; }
|
||||
|
||||
#endregion
|
||||
@@ -575,8 +572,8 @@ namespace SabreTools.Library.DatFiles
|
||||
ReplaceExtension = datHeader.ReplaceExtension;
|
||||
|
||||
RemoveExtension = datHeader.RemoveExtension;
|
||||
InputDepot = datHeader.InputDepot.Clone() as DepotInformation;
|
||||
OutputDepot = datHeader.OutputDepot.Clone() as DepotInformation;
|
||||
InputDepot = datHeader.InputDepot?.Clone() as DepotInformation;
|
||||
OutputDepot = datHeader.OutputDepot?.Clone() as DepotInformation;
|
||||
GameName = datHeader.GameName;
|
||||
Quotes = datHeader.Quotes;
|
||||
UseRomName = datHeader.UseRomName;
|
||||
|
||||
@@ -477,7 +477,7 @@ namespace SabreTools.Library.DatFiles
|
||||
if (!string.IsNullOrWhiteSpace(rom.Date))
|
||||
cmpw.WriteAttributeString("date", rom.Date);
|
||||
if (!string.IsNullOrWhiteSpace(rom.CRC))
|
||||
cmpw.WriteAttributeString("crc", rom.CRC.ToLowerInvariant());
|
||||
cmpw.WriteAttributeString("crc", rom.CRC?.ToLowerInvariant());
|
||||
cmpw.WriteEndElement();
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -190,12 +190,12 @@ namespace SabreTools.Library.DatFiles
|
||||
|
||||
string[] fields = new string[]
|
||||
{
|
||||
rom.SHA256,
|
||||
$"{rom.Machine.Name}/",
|
||||
rom.Name,
|
||||
rom.SHA1,
|
||||
rom.MD5,
|
||||
rom.CRC,
|
||||
rom.SHA256 ?? string.Empty,
|
||||
$"{rom.Machine.Name ?? string.Empty}/",
|
||||
rom.Name ?? string.Empty,
|
||||
rom.SHA1 ?? string.Empty,
|
||||
rom.MD5 ?? string.Empty,
|
||||
rom.CRC ?? string.Empty,
|
||||
};
|
||||
|
||||
svw.WriteValues(fields);
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -445,7 +445,7 @@ namespace SabreTools.Library.DatFiles
|
||||
|
||||
// Otherwise, write out the SHA-1 hash
|
||||
else if (!string.IsNullOrWhiteSpace(disk.SHA1))
|
||||
sw.Write($" SHA1({disk.SHA1})");
|
||||
sw.Write($" SHA1({disk.SHA1 ?? string.Empty})");
|
||||
|
||||
// If we have a baddump, put the second indicator
|
||||
if (disk.ItemStatus == ItemStatus.BadDump)
|
||||
@@ -480,9 +480,9 @@ namespace SabreTools.Library.DatFiles
|
||||
else
|
||||
{
|
||||
if (!string.IsNullOrWhiteSpace(rom.CRC))
|
||||
sw.Write($" CRC({rom.CRC})");
|
||||
sw.Write($" CRC({rom.CRC ?? string.Empty})");
|
||||
if (!string.IsNullOrWhiteSpace(rom.SHA1))
|
||||
sw.Write($" SHA1({rom.SHA1})");
|
||||
sw.Write($" SHA1({rom.SHA1 ?? string.Empty})");
|
||||
}
|
||||
|
||||
// If we have a baddump, put the second indicator
|
||||
|
||||
@@ -1138,14 +1138,14 @@ namespace SabreTools.Library.DatFiles
|
||||
var disk = datItem as Disk;
|
||||
xtw.WriteStartElement("disk");
|
||||
xtw.WriteRequiredAttributeString("name", disk.Name);
|
||||
xtw.WriteOptionalAttributeString("md5", disk.MD5.ToLowerInvariant());
|
||||
xtw.WriteOptionalAttributeString("md5", disk.MD5?.ToLowerInvariant());
|
||||
#if NET_FRAMEWORK
|
||||
xtw.WriteOptionalAttributeString("ripemd160", disk.RIPEMD160.ToLowerInvariant());
|
||||
xtw.WriteOptionalAttributeString("ripemd160", disk.RIPEMD160?.ToLowerInvariant());
|
||||
#endif
|
||||
xtw.WriteOptionalAttributeString("sha1", disk.SHA1.ToLowerInvariant());
|
||||
xtw.WriteOptionalAttributeString("sha256", disk.SHA256.ToLowerInvariant());
|
||||
xtw.WriteOptionalAttributeString("sha384", disk.SHA384.ToLowerInvariant());
|
||||
xtw.WriteOptionalAttributeString("sha512", disk.SHA512.ToLowerInvariant());
|
||||
xtw.WriteOptionalAttributeString("sha1", disk.SHA1?.ToLowerInvariant());
|
||||
xtw.WriteOptionalAttributeString("sha256", disk.SHA256?.ToLowerInvariant());
|
||||
xtw.WriteOptionalAttributeString("sha384", disk.SHA384?.ToLowerInvariant());
|
||||
xtw.WriteOptionalAttributeString("sha512", disk.SHA512?.ToLowerInvariant());
|
||||
xtw.WriteOptionalAttributeString("merge", disk.MergeTag);
|
||||
xtw.WriteOptionalAttributeString("region", disk.Region);
|
||||
xtw.WriteOptionalAttributeString("index", disk.Index);
|
||||
@@ -1160,15 +1160,15 @@ namespace SabreTools.Library.DatFiles
|
||||
xtw.WriteStartElement("rom");
|
||||
xtw.WriteRequiredAttributeString("name", rom.Name);
|
||||
if (rom.Size != -1) xtw.WriteAttributeString("size", rom.Size.ToString());
|
||||
xtw.WriteOptionalAttributeString("crc", rom.CRC.ToLowerInvariant());
|
||||
xtw.WriteOptionalAttributeString("md5", rom.MD5.ToLowerInvariant());
|
||||
xtw.WriteOptionalAttributeString("crc", rom.CRC?.ToLowerInvariant());
|
||||
xtw.WriteOptionalAttributeString("md5", rom.MD5?.ToLowerInvariant());
|
||||
#if NET_FRAMEWORK
|
||||
xtw.WriteOptionalAttributeString("ripemd160", rom.RIPEMD160.ToLowerInvariant());
|
||||
xtw.WriteOptionalAttributeString("ripemd160", rom?.RIPEMD160.ToLowerInvariant());
|
||||
#endif
|
||||
xtw.WriteOptionalAttributeString("sha1", rom.SHA1.ToLowerInvariant());
|
||||
xtw.WriteOptionalAttributeString("sha256", rom.SHA256.ToLowerInvariant());
|
||||
xtw.WriteOptionalAttributeString("sha384", rom.SHA384.ToLowerInvariant());
|
||||
xtw.WriteOptionalAttributeString("sha512", rom.SHA512.ToLowerInvariant());
|
||||
xtw.WriteOptionalAttributeString("sha1", rom.SHA1?.ToLowerInvariant());
|
||||
xtw.WriteOptionalAttributeString("sha256", rom.SHA256?.ToLowerInvariant());
|
||||
xtw.WriteOptionalAttributeString("sha384", rom.SHA384?.ToLowerInvariant());
|
||||
xtw.WriteOptionalAttributeString("sha512", rom.SHA512?.ToLowerInvariant());
|
||||
xtw.WriteOptionalAttributeString("bios", rom.Bios);
|
||||
xtw.WriteOptionalAttributeString("merge", rom.MergeTag);
|
||||
xtw.WriteOptionalAttributeString("region", rom.Region);
|
||||
|
||||
@@ -1057,14 +1057,14 @@ namespace SabreTools.Library.DatFiles
|
||||
var disk = datItem as Disk;
|
||||
xtw.WriteStartElement("disk");
|
||||
xtw.WriteRequiredAttributeString("name", disk.Name);
|
||||
xtw.WriteOptionalAttributeString("md5", disk.MD5.ToLowerInvariant());
|
||||
xtw.WriteOptionalAttributeString("md5", disk.MD5?.ToLowerInvariant());
|
||||
#if NET_FRAMEWORK
|
||||
xtw.WriteOptionalAttributeString("ripemd160", disk.RIPEMD160.ToLowerInvariant());
|
||||
xtw.WriteOptionalAttributeString("ripemd160", disk.RIPEMD160?.ToLowerInvariant());
|
||||
#endif
|
||||
xtw.WriteOptionalAttributeString("sha1", disk.SHA1.ToLowerInvariant());
|
||||
xtw.WriteOptionalAttributeString("sha256", disk.SHA256.ToLowerInvariant());
|
||||
xtw.WriteOptionalAttributeString("sha384", disk.SHA384.ToLowerInvariant());
|
||||
xtw.WriteOptionalAttributeString("sha512", disk.SHA512.ToLowerInvariant());
|
||||
xtw.WriteOptionalAttributeString("sha1", disk.SHA1?.ToLowerInvariant());
|
||||
xtw.WriteOptionalAttributeString("sha256", disk.SHA256?.ToLowerInvariant());
|
||||
xtw.WriteOptionalAttributeString("sha384", disk.SHA384?.ToLowerInvariant());
|
||||
xtw.WriteOptionalAttributeString("sha512", disk.SHA512?.ToLowerInvariant());
|
||||
if (disk.ItemStatus != ItemStatus.None) xtw.WriteAttributeString("status", disk.ItemStatus.ToString().ToLowerInvariant());
|
||||
xtw.WriteEndElement();
|
||||
break;
|
||||
@@ -1085,15 +1085,15 @@ namespace SabreTools.Library.DatFiles
|
||||
xtw.WriteStartElement("rom");
|
||||
xtw.WriteRequiredAttributeString("name", rom.Name);
|
||||
if (rom.Size != -1) xtw.WriteAttributeString("size", rom.Size.ToString());
|
||||
xtw.WriteOptionalAttributeString("crc", rom.CRC.ToLowerInvariant());
|
||||
xtw.WriteOptionalAttributeString("md5", rom.MD5.ToLowerInvariant());
|
||||
xtw.WriteOptionalAttributeString("crc", rom.CRC?.ToLowerInvariant());
|
||||
xtw.WriteOptionalAttributeString("md5", rom.MD5?.ToLowerInvariant());
|
||||
#if NET_FRAMEWORK
|
||||
xtw.WriteOptionalAttributeString("ripemd160", rom.RIPEMD160.ToLowerInvariant());
|
||||
xtw.WriteOptionalAttributeString("ripemd160", rom.RIPEMD160?.ToLowerInvariant());
|
||||
#endif
|
||||
xtw.WriteOptionalAttributeString("sha1", rom.SHA1.ToLowerInvariant());
|
||||
xtw.WriteOptionalAttributeString("sha256", rom.SHA256.ToLowerInvariant());
|
||||
xtw.WriteOptionalAttributeString("sha384", rom.SHA384.ToLowerInvariant());
|
||||
xtw.WriteOptionalAttributeString("sha512", rom.SHA512.ToLowerInvariant());
|
||||
xtw.WriteOptionalAttributeString("sha1", rom.SHA1?.ToLowerInvariant());
|
||||
xtw.WriteOptionalAttributeString("sha256", rom.SHA256?.ToLowerInvariant());
|
||||
xtw.WriteOptionalAttributeString("sha384", rom.SHA384?.ToLowerInvariant());
|
||||
xtw.WriteOptionalAttributeString("sha512", rom.SHA512?.ToLowerInvariant());
|
||||
xtw.WriteOptionalAttributeString("date", rom.Date);
|
||||
if (rom.ItemStatus != ItemStatus.None) xtw.WriteAttributeString("status", rom.ItemStatus.ToString().ToLowerInvariant());
|
||||
xtw.WriteOptionalAttributeString("inverted", rom.Inverted.FromYesNo());
|
||||
|
||||
@@ -136,7 +136,7 @@ namespace SabreTools.Library.DatFiles
|
||||
ProcessItemName(datItem, false, forceRomName: false);
|
||||
|
||||
// Romba mode automatically uses item name
|
||||
if (Header.OutputDepot.IsActive || Header.UseRomName)
|
||||
if ((Header.OutputDepot?.IsActive ?? false) || Header.UseRomName)
|
||||
{
|
||||
sw.Write($"{datItem.Name}\n");
|
||||
}
|
||||
|
||||
@@ -925,14 +925,14 @@ namespace SabreTools.Library.DatFiles
|
||||
{
|
||||
xtw.WriteStartElement("romMD5");
|
||||
xtw.WriteAttributeString("extension", ".chd");
|
||||
xtw.WriteString(disk.MD5.ToUpperInvariant());
|
||||
xtw.WriteString(disk.MD5?.ToUpperInvariant());
|
||||
xtw.WriteEndElement();
|
||||
}
|
||||
else if (!string.IsNullOrWhiteSpace(disk.SHA1))
|
||||
{
|
||||
xtw.WriteStartElement("romSHA1");
|
||||
xtw.WriteAttributeString("extension", ".chd");
|
||||
xtw.WriteString(disk.SHA1.ToUpperInvariant());
|
||||
xtw.WriteString(disk.SHA1?.ToUpperInvariant());
|
||||
xtw.WriteEndElement();
|
||||
}
|
||||
|
||||
@@ -949,21 +949,21 @@ namespace SabreTools.Library.DatFiles
|
||||
{
|
||||
xtw.WriteStartElement("romCRC");
|
||||
xtw.WriteRequiredAttributeString("extension", tempext);
|
||||
xtw.WriteString(rom.CRC.ToUpperInvariant());
|
||||
xtw.WriteString(rom.CRC?.ToUpperInvariant());
|
||||
xtw.WriteEndElement();
|
||||
}
|
||||
else if (!string.IsNullOrWhiteSpace(rom.MD5))
|
||||
{
|
||||
xtw.WriteStartElement("romMD5");
|
||||
xtw.WriteRequiredAttributeString("extension", tempext);
|
||||
xtw.WriteString(rom.MD5.ToUpperInvariant());
|
||||
xtw.WriteString(rom.MD5?.ToUpperInvariant());
|
||||
xtw.WriteEndElement();
|
||||
}
|
||||
else if (!string.IsNullOrWhiteSpace(rom.SHA1))
|
||||
{
|
||||
xtw.WriteStartElement("romSHA1");
|
||||
xtw.WriteRequiredAttributeString("extension", tempext);
|
||||
xtw.WriteString(rom.SHA1.ToUpperInvariant());
|
||||
xtw.WriteString(rom.SHA1?.ToUpperInvariant());
|
||||
xtw.WriteEndElement();
|
||||
}
|
||||
|
||||
|
||||
@@ -740,7 +740,7 @@ namespace SabreTools.Library.DatFiles
|
||||
case OpenMSXSubType.Rom:
|
||||
case OpenMSXSubType.NULL:
|
||||
xtw.WriteStartElement("rom");
|
||||
xtw.WriteRequiredElementString("hash", rom.SHA1.ToLowerInvariant());
|
||||
xtw.WriteRequiredElementString("hash", rom.SHA1?.ToLowerInvariant());
|
||||
xtw.WriteOptionalElementString("start", rom.Offset);
|
||||
xtw.WriteOptionalElementString("type", rom.OpenMSXType);
|
||||
xtw.WriteOptionalElementString("remark", rom.Remark);
|
||||
@@ -749,7 +749,7 @@ namespace SabreTools.Library.DatFiles
|
||||
|
||||
case OpenMSXSubType.MegaRom:
|
||||
xtw.WriteStartElement("megarom");
|
||||
xtw.WriteRequiredElementString("hash", rom.SHA1.ToLowerInvariant());
|
||||
xtw.WriteRequiredElementString("hash", rom.SHA1?.ToLowerInvariant());
|
||||
xtw.WriteOptionalElementString("start", rom.Offset);
|
||||
xtw.WriteOptionalElementString("type", rom.OpenMSXType);
|
||||
xtw.WriteOptionalElementString("remark", rom.Remark);
|
||||
@@ -759,7 +759,7 @@ namespace SabreTools.Library.DatFiles
|
||||
case OpenMSXSubType.SCCPlusCart:
|
||||
xtw.WriteStartElement("sccpluscart");
|
||||
xtw.WriteOptionalElementString("boot", rom.Boot);
|
||||
xtw.WriteRequiredElementString("hash", rom.SHA1.ToLowerInvariant());
|
||||
xtw.WriteRequiredElementString("hash", rom.SHA1?.ToLowerInvariant());
|
||||
xtw.WriteOptionalElementString("remark", rom.Remark);
|
||||
xtw.WriteEndElement();
|
||||
break;
|
||||
|
||||
@@ -532,18 +532,18 @@ namespace SabreTools.Library.DatFiles
|
||||
case ItemType.Rom:
|
||||
var rom = datItem as Rom;
|
||||
|
||||
iw.WriteString($"¬{rom.Machine.CloneOf}");
|
||||
iw.WriteString($"¬{rom.Machine.CloneOf}");
|
||||
iw.WriteString($"¬{rom.Machine.Name}");
|
||||
if (string.IsNullOrWhiteSpace(rom.Machine.Description))
|
||||
iw.WriteString($"¬{rom.Machine.Name}");
|
||||
iw.WriteString($"¬{rom.Machine.CloneOf ?? string.Empty}");
|
||||
iw.WriteString($"¬{rom.Machine.CloneOf ?? string.Empty}");
|
||||
iw.WriteString($"¬{rom.Machine.Name ?? string.Empty}");
|
||||
if (string.IsNullOrWhiteSpace(rom.Machine.Description ?? string.Empty))
|
||||
iw.WriteString($"¬{rom.Machine.Name ?? string.Empty}");
|
||||
else
|
||||
iw.WriteString($"¬{rom.Machine.Description}");
|
||||
iw.WriteString($"¬{rom.Name}");
|
||||
iw.WriteString($"¬{rom.CRC}");
|
||||
iw.WriteString($"¬{rom.Machine.Description ?? string.Empty}");
|
||||
iw.WriteString($"¬{rom.Name ?? string.Empty}");
|
||||
iw.WriteString($"¬{rom.CRC ?? string.Empty}");
|
||||
iw.WriteString($"¬{rom.Size}");
|
||||
iw.WriteString($"¬{rom.Machine.RomOf}");
|
||||
iw.WriteString($"¬{rom.MergeTag}");
|
||||
iw.WriteString($"¬{rom.Machine.RomOf ?? string.Empty}");
|
||||
iw.WriteString($"¬{rom.MergeTag ?? string.Empty}");
|
||||
iw.WriteString("¬");
|
||||
iw.WriteLine();
|
||||
|
||||
|
||||
@@ -902,14 +902,14 @@ namespace SabreTools.Library.DatFiles
|
||||
xtw.WriteStartElement("file");
|
||||
xtw.WriteAttributeString("type", "disk");
|
||||
xtw.WriteRequiredAttributeString("name", disk.Name);
|
||||
xtw.WriteOptionalAttributeString("md5", disk.MD5.ToLowerInvariant());
|
||||
xtw.WriteOptionalAttributeString("md5", disk.MD5?.ToLowerInvariant());
|
||||
#if NET_FRAMEWORK
|
||||
xtw.WriteOptionalAttributeString("ripemd160", disk.RIPEMD160.ToLowerInvariant());
|
||||
xtw.WriteOptionalAttributeString("ripemd160", disk.RIPEMD160?.ToLowerInvariant());
|
||||
#endif
|
||||
xtw.WriteOptionalAttributeString("sha1", disk.SHA1.ToLowerInvariant());
|
||||
xtw.WriteOptionalAttributeString("sha256", disk.SHA256.ToLowerInvariant());
|
||||
xtw.WriteOptionalAttributeString("sha384", disk.SHA384.ToLowerInvariant());
|
||||
xtw.WriteOptionalAttributeString("sha512", disk.SHA512.ToLowerInvariant());
|
||||
xtw.WriteOptionalAttributeString("sha1", disk.SHA1?.ToLowerInvariant());
|
||||
xtw.WriteOptionalAttributeString("sha256", disk.SHA256?.ToLowerInvariant());
|
||||
xtw.WriteOptionalAttributeString("sha384", disk.SHA384?.ToLowerInvariant());
|
||||
xtw.WriteOptionalAttributeString("sha512", disk.SHA512?.ToLowerInvariant());
|
||||
if (disk.ItemStatus != ItemStatus.None)
|
||||
{
|
||||
xtw.WriteStartElement("flags");
|
||||
@@ -943,15 +943,15 @@ namespace SabreTools.Library.DatFiles
|
||||
xtw.WriteAttributeString("type", "rom");
|
||||
xtw.WriteRequiredAttributeString("name", rom.Name);
|
||||
if (rom.Size != -1) xtw.WriteAttributeString("size", rom.Size.ToString());
|
||||
xtw.WriteOptionalAttributeString("crc", rom.CRC.ToLowerInvariant());
|
||||
xtw.WriteOptionalAttributeString("md5", rom.MD5.ToLowerInvariant());
|
||||
xtw.WriteOptionalAttributeString("crc", rom.CRC?.ToLowerInvariant());
|
||||
xtw.WriteOptionalAttributeString("md5", rom.MD5?.ToLowerInvariant());
|
||||
#if NET_FRAMEWORK
|
||||
xtw.WriteOptionalAttributeString("ripemd160", rom.RIPEMD160.ToLowerInvariant());
|
||||
xtw.WriteOptionalAttributeString("ripemd160", rom.RIPEMD160?.ToLowerInvariant());
|
||||
#endif
|
||||
xtw.WriteOptionalAttributeString("sha1", rom.SHA1.ToLowerInvariant());
|
||||
xtw.WriteOptionalAttributeString("sha256", rom.SHA256.ToLowerInvariant());
|
||||
xtw.WriteOptionalAttributeString("sha384", rom.SHA384.ToLowerInvariant());
|
||||
xtw.WriteOptionalAttributeString("sha512", rom.SHA512.ToLowerInvariant());
|
||||
xtw.WriteOptionalAttributeString("sha1", rom.SHA1?.ToLowerInvariant());
|
||||
xtw.WriteOptionalAttributeString("sha256", rom.SHA256?.ToLowerInvariant());
|
||||
xtw.WriteOptionalAttributeString("sha384", rom.SHA384?.ToLowerInvariant());
|
||||
xtw.WriteOptionalAttributeString("sha512", rom.SHA512?.ToLowerInvariant());
|
||||
xtw.WriteOptionalAttributeString("date", rom.Date);
|
||||
if (rom.ItemStatus != ItemStatus.None)
|
||||
{
|
||||
|
||||
@@ -1723,11 +1723,11 @@ namespace SabreTools.Library.DatFiles
|
||||
fields[8] = string.Empty;
|
||||
fields[9] = string.Empty;
|
||||
fields[10] = disk.MD5.ToLowerInvariant();
|
||||
//fields[11] = disk.GetField(Field.RIPEMD160, DatHeader.ExcludeFields).ToLowerInvariant();
|
||||
//fields[11] = disk.RIPEMD160?.ToLowerInvariant();
|
||||
fields[11] = disk.SHA1.ToLowerInvariant();
|
||||
fields[12] = disk.SHA256.ToLowerInvariant();
|
||||
//fields[13] = disk.GetField(Field.SHA384, DatHeader.ExcludeFields).ToLowerInvariant();
|
||||
//fields[14] = disk.GetField(Field.SHA512, DatHeader.ExcludeFields).ToLowerInvariant();
|
||||
//fields[13] = disk.SHA384?.ToLowerInvariant();
|
||||
//fields[14] = disk.SHA512?.ToLowerInvariant();
|
||||
fields[13] = disk.ItemStatus.ToString();
|
||||
break;
|
||||
|
||||
@@ -1737,13 +1737,13 @@ namespace SabreTools.Library.DatFiles
|
||||
fields[6] = rom.Name;
|
||||
fields[7] = string.Empty;
|
||||
fields[8] = rom.Size.ToString();
|
||||
fields[9] = rom.CRC.ToLowerInvariant();
|
||||
fields[10] = rom.MD5.ToLowerInvariant();
|
||||
//fields[11] = rom.GetField(Field.RIPEMD160, DatHeader.ExcludeFields).ToLowerInvariant();
|
||||
fields[11] = rom.SHA1.ToLowerInvariant();
|
||||
fields[12] = rom.SHA256.ToLowerInvariant();
|
||||
//fields[13] = rom.GetField(Field.SHA384, DatHeader.ExcludeFields).ToLowerInvariant();
|
||||
//fields[14] = rom.GetField(Field.SHA512, DatHeader.ExcludeFields).ToLowerInvariant();
|
||||
fields[9] = rom.CRC?.ToLowerInvariant();
|
||||
fields[10] = rom.MD5?.ToLowerInvariant();
|
||||
//fields[11] = rom.RIPEMD160?.ToLowerInvariant();
|
||||
fields[11] = rom.SHA1?.ToLowerInvariant();
|
||||
fields[12] = rom.SHA256?.ToLowerInvariant();
|
||||
//fields[13] = rom.SHA384?.ToLowerInvariant();
|
||||
//fields[14] = rom.SHA512?.ToLowerInvariant();
|
||||
fields[13] = rom.ItemStatus.ToString();
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -952,14 +952,14 @@ namespace SabreTools.Library.DatFiles
|
||||
|
||||
xtw.WriteStartElement("disk");
|
||||
xtw.WriteRequiredAttributeString("name", disk.Name);
|
||||
xtw.WriteOptionalAttributeString("md5", disk.MD5.ToLowerInvariant());
|
||||
xtw.WriteOptionalAttributeString("md5", disk.MD5?.ToLowerInvariant());
|
||||
#if NET_FRAMEWORK
|
||||
xtw.WriteOptionalAttributeString("ripemd160", disk.RIPEMD160.ToLowerInvariant());
|
||||
xtw.WriteOptionalAttributeString("ripemd160", disk.RIPEMD160?.ToLowerInvariant());
|
||||
#endif
|
||||
xtw.WriteOptionalAttributeString("sha1", disk.SHA1.ToLowerInvariant());
|
||||
xtw.WriteOptionalAttributeString("sha256", disk.SHA256.ToLowerInvariant());
|
||||
xtw.WriteOptionalAttributeString("sha384", disk.SHA384.ToLowerInvariant());
|
||||
xtw.WriteOptionalAttributeString("sha512", disk.SHA512.ToLowerInvariant());
|
||||
xtw.WriteOptionalAttributeString("sha1", disk.SHA1?.ToLowerInvariant());
|
||||
xtw.WriteOptionalAttributeString("sha256", disk.SHA256?.ToLowerInvariant());
|
||||
xtw.WriteOptionalAttributeString("sha384", disk.SHA384?.ToLowerInvariant());
|
||||
xtw.WriteOptionalAttributeString("sha512", disk.SHA512?.ToLowerInvariant());
|
||||
if (disk.ItemStatus != ItemStatus.None) xtw.WriteAttributeString("status", disk.ItemStatus.ToString().ToLowerInvariant());
|
||||
xtw.WriteOptionalAttributeString("writable", disk.Writable.FromYesNo());
|
||||
xtw.WriteEndElement();
|
||||
@@ -982,15 +982,15 @@ namespace SabreTools.Library.DatFiles
|
||||
xtw.WriteStartElement("rom");
|
||||
xtw.WriteRequiredAttributeString("name", rom.Name);
|
||||
if (rom.Size != -1) xtw.WriteAttributeString("size", rom.Size.ToString());
|
||||
xtw.WriteOptionalAttributeString("crc", rom.CRC.ToLowerInvariant());
|
||||
xtw.WriteOptionalAttributeString("md5", rom.MD5.ToLowerInvariant());
|
||||
xtw.WriteOptionalAttributeString("crc", rom.CRC?.ToLowerInvariant());
|
||||
xtw.WriteOptionalAttributeString("md5", rom.MD5?.ToLowerInvariant());
|
||||
#if NET_FRAMEWORK
|
||||
xtw.WriteOptionalAttributeString("ripemd160", rom.RIPEMD160.ToLowerInvariant());
|
||||
xtw.WriteOptionalAttributeString("ripemd160", rom.RIPEMD160?.ToLowerInvariant());
|
||||
#endif
|
||||
xtw.WriteOptionalAttributeString("sha1", rom.SHA1.ToLowerInvariant());
|
||||
xtw.WriteOptionalAttributeString("sha256", rom.SHA256.ToLowerInvariant());
|
||||
xtw.WriteOptionalAttributeString("sha384", rom.SHA384.ToLowerInvariant());
|
||||
xtw.WriteOptionalAttributeString("sha512", rom.SHA512.ToLowerInvariant());
|
||||
xtw.WriteOptionalAttributeString("sha1", rom.SHA1?.ToLowerInvariant());
|
||||
xtw.WriteOptionalAttributeString("sha256", rom.SHA256?.ToLowerInvariant());
|
||||
xtw.WriteOptionalAttributeString("sha384", rom.SHA384?.ToLowerInvariant());
|
||||
xtw.WriteOptionalAttributeString("sha512", rom.SHA512?.ToLowerInvariant());
|
||||
xtw.WriteOptionalAttributeString("offset", rom.Offset);
|
||||
xtw.WriteOptionalAttributeString("value", rom.Value);
|
||||
if (rom.ItemStatus != ItemStatus.None) xtw.WriteAttributeString("status", rom.ItemStatus.ToString().ToLowerInvariant());
|
||||
|
||||
@@ -18,13 +18,13 @@ namespace SabreTools.Library.DatItems
|
||||
/// <summary>
|
||||
/// Description of the BIOS
|
||||
/// </summary>
|
||||
[JsonProperty("description")]
|
||||
[JsonProperty("description", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public string Description { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Determine whether the BIOS is default
|
||||
/// </summary>
|
||||
[JsonProperty("default")]
|
||||
[JsonProperty("default", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public bool? Default { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -62,13 +62,13 @@ namespace SabreTools.Library.DatItems
|
||||
/// <summary>
|
||||
/// Alternate name for the item
|
||||
/// </summary>
|
||||
[JsonProperty("alt_romname")]
|
||||
[JsonProperty("alt_romname", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public string AltName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Alternate title for the item
|
||||
/// </summary>
|
||||
[JsonProperty("alt_title")]
|
||||
[JsonProperty("alt_title", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public string AltTitle { get; set; }
|
||||
|
||||
#endregion
|
||||
@@ -78,13 +78,13 @@ namespace SabreTools.Library.DatItems
|
||||
/// <summary>
|
||||
/// OpenMSX sub item type
|
||||
/// </summary>
|
||||
[JsonProperty("original")]
|
||||
[JsonProperty("original", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public OpenMSXOriginal Original { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// OpenMSX sub item type
|
||||
/// </summary>
|
||||
[JsonProperty("openmsx_subtype")]
|
||||
[JsonProperty("openmsx_subtype", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
[JsonConverter(typeof(StringEnumConverter))]
|
||||
public OpenMSXSubType OpenMSXSubType { get; set; }
|
||||
|
||||
@@ -92,19 +92,19 @@ namespace SabreTools.Library.DatItems
|
||||
/// OpenMSX sub item type
|
||||
/// </summary>
|
||||
/// <remarks>Not related to the subtype above</remarks>
|
||||
[JsonProperty("openmsx_type")]
|
||||
[JsonProperty("openmsx_type", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public string OpenMSXType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Item remark (like a comment)
|
||||
/// </summary>
|
||||
[JsonProperty("remark")]
|
||||
[JsonProperty("remark", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public string Remark { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Boot state
|
||||
/// </summary>
|
||||
[JsonProperty("boot")]
|
||||
[JsonProperty("boot", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public string Boot { get; set; }
|
||||
|
||||
#endregion
|
||||
@@ -114,58 +114,58 @@ namespace SabreTools.Library.DatItems
|
||||
/// <summary>
|
||||
/// Original hardware part associated with the item
|
||||
/// </summary>
|
||||
[JsonProperty("partname")]
|
||||
[JsonProperty("partname", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public string PartName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Original hardware interface associated with the item
|
||||
/// </summary>
|
||||
[JsonProperty("partinterface")]
|
||||
[JsonProperty("partinterface", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public string PartInterface { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Features provided to/by the item
|
||||
/// </summary>
|
||||
[JsonProperty("features")]
|
||||
[JsonProperty("features", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public List<SoftwareListFeature> Features { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Original hardware part name within an item
|
||||
/// </summary>
|
||||
[JsonProperty("areaname")]
|
||||
[JsonProperty("areaname", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public string AreaName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Original hardware size within the part
|
||||
/// </summary>
|
||||
[JsonProperty("areasize")]
|
||||
[JsonProperty("areasize", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public long? AreaSize { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Width of the data area in bytes
|
||||
/// </summary>
|
||||
/// TODO: Convert to Int32
|
||||
[JsonProperty("width")]
|
||||
[JsonProperty("width", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public string AreaWidth { get; set; } // (8|16|32|64) "8"
|
||||
|
||||
/// <summary>
|
||||
/// Endianness of the data area
|
||||
/// </summary>
|
||||
/// TODO: Convert to Enum?
|
||||
[JsonProperty("endianness")]
|
||||
[JsonProperty("endianness", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public string AreaEndianness { get; set; } // (big|little) "little"
|
||||
|
||||
/// <summary>
|
||||
/// SoftwareList value associated with the item
|
||||
/// </summary>
|
||||
[JsonProperty("value")]
|
||||
[JsonProperty("value", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public string Value { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Loading flag
|
||||
/// </summary>
|
||||
/// TODO: Convert to Enum?
|
||||
[JsonProperty("loadflag")]
|
||||
[JsonProperty("loadflag", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public string LoadFlag { get; set; } // (load16_byte|load16_word|load16_word_swap|load32_byte|load32_word|load32_word_swap|load32_dword|load64_word|load64_word_swap|reload|fill|continue|reload_plain|ignore)
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -33,7 +33,7 @@ namespace SabreTools.Library.DatItems
|
||||
/// <summary>
|
||||
/// Data MD5 hash
|
||||
/// </summary>
|
||||
[JsonProperty("md5")]
|
||||
[JsonProperty("md5", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public string MD5
|
||||
{
|
||||
get { return _md5.IsNullOrEmpty() ? null : Utilities.ByteArrayToString(_md5); }
|
||||
@@ -44,7 +44,7 @@ namespace SabreTools.Library.DatItems
|
||||
/// <summary>
|
||||
/// Data RIPEMD160 hash
|
||||
/// </summary>
|
||||
[JsonProperty("ripemd160")]
|
||||
[JsonProperty("ripemd160", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public string RIPEMD160
|
||||
{
|
||||
get { return _ripemd160.IsNullOrEmpty() ? null : Utilities.ByteArrayToString(_ripemd160); }
|
||||
@@ -55,7 +55,7 @@ namespace SabreTools.Library.DatItems
|
||||
/// <summary>
|
||||
/// Data SHA-1 hash
|
||||
/// </summary>
|
||||
[JsonProperty("sha1")]
|
||||
[JsonProperty("sha1", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public string SHA1
|
||||
{
|
||||
get { return _sha1.IsNullOrEmpty() ? null : Utilities.ByteArrayToString(_sha1); }
|
||||
@@ -65,7 +65,7 @@ namespace SabreTools.Library.DatItems
|
||||
/// <summary>
|
||||
/// Data SHA-256 hash
|
||||
/// </summary>
|
||||
[JsonProperty("sha256")]
|
||||
[JsonProperty("sha256", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public string SHA256
|
||||
{
|
||||
get { return _sha256.IsNullOrEmpty() ? null : Utilities.ByteArrayToString(_sha256); }
|
||||
@@ -75,7 +75,7 @@ namespace SabreTools.Library.DatItems
|
||||
/// <summary>
|
||||
/// Data SHA-384 hash
|
||||
/// </summary>
|
||||
[JsonProperty("sha384")]
|
||||
[JsonProperty("sha384", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public string SHA384
|
||||
{
|
||||
get { return _sha384.IsNullOrEmpty() ? null : Utilities.ByteArrayToString(_sha384); }
|
||||
@@ -85,7 +85,7 @@ namespace SabreTools.Library.DatItems
|
||||
/// <summary>
|
||||
/// Data SHA-512 hash
|
||||
/// </summary>
|
||||
[JsonProperty("sha512")]
|
||||
[JsonProperty("sha512", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public string SHA512
|
||||
{
|
||||
get { return _sha512.IsNullOrEmpty() ? null : Utilities.ByteArrayToString(_sha512); }
|
||||
@@ -95,38 +95,38 @@ namespace SabreTools.Library.DatItems
|
||||
/// <summary>
|
||||
/// Disk name to merge from parent
|
||||
/// </summary>
|
||||
[JsonProperty("merge")]
|
||||
[JsonProperty("merge", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public string MergeTag { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Disk region
|
||||
/// </summary>
|
||||
[JsonProperty("region")]
|
||||
[JsonProperty("region", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public string Region { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Disk index
|
||||
/// </summary>
|
||||
[JsonProperty("index")]
|
||||
[JsonProperty("index", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public string Index { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Disk writable flag
|
||||
/// </summary>
|
||||
[JsonProperty("writable")]
|
||||
[JsonProperty("writable", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public bool? Writable { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Disk dump status
|
||||
/// </summary>
|
||||
[JsonProperty("status")]
|
||||
[JsonProperty("status", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
[JsonConverter(typeof(StringEnumConverter))]
|
||||
public ItemStatus ItemStatus { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Determine if the disk is optional in the set
|
||||
/// </summary>
|
||||
[JsonProperty("optional")]
|
||||
[JsonProperty("optional", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public bool? Optional { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -21,68 +21,68 @@ namespace SabreTools.Library.DatItems
|
||||
/// <summary>
|
||||
/// Name of the machine
|
||||
/// </summary>
|
||||
[JsonProperty("name")]
|
||||
[JsonProperty("name", DefaultValueHandling = DefaultValueHandling.Include)]
|
||||
public string Name { get; set; } = null;
|
||||
|
||||
/// <summary>
|
||||
/// Additional notes
|
||||
/// </summary>
|
||||
/// <remarks>Known as "Extra" in AttractMode</remarks>
|
||||
[JsonProperty("comment")]
|
||||
[JsonProperty("comment", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public string Comment { get; set; } = null;
|
||||
|
||||
/// <summary>
|
||||
/// Extended description
|
||||
/// </summary>
|
||||
[JsonProperty("description")]
|
||||
[JsonProperty("description", DefaultValueHandling = DefaultValueHandling.Include)]
|
||||
public string Description { get; set; } = null;
|
||||
|
||||
/// <summary>
|
||||
/// Year(s) of release/manufacture
|
||||
/// </summary>
|
||||
[JsonProperty("year")]
|
||||
[JsonProperty("year", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public string Year { get; set; } = null;
|
||||
|
||||
/// <summary>
|
||||
/// Manufacturer, if available
|
||||
/// </summary>
|
||||
[JsonProperty("manufacturer")]
|
||||
[JsonProperty("manufacturer", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public string Manufacturer { get; set; } = null;
|
||||
|
||||
/// <summary>
|
||||
/// Publisher, if available
|
||||
/// </summary>
|
||||
[JsonProperty("publisher")]
|
||||
[JsonProperty("publisher", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public string Publisher { get; set; } = null;
|
||||
|
||||
/// <summary>
|
||||
/// Category, if available
|
||||
/// </summary>
|
||||
[JsonProperty("category")]
|
||||
[JsonProperty("category", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public string Category { get; set; } = null;
|
||||
|
||||
/// <summary>
|
||||
/// fomof parent
|
||||
/// </summary>
|
||||
[JsonProperty("romof")]
|
||||
[JsonProperty("romof", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public string RomOf { get; set; } = null;
|
||||
|
||||
/// <summary>
|
||||
/// cloneof parent
|
||||
/// </summary>
|
||||
[JsonProperty("cloneof")]
|
||||
[JsonProperty("cloneof", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public string CloneOf { get; set; } = null;
|
||||
|
||||
/// <summary>
|
||||
/// sampleof parent
|
||||
/// </summary>
|
||||
[JsonProperty("sampleof")]
|
||||
[JsonProperty("sampleof", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public string SampleOf { get; set; } = null;
|
||||
|
||||
/// <summary>
|
||||
/// Type of the machine
|
||||
/// </summary>
|
||||
[JsonProperty("type")]
|
||||
[JsonProperty("type", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public MachineType MachineType { get; set; } = MachineType.NULL;
|
||||
|
||||
#endregion
|
||||
@@ -93,43 +93,43 @@ namespace SabreTools.Library.DatItems
|
||||
/// Player count
|
||||
/// </summary>
|
||||
/// <remarks>Also in Logiqx EmuArc</remarks>
|
||||
[JsonProperty("players")]
|
||||
[JsonProperty("players", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public string Players { get; set; } = null;
|
||||
|
||||
/// <summary>
|
||||
/// Screen rotation
|
||||
/// </summary>
|
||||
[JsonProperty("rotation")]
|
||||
[JsonProperty("rotation", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public string Rotation { get; set; } = null;
|
||||
|
||||
/// <summary>
|
||||
/// Control method
|
||||
/// </summary>
|
||||
[JsonProperty("control")]
|
||||
[JsonProperty("control", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public string Control { get; set; } = null;
|
||||
|
||||
/// <summary>
|
||||
/// Support status
|
||||
/// </summary>
|
||||
[JsonProperty("status")]
|
||||
[JsonProperty("status", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public string Status { get; set; } = null;
|
||||
|
||||
/// <summary>
|
||||
/// Display count
|
||||
/// </summary>
|
||||
[JsonProperty("displaycount")]
|
||||
[JsonProperty("displaycount", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public string DisplayCount { get; set; } = null;
|
||||
|
||||
/// <summary>
|
||||
/// Display type
|
||||
/// </summary>
|
||||
[JsonProperty("displaytype")]
|
||||
[JsonProperty("displaytype", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public string DisplayType { get; set; } = null;
|
||||
|
||||
/// <summary>
|
||||
/// Number of input buttons
|
||||
/// </summary>
|
||||
[JsonProperty("buttons")]
|
||||
[JsonProperty("buttons", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public string Buttons { get; set; } = null;
|
||||
|
||||
#endregion
|
||||
@@ -140,50 +140,50 @@ namespace SabreTools.Library.DatItems
|
||||
/// Emulator source file related to the machine
|
||||
/// </summary>
|
||||
/// <remarks>Also in Logiqx</remarks>
|
||||
[JsonProperty("sourcefile")]
|
||||
[JsonProperty("sourcefile", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public string SourceFile { get; set; } = null;
|
||||
|
||||
/// <summary>
|
||||
/// Machine runnable status
|
||||
/// </summary>
|
||||
/// <remarks>Also in Logiqx</remarks>
|
||||
[JsonProperty("runnable")]
|
||||
[JsonProperty("runnable", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public Runnable Runnable { get; set; } = Runnable.NULL;
|
||||
|
||||
/// <summary>
|
||||
/// List of associated device names
|
||||
/// </summary>
|
||||
[JsonProperty("devices")]
|
||||
[JsonProperty("devices", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public List<ListXmlDeviceReference> DeviceReferences { get; set; } = null;
|
||||
|
||||
/// <summary>
|
||||
/// List of associated chips
|
||||
/// </summary>
|
||||
[JsonProperty("chips")]
|
||||
[JsonProperty("chips", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public List<ListXmlChip> Chips { get; set; } = null;
|
||||
|
||||
/// <summary>
|
||||
/// List of associated displays
|
||||
/// </summary>
|
||||
[JsonProperty("displays")]
|
||||
[JsonProperty("displays", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public List<ListXmlDisplay> Displays { get; set; } = null;
|
||||
|
||||
/// <summary>
|
||||
/// List of associated sounds
|
||||
/// </summary>
|
||||
[JsonProperty("sounds")]
|
||||
[JsonProperty("sounds", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public List<ListXmlSound> Sounds { get; set; } = null;
|
||||
|
||||
/// <summary>
|
||||
/// List of associated conditions
|
||||
/// </summary>
|
||||
[JsonProperty("conditions")]
|
||||
[JsonProperty("conditions", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public List<ListXmlCondition> Conditions { get; set; } = null;
|
||||
|
||||
/// <summary>
|
||||
/// List of associated inputs
|
||||
/// </summary>
|
||||
[JsonProperty("inputs")]
|
||||
[JsonProperty("inputs", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public List<ListXmlInput> Inputs { get; set; } = null;
|
||||
|
||||
/// <summary>
|
||||
@@ -191,26 +191,26 @@ namespace SabreTools.Library.DatItems
|
||||
/// </summary>
|
||||
/// <remarks>Also in SoftwareList</remarks>
|
||||
/// TODO: Order ListXML and SoftwareList outputs by area names
|
||||
[JsonProperty("dipswitches")]
|
||||
[JsonProperty("dipswitches", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public List<ListXmlDipSwitch> DipSwitches { get; set; } = null;
|
||||
|
||||
/// <summary>
|
||||
/// List of associated configurations
|
||||
/// </summary>
|
||||
[JsonProperty("configurations")]
|
||||
[JsonProperty("configurations", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public List<ListXmlConfiguration> Configurations { get; set; } = null;
|
||||
|
||||
/// <summary>
|
||||
/// List of slot options
|
||||
/// </summary>
|
||||
[JsonProperty("slots")]
|
||||
[JsonProperty("slots", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public List<ListXmlSlot> Slots { get; set; } = null;
|
||||
|
||||
/// <summary>
|
||||
/// List of info items
|
||||
/// </summary>
|
||||
/// <remarks>Also in SoftwareList</remarks>
|
||||
[JsonProperty("infos")]
|
||||
[JsonProperty("infos", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public List<ListXmlInfo> Infos { get; set; } = null;
|
||||
|
||||
#endregion
|
||||
@@ -220,13 +220,13 @@ namespace SabreTools.Library.DatItems
|
||||
/// <summary>
|
||||
/// Machine board name
|
||||
/// </summary>
|
||||
[JsonProperty("board")]
|
||||
[JsonProperty("board", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public string Board { get; set; } = null;
|
||||
|
||||
/// <summary>
|
||||
/// Rebuild location if different than machine name
|
||||
/// </summary>
|
||||
[JsonProperty("rebuildto")]
|
||||
[JsonProperty("rebuildto", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public string RebuildTo { get; set; } = null;
|
||||
|
||||
#endregion
|
||||
@@ -236,55 +236,55 @@ namespace SabreTools.Library.DatItems
|
||||
/// <summary>
|
||||
/// Title ID
|
||||
/// </summary>
|
||||
[JsonProperty("titleid")]
|
||||
[JsonProperty("titleid", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public string TitleID { get; set; } = null;
|
||||
|
||||
/// <summary>
|
||||
/// Machine developer
|
||||
/// </summary>
|
||||
[JsonProperty("developer")]
|
||||
[JsonProperty("developer", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public string Developer { get; set; } = null;
|
||||
|
||||
/// <summary>
|
||||
/// Game genre
|
||||
/// </summary>
|
||||
[JsonProperty("genre")]
|
||||
[JsonProperty("genre", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public string Genre { get; set; } = null;
|
||||
|
||||
/// <summary>
|
||||
/// Game subgenre
|
||||
/// </summary>
|
||||
[JsonProperty("genre")]
|
||||
[JsonProperty("subgenre", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public string Subgenre { get; set; } = null;
|
||||
|
||||
/// <summary>
|
||||
/// Game ratings
|
||||
/// </summary>
|
||||
[JsonProperty("ratings")]
|
||||
[JsonProperty("ratings", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public string Ratings { get; set; } = null;
|
||||
|
||||
/// <summary>
|
||||
/// Game score
|
||||
/// </summary>
|
||||
[JsonProperty("score")]
|
||||
[JsonProperty("score", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public string Score { get; set; } = null;
|
||||
|
||||
/// <summary>
|
||||
/// Is the machine enabled
|
||||
/// </summary>
|
||||
[JsonProperty("enabled")]
|
||||
[JsonProperty("enabled", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public string Enabled { get; set; } = null; // bool?
|
||||
|
||||
/// <summary>
|
||||
/// Does the game have a CRC check
|
||||
/// </summary>
|
||||
[JsonProperty("hascrc")]
|
||||
[JsonProperty("hascrc", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public bool? HasCrc { get; set; } = null;
|
||||
|
||||
/// <summary>
|
||||
/// Machine relations
|
||||
/// </summary>
|
||||
[JsonProperty("relatedto")]
|
||||
[JsonProperty("relatedto", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public string RelatedTo { get; set; } = null;
|
||||
|
||||
#endregion
|
||||
@@ -294,19 +294,19 @@ namespace SabreTools.Library.DatItems
|
||||
/// <summary>
|
||||
/// Generation MSX ID
|
||||
/// </summary>
|
||||
[JsonProperty("genmsxid")]
|
||||
[JsonProperty("genmsxid", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public string GenMSXID { get; set; } = null;
|
||||
|
||||
/// <summary>
|
||||
/// MSX System
|
||||
/// </summary>
|
||||
[JsonProperty("system")]
|
||||
[JsonProperty("system", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public string System { get; set; } = null;
|
||||
|
||||
/// <summary>
|
||||
/// Machine country of origin
|
||||
/// </summary>
|
||||
[JsonProperty("country")]
|
||||
[JsonProperty("country", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public string Country { get; set; } = null;
|
||||
|
||||
#endregion
|
||||
@@ -316,13 +316,13 @@ namespace SabreTools.Library.DatItems
|
||||
/// <summary>
|
||||
/// Support status
|
||||
/// </summary>
|
||||
[JsonProperty("supported")]
|
||||
[JsonProperty("supported", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public Supported Supported { get; set; } = Supported.NULL;
|
||||
|
||||
/// <summary>
|
||||
/// List of shared feature items
|
||||
/// </summary>
|
||||
[JsonProperty("sharedfeat")]
|
||||
[JsonProperty("sharedfeat", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public List<SoftwareListSharedFeature> SharedFeatures { get; set; } = null;
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -18,25 +18,25 @@ namespace SabreTools.Library.DatItems
|
||||
/// <summary>
|
||||
/// Release region(s)
|
||||
/// </summary>
|
||||
[JsonProperty("region")]
|
||||
[JsonProperty("region", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public string Region { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Release language(s)
|
||||
/// </summary>
|
||||
[JsonProperty("language")]
|
||||
[JsonProperty("language", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public string Language { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Date of release
|
||||
/// </summary>
|
||||
[JsonProperty("date")]
|
||||
[JsonProperty("date", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public string Date { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Default release, if applicable
|
||||
/// </summary>
|
||||
[JsonProperty("default")]
|
||||
[JsonProperty("default", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public bool? Default { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -36,19 +36,19 @@ namespace SabreTools.Library.DatItems
|
||||
/// <summary>
|
||||
/// What BIOS is required for this rom
|
||||
/// </summary>
|
||||
[JsonProperty("bios")]
|
||||
[JsonProperty("bios", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public string Bios { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Byte size of the rom
|
||||
/// </summary>
|
||||
[JsonProperty("size")]
|
||||
[JsonProperty("size", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public long Size { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// File CRC32 hash
|
||||
/// </summary>
|
||||
[JsonProperty("crc")]
|
||||
[JsonProperty("crc", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public string CRC
|
||||
{
|
||||
get { return _crc.IsNullOrEmpty() ? null : Utilities.ByteArrayToString(_crc); }
|
||||
@@ -58,7 +58,7 @@ namespace SabreTools.Library.DatItems
|
||||
/// <summary>
|
||||
/// File MD5 hash
|
||||
/// </summary>
|
||||
[JsonProperty("md5")]
|
||||
[JsonProperty("md5", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public string MD5
|
||||
{
|
||||
get { return _md5.IsNullOrEmpty() ? null : Utilities.ByteArrayToString(_md5); }
|
||||
@@ -69,7 +69,7 @@ namespace SabreTools.Library.DatItems
|
||||
/// <summary>
|
||||
/// File RIPEMD160 hash
|
||||
/// </summary>
|
||||
[JsonProperty("ripemd160")]
|
||||
[JsonProperty("ripemd160", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public string RIPEMD160
|
||||
{
|
||||
get { return _ripemd160.IsNullOrEmpty() ? null : Utilities.ByteArrayToString(_ripemd160); }
|
||||
@@ -80,7 +80,7 @@ namespace SabreTools.Library.DatItems
|
||||
/// <summary>
|
||||
/// File SHA-1 hash
|
||||
/// </summary>
|
||||
[JsonProperty("sha1")]
|
||||
[JsonProperty("sha1", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public string SHA1
|
||||
{
|
||||
get { return _sha1.IsNullOrEmpty() ? null : Utilities.ByteArrayToString(_sha1); }
|
||||
@@ -90,7 +90,7 @@ namespace SabreTools.Library.DatItems
|
||||
/// <summary>
|
||||
/// File SHA-256 hash
|
||||
/// </summary>
|
||||
[JsonProperty("sha256")]
|
||||
[JsonProperty("sha256", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public string SHA256
|
||||
{
|
||||
get { return _sha256.IsNullOrEmpty() ? null : Utilities.ByteArrayToString(_sha256); }
|
||||
@@ -100,7 +100,7 @@ namespace SabreTools.Library.DatItems
|
||||
/// <summary>
|
||||
/// File SHA-384 hash
|
||||
/// </summary>
|
||||
[JsonProperty("sha384")]
|
||||
[JsonProperty("sha384", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public string SHA384
|
||||
{
|
||||
get { return _sha384.IsNullOrEmpty() ? null : Utilities.ByteArrayToString(_sha384); }
|
||||
@@ -110,7 +110,7 @@ namespace SabreTools.Library.DatItems
|
||||
/// <summary>
|
||||
/// File SHA-512 hash
|
||||
/// </summary>
|
||||
[JsonProperty("sha512")]
|
||||
[JsonProperty("sha512", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public string SHA512
|
||||
{
|
||||
get { return _sha512.IsNullOrEmpty() ? null : Utilities.ByteArrayToString(_sha512); }
|
||||
@@ -120,44 +120,44 @@ namespace SabreTools.Library.DatItems
|
||||
/// <summary>
|
||||
/// Rom name to merge from parent
|
||||
/// </summary>
|
||||
[JsonProperty("merge")]
|
||||
[JsonProperty("merge", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public string MergeTag { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Rom region
|
||||
/// </summary>
|
||||
[JsonProperty("region")]
|
||||
[JsonProperty("region", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public string Region { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Data offset within rom
|
||||
/// </summary>
|
||||
[JsonProperty("offset")]
|
||||
[JsonProperty("offset", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public string Offset { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// File created date
|
||||
/// </summary>
|
||||
[JsonProperty("date")]
|
||||
[JsonProperty("date", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public string Date { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Rom dump status
|
||||
/// </summary>
|
||||
[JsonProperty("status")]
|
||||
[JsonProperty("status", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
[JsonConverter(typeof(StringEnumConverter))]
|
||||
public ItemStatus ItemStatus { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Determine if the rom is optional in the set
|
||||
/// </summary>
|
||||
[JsonProperty("optional")]
|
||||
[JsonProperty("optional", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public bool? Optional { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Determine if the CRC32 hash is inverted
|
||||
/// </summary>
|
||||
[JsonProperty("inverted")]
|
||||
[JsonProperty("inverted", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public bool? Inverted { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -39,7 +39,7 @@ namespace SabreTools.Library.IO
|
||||
/// <param name="value">Value to write in the attribute</param>
|
||||
public static void WriteOptionalAttributeString(this XmlTextWriter writer, string localName, string value)
|
||||
{
|
||||
if (string.IsNullOrEmpty(value))
|
||||
if (!string.IsNullOrEmpty(value))
|
||||
writer.WriteAttributeString(localName, value);
|
||||
}
|
||||
|
||||
@@ -51,7 +51,7 @@ namespace SabreTools.Library.IO
|
||||
/// <param name="value">Value to write in the element</param>
|
||||
public static void WriteOptionalElementString(this XmlTextWriter writer, string localName, string value)
|
||||
{
|
||||
if (string.IsNullOrEmpty(value))
|
||||
if (!string.IsNullOrEmpty(value))
|
||||
writer.WriteElementString(localName, value);
|
||||
}
|
||||
}
|
||||
|
||||
33
SabreTools.Library/Tools/BaseFirstContractResolver.cs
Normal file
33
SabreTools.Library/Tools/BaseFirstContractResolver.cs
Normal file
@@ -0,0 +1,33 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Serialization;
|
||||
|
||||
namespace SabreTools.Library.Tools
|
||||
{
|
||||
// https://github.com/dotnet/runtime/issues/728
|
||||
public class BaseFirstContractResolver : DefaultContractResolver
|
||||
{
|
||||
public BaseFirstContractResolver()
|
||||
{
|
||||
NamingStrategy = new CamelCaseNamingStrategy();
|
||||
}
|
||||
|
||||
protected override IList<JsonProperty> CreateProperties(Type type, MemberSerialization memberSerialization)
|
||||
{
|
||||
return base.CreateProperties(type, memberSerialization)
|
||||
.OrderBy(p => BaseTypesAndSelf(p.DeclaringType).Count()).ToList();
|
||||
|
||||
IEnumerable<Type> BaseTypesAndSelf(Type t)
|
||||
{
|
||||
while (t != null)
|
||||
{
|
||||
yield return t;
|
||||
t = t.BaseType;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -68,11 +68,11 @@ namespace SabreTools.Features
|
||||
var outputFormat = GetOutputFormat(features);
|
||||
|
||||
// If we have TorrentGzip output and the romba flag, update
|
||||
if (Header.OutputDepot.IsActive && outputFormat == OutputFormat.TorrentGzip)
|
||||
if ((Header.OutputDepot?.IsActive ?? false) && outputFormat == OutputFormat.TorrentGzip)
|
||||
outputFormat = OutputFormat.TorrentGzipRomba;
|
||||
|
||||
// If we hae TorrentXZ output and the romba flag, update
|
||||
if (Header.OutputDepot.IsActive && outputFormat == OutputFormat.TorrentXZ)
|
||||
if ((Header.OutputDepot?.IsActive ?? false) && outputFormat == OutputFormat.TorrentXZ)
|
||||
outputFormat = OutputFormat.TorrentXZRomba;
|
||||
|
||||
// Get a list of files from the input datfiles
|
||||
@@ -96,7 +96,7 @@ namespace SabreTools.Features
|
||||
datdata.Header.HeaderSkipper = Header.HeaderSkipper;
|
||||
|
||||
// If we have the depot flag, respect it
|
||||
if (Header.InputDepot.IsActive)
|
||||
if (Header.InputDepot?.IsActive ?? false)
|
||||
datdata.RebuildDepot(Inputs, Path.Combine(OutputDir, datdata.Header.FileName), date, delete, inverse, outputFormat, updateDat);
|
||||
else
|
||||
datdata.RebuildGeneric(Inputs, Path.Combine(OutputDir, datdata.Header.FileName), quickScan, date, delete, inverse, outputFormat, updateDat, asFiles);
|
||||
@@ -126,7 +126,7 @@ namespace SabreTools.Features
|
||||
watch.Stop();
|
||||
|
||||
// If we have the depot flag, respect it
|
||||
if (Header.InputDepot.IsActive)
|
||||
if (Header.InputDepot?.IsActive ?? false)
|
||||
datdata.RebuildDepot(Inputs, OutputDir, date, delete, inverse, outputFormat, updateDat);
|
||||
else
|
||||
datdata.RebuildGeneric(Inputs, OutputDir, quickScan, date, delete, inverse, outputFormat, updateDat, asFiles);
|
||||
|
||||
@@ -66,7 +66,7 @@ namespace SabreTools.Features
|
||||
datdata.Header.HeaderSkipper = Header.HeaderSkipper;
|
||||
|
||||
// If we have the depot flag, respect it
|
||||
if (Header.InputDepot.IsActive)
|
||||
if (Header.InputDepot?.IsActive ?? false)
|
||||
datdata.VerifyDepot(Inputs, OutputDir);
|
||||
else
|
||||
datdata.VerifyGeneric(Inputs, OutputDir, hashOnly, quickScan, asFiles, Extras, Filter);
|
||||
@@ -96,7 +96,7 @@ namespace SabreTools.Features
|
||||
watch.Stop();
|
||||
|
||||
// If we have the depot flag, respect it
|
||||
if (Header.InputDepot.IsActive)
|
||||
if (Header.InputDepot?.IsActive ?? false)
|
||||
datdata.VerifyDepot(Inputs, OutputDir);
|
||||
else
|
||||
datdata.VerifyGeneric(Inputs, OutputDir, hashOnly, quickScan, asFiles, Extras, Filter);
|
||||
|
||||
Reference in New Issue
Block a user