Add SMDB size field support

This commit is contained in:
Matt Nadareski
2021-05-17 10:05:29 -07:00
parent f49ded7323
commit b76f064098
2 changed files with 14 additions and 8 deletions

View File

@@ -12,8 +12,8 @@ namespace SabreTools.Core
/// <summary> /// <summary>
/// The current toolset version to be used by all child applications /// The current toolset version to be used by all child applications
/// </summary> /// </summary>
public readonly static string Version = $"v1.1.1"; //public readonly static string Version = $"v1.1.1";
//public readonly static string Version = $"v1.1.1-{File.GetCreationTime(Assembly.GetExecutingAssembly().Location):yyyy-MM-dd HH:mm:ss}"; public readonly static string Version = $"v1.1.1-{File.GetCreationTime(Assembly.GetExecutingAssembly().Location):yyyy-MM-dd HH:mm:ss}";
/// <summary> /// <summary>
/// Readies the console and outputs the header /// Readies the console and outputs the header

View File

@@ -4,6 +4,7 @@ using System.IO;
using System.Text; using System.Text;
using SabreTools.Core; using SabreTools.Core;
using SabreTools.Core.Tools;
using SabreTools.DatItems; using SabreTools.DatItems;
using SabreTools.DatItems.Formats; using SabreTools.DatItems.Formats;
using SabreTools.IO; using SabreTools.IO;
@@ -58,6 +59,7 @@ namespace SabreTools.DatFiles.Formats
2 - SHA-1 2 - SHA-1
3 - MD5 3 - MD5
4 - CRC32 4 - CRC32
5 - Size (Optional)
*/ */
string[] fullname = svr.Line[1].Split('/'); string[] fullname = svr.Line[1].Split('/');
@@ -85,6 +87,10 @@ namespace SabreTools.DatFiles.Formats
}, },
}; };
// Size in SMDB files is optional
if (svr.Line.Count > 5)
rom.Size = Utilities.CleanLong(svr.Line[5]);
// Now process and add the rom // Now process and add the rom
ParseAddHelper(rom, statsOnly); ParseAddHelper(rom, statsOnly);
} }
@@ -186,11 +192,11 @@ namespace SabreTools.DatFiles.Formats
string[] fields = new string[] string[] fields = new string[]
{ {
rom.SHA256 ?? string.Empty, rom.SHA256 ?? string.Empty,
$"{rom.Machine.Name ?? string.Empty}/", $"{rom.Machine.Name ?? string.Empty}/{rom.Name ?? string.Empty}",
rom.Name ?? string.Empty,
rom.SHA1 ?? string.Empty, rom.SHA1 ?? string.Empty,
rom.MD5 ?? string.Empty, rom.MD5 ?? string.Empty,
rom.CRC ?? string.Empty, rom.CRC ?? string.Empty,
rom.Size.ToString() ?? string.Empty,
}; };
svw.WriteValues(fields); svw.WriteValues(fields);