mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
[Structs] Fix RomData compare, add RomData equality
This commit is contained in:
@@ -6,7 +6,7 @@ namespace SabreTools.Helper
|
||||
/// <summary>
|
||||
/// Intermediate struct for holding and processing rom data
|
||||
/// </summary>
|
||||
public struct RomData : IComparable
|
||||
public struct RomData : IComparable, IEquatable<RomData>
|
||||
{
|
||||
public string Manufacturer;
|
||||
public string System;
|
||||
@@ -31,29 +31,28 @@ namespace SabreTools.Helper
|
||||
{
|
||||
RomData comp = (RomData)obj;
|
||||
|
||||
if (this.SystemID == comp.SystemID)
|
||||
if (this.Game == comp.Game)
|
||||
{
|
||||
if (this.SourceID == comp.SourceID)
|
||||
if (this.Name == comp.Name)
|
||||
{
|
||||
if (this.Game == comp.Game)
|
||||
{
|
||||
if (this.Name == comp.Name)
|
||||
{
|
||||
return (RomTools.IsDuplicate(this, comp) ? 0 : 1);
|
||||
}
|
||||
return String.Compare(this.Name, comp.Name);
|
||||
}
|
||||
return String.Compare(this.Game, comp.Game);
|
||||
return (RomTools.IsDuplicate(this, comp) ? 0 : 1);
|
||||
}
|
||||
return this.SourceID - comp.SourceID;
|
||||
return String.Compare(this.Name, comp.Name);
|
||||
}
|
||||
return this.SystemID - comp.SystemID;
|
||||
return String.Compare(this.Game, comp.Game);
|
||||
}
|
||||
catch
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
public bool Equals(RomData other)
|
||||
{
|
||||
return (this.Game == other.Game &&
|
||||
this.Name == other.Name &&
|
||||
RomTools.IsDuplicate(this, other));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
Reference in New Issue
Block a user