Change merging because blank CRCs can lead to problems

This commit is contained in:
Matt Nadareski
2016-05-11 15:02:33 -07:00
parent 11632ca111
commit 5224b1dabe

View File

@@ -504,7 +504,8 @@ namespace SabreTools.Helper
if (!(crc == "" && md5 == "" && sha1 == ""))
{
// Get the new values to add
string key = crc + "-" + size;
string key = size + "-" + crc;
RomData value = new RomData
{
Game = tempname,
@@ -575,6 +576,25 @@ namespace SabreTools.Helper
if (x.Size == y.Size)
{
if (x.CRC == y.CRC)
{
// If the CRC is blank, use MD5 before SystemID
if (x.CRC == "")
{
if (x.MD5 == y.MD5)
{
if (x.SystemID == y.SystemID)
{
if (x.SourceID == y.SourceID)
{
return String.Compare(x.SHA1, y.SHA1);
}
return x.SourceID - y.SourceID;
}
return x.SystemID - y.SystemID;
}
return String.Compare(x.MD5, y.MD5);
}
else
{
if (x.SystemID == y.SystemID)
{
@@ -590,6 +610,8 @@ namespace SabreTools.Helper
}
return x.SystemID - y.SystemID;
}
}
return String.Compare(x.CRC, y.CRC);
}
return (int)(x.Size - y.Size);