mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
[DatFile, Disk, Rom] Better equality checking
This commit is contained in:
@@ -138,14 +138,20 @@ namespace SabreTools.Library.DatItems
|
||||
// Otherwise, treat it as a rom
|
||||
Disk newOther = (Disk)other;
|
||||
|
||||
// If either is a nodump, it's never a match
|
||||
if (_itemStatus == ItemStatus.Nodump || newOther.ItemStatus == ItemStatus.Nodump)
|
||||
// If all hashes are empty but they're both nodump and the names match, then they're dupes
|
||||
if ((this._itemStatus == ItemStatus.Nodump && newOther._itemStatus == ItemStatus.Nodump)
|
||||
&& (this._name == newOther._name)
|
||||
&& (this._md5.IsNullOrWhiteSpace() && newOther._md5.IsNullOrWhiteSpace())
|
||||
&& (this._sha1.IsNullOrWhiteSpace() && newOther._sha1.IsNullOrWhiteSpace())
|
||||
&& (this._sha256.IsNullOrWhiteSpace() && newOther._sha256.IsNullOrWhiteSpace())
|
||||
&& (this._sha384.IsNullOrWhiteSpace() && newOther._sha384.IsNullOrWhiteSpace())
|
||||
&& (this._sha512.IsNullOrWhiteSpace() && newOther._sha512.IsNullOrWhiteSpace()))
|
||||
{
|
||||
return dupefound;
|
||||
dupefound = true;
|
||||
}
|
||||
|
||||
// If we can determine that the disks have no non-empty hashes in common, we return false
|
||||
if ((this._md5.IsNullOrWhiteSpace() || newOther._md5.IsNullOrWhiteSpace())
|
||||
else if ((this._md5.IsNullOrWhiteSpace() || newOther._md5.IsNullOrWhiteSpace())
|
||||
&& (this._sha1.IsNullOrWhiteSpace() || newOther._sha1.IsNullOrWhiteSpace())
|
||||
&& (this._sha256.IsNullOrWhiteSpace() || newOther._sha256.IsNullOrWhiteSpace())
|
||||
&& (this._sha384.IsNullOrWhiteSpace() || newOther._sha384.IsNullOrWhiteSpace())
|
||||
@@ -153,6 +159,8 @@ namespace SabreTools.Library.DatItems
|
||||
{
|
||||
dupefound = false;
|
||||
}
|
||||
|
||||
// Otherwise if we get a partial match
|
||||
else if (((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))
|
||||
|
||||
Reference in New Issue
Block a user