mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
[ALL] Remove Hash struct
This is a bit controversial, even for me, but for the time being, we need to tie very specific information to each type of item. That means that a Rom and a Disk, though they both have hashes, they have different hashes. I'm going to see how this plays out for the time being.
This commit is contained in:
@@ -3,48 +3,6 @@ using System.Collections.Generic;
|
||||
|
||||
namespace SabreTools.Helper
|
||||
{
|
||||
#region Dat-to-Hash structs
|
||||
|
||||
/// <summary>
|
||||
/// Intermediate struct for holding and processing hash data
|
||||
/// </summary>
|
||||
public struct Hash : IEquatable<Hash>
|
||||
{
|
||||
public long Size;
|
||||
public string CRC;
|
||||
public string MD5;
|
||||
public string SHA1;
|
||||
|
||||
public bool Equals(Hash other)
|
||||
{
|
||||
return this.Equals(other, false);
|
||||
}
|
||||
|
||||
public bool Equals(Hash other, bool IsDisk)
|
||||
{
|
||||
bool equals = false;
|
||||
|
||||
if (IsDisk &&
|
||||
((String.IsNullOrEmpty(this.MD5) || String.IsNullOrEmpty(other.MD5)) || this.MD5 == other.MD5) &&
|
||||
((String.IsNullOrEmpty(this.SHA1) || String.IsNullOrEmpty(other.SHA1)) || this.SHA1 == other.SHA1))
|
||||
{
|
||||
equals = true;
|
||||
}
|
||||
else if (!IsDisk &&
|
||||
(this.Size == other.Size) &&
|
||||
((String.IsNullOrEmpty(this.CRC) || String.IsNullOrEmpty(other.CRC)) || this.CRC == other.CRC) &&
|
||||
((String.IsNullOrEmpty(this.MD5) || String.IsNullOrEmpty(other.MD5)) || this.MD5 == other.MD5) &&
|
||||
((String.IsNullOrEmpty(this.SHA1) || String.IsNullOrEmpty(other.SHA1)) || this.SHA1 == other.SHA1))
|
||||
{
|
||||
equals = true;
|
||||
}
|
||||
|
||||
return equals;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Skipper structs
|
||||
|
||||
/// <summary>
|
||||
|
||||
Reference in New Issue
Block a user