[Structs] Fix RomData compare, add RomData equality

This commit is contained in:
Matt Nadareski
2016-06-16 10:52:31 -07:00
parent d58b67f124
commit aac8d5a351

View File

@@ -6,7 +6,7 @@ namespace SabreTools.Helper
/// <summary> /// <summary>
/// Intermediate struct for holding and processing rom data /// Intermediate struct for holding and processing rom data
/// </summary> /// </summary>
public struct RomData : IComparable public struct RomData : IComparable, IEquatable<RomData>
{ {
public string Manufacturer; public string Manufacturer;
public string System; public string System;
@@ -31,10 +31,6 @@ namespace SabreTools.Helper
{ {
RomData comp = (RomData)obj; RomData comp = (RomData)obj;
if (this.SystemID == comp.SystemID)
{
if (this.SourceID == comp.SourceID)
{
if (this.Game == comp.Game) if (this.Game == comp.Game)
{ {
if (this.Name == comp.Name) if (this.Name == comp.Name)
@@ -45,15 +41,18 @@ namespace SabreTools.Helper
} }
return String.Compare(this.Game, comp.Game); return String.Compare(this.Game, comp.Game);
} }
return this.SourceID - comp.SourceID;
}
return this.SystemID - comp.SystemID;
}
catch catch
{ {
return 1; return 1;
} }
} }
public bool Equals(RomData other)
{
return (this.Game == other.Game &&
this.Name == other.Name &&
RomTools.IsDuplicate(this, other));
}
} }
/// <summary> /// <summary>