From c8a6df3b4208bf048af010c5673be8e172811507 Mon Sep 17 00:00:00 2001 From: Matt Nadareski Date: Mon, 4 Apr 2016 13:37:20 -0700 Subject: [PATCH] Change int32 to int64 for file sizes There were issues where some files had sizes that were larger than what a standard 32-bit integer could handle. This should fix that issue. --- DATabase/Core/Import.cs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/DATabase/Core/Import.cs b/DATabase/Core/Import.cs index a44a8255..1c897006 100644 --- a/DATabase/Core/Import.cs +++ b/DATabase/Core/Import.cs @@ -385,14 +385,14 @@ namespace SabreTools if (node.NodeType == XmlNodeType.Element && (child.Name == "rom" || child.Name == "disk")) { // Take care of hex-sized files - int size = -1; + long size = -1; if (child.Attributes["size"] != null && child.Attributes["size"].Value.Contains("0x")) { - size = Convert.ToInt32(child.Attributes["size"].Value, 16); + size = Convert.ToInt64(child.Attributes["size"].Value, 16); } else if (child.Attributes["size"] != null) { - size = Int32.Parse(child.Attributes["size"].Value); + size = Int64.Parse(child.Attributes["size"].Value); } AddRom( @@ -420,14 +420,14 @@ namespace SabreTools if (data.NodeType == XmlNodeType.Element && (data.Name == "rom" || data.Name == "disk") && data.Attributes["name"] != null) { // Take care of hex-sized files - int size = -1; + long size = -1; if (data.Attributes["size"] != null && data.Attributes["size"].Value.Contains("0x")) { - size = Convert.ToInt32(data.Attributes["size"].Value, 16); + size = Convert.ToInt64(data.Attributes["size"].Value, 16); } else if (data.Attributes["size"] != null) { - size = Int32.Parse(data.Attributes["size"].Value); + size = Int64.Parse(data.Attributes["size"].Value); } AddRom( @@ -529,7 +529,7 @@ namespace SabreTools /// MD5 hash of the file /// SHA-1 hash of the file /// True if the file exists or could be added, false on error - private bool AddRom(string romtype, long gameid, string name, string date, int size, string crc, string md5, string sha1) + private bool AddRom(string romtype, long gameid, string name, string date, long size, string crc, string md5, string sha1) { // WOD origninally stripped out any subdirs from the imported files, we do the same name = Path.GetFileName(name);