From 690d17f9b5ba2a548c4b1853c1fbbaa2d5c2e5da Mon Sep 17 00:00:00 2001 From: Matt Nadareski Date: Mon, 2 May 2016 14:02:43 -0700 Subject: [PATCH] Take care of hex-hashes --- SabreHelper/RomManipulation.cs | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/SabreHelper/RomManipulation.cs b/SabreHelper/RomManipulation.cs index 8d9df00f..ed364835 100644 --- a/SabreHelper/RomManipulation.cs +++ b/SabreHelper/RomManipulation.cs @@ -312,6 +312,14 @@ namespace SabreTools.Helper Int64.TryParse(xtr.GetAttribute("size"), out size); } + // Take care of hex-prefixed hashes + string crc = (xtr.GetAttribute("crc") != null ? xtr.GetAttribute("crc").ToLowerInvariant().Trim() : ""); + crc = (crc.StartsWith("0x") ? crc.Remove(0, 2) : crc); + string md5 = (xtr.GetAttribute("md5") != null ? xtr.GetAttribute("md5").ToLowerInvariant().Trim() : ""); + md5 = (md5.StartsWith("0x") ? md5.Remove(0, 2) : md5); + string sha1 = (xtr.GetAttribute("sha1") != null ? xtr.GetAttribute("sha1").ToLowerInvariant().Trim() : ""); + sha1 = (sha1.StartsWith("0x") ? sha1.Remove(0, 2) : sha1); + roms.Add(new RomData { Game = tempname, @@ -320,9 +328,9 @@ namespace SabreTools.Helper SystemID = sysid, SourceID = srcid, Size = size, - CRC = (xtr.GetAttribute("crc") != null ? xtr.GetAttribute("crc").ToLowerInvariant().Trim() : ""), - MD5 = (xtr.GetAttribute("md5") != null ? xtr.GetAttribute("md5").ToLowerInvariant().Trim() : ""), - SHA1 = (xtr.GetAttribute("sha1") != null ? xtr.GetAttribute("sha1").ToLowerInvariant().Trim() : ""), + CRC = crc, + MD5 = md5, + SHA1 = sha1, }); break; }