From 47c2228881828ecb2f789682fb06bb60ba8f3795 Mon Sep 17 00:00:00 2001 From: Matt Nadareski Date: Fri, 20 Sep 2019 10:55:03 -0700 Subject: [PATCH] Missing size means just hash checking --- SabreTools.Library/DatItems/Rom.cs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/SabreTools.Library/DatItems/Rom.cs b/SabreTools.Library/DatItems/Rom.cs index 66fa4727..0738f69b 100644 --- a/SabreTools.Library/DatItems/Rom.cs +++ b/SabreTools.Library/DatItems/Rom.cs @@ -293,6 +293,18 @@ namespace SabreTools.Library.DatItems dupefound = false; } + // If we have a file that has no known size, rely on the hashes only + else if ((this.Size == -1) + && ((this._crc.IsNullOrWhiteSpace() || newOther._crc.IsNullOrWhiteSpace()) || Enumerable.SequenceEqual(this._crc, newOther._crc)) + && ((this._md5.IsNullOrWhiteSpace() || newOther._md5.IsNullOrWhiteSpace()) || Enumerable.SequenceEqual(this._md5, newOther._md5)) + && ((this._sha1.IsNullOrWhiteSpace() || newOther._sha1.IsNullOrWhiteSpace()) || Enumerable.SequenceEqual(this._sha1, newOther._sha1)) + && ((this._sha256.IsNullOrWhiteSpace() || newOther._sha256.IsNullOrWhiteSpace()) || Enumerable.SequenceEqual(this._sha256, newOther._sha256)) + && ((this._sha384.IsNullOrWhiteSpace() || newOther._sha384.IsNullOrWhiteSpace()) || Enumerable.SequenceEqual(this._sha384, newOther._sha384)) + && ((this._sha512.IsNullOrWhiteSpace() || newOther._sha512.IsNullOrWhiteSpace()) || Enumerable.SequenceEqual(this._sha512, newOther._sha512))) + { + dupefound = true; + } + // Otherwise if we get a partial match else if ((this.Size == newOther.Size) && ((this._crc.IsNullOrWhiteSpace() || newOther._crc.IsNullOrWhiteSpace()) || Enumerable.SequenceEqual(this._crc, newOther._crc))