[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:
Matt Nadareski
2016-09-19 20:36:12 -07:00
parent b549085c34
commit 1db04406c3
12 changed files with 266 additions and 293 deletions

View File

@@ -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>