diff --git a/SabreTools.Helper/Data/Structs.cs b/SabreTools.Helper/Data/Structs.cs
index 8c118450..ad9947d0 100644
--- a/SabreTools.Helper/Data/Structs.cs
+++ b/SabreTools.Helper/Data/Structs.cs
@@ -87,14 +87,26 @@ namespace SabreTools.Helper
public bool Equals(Rom other)
{
- Logger temp = new Logger(false, "");
- temp.Start();
- bool isdupe = RomTools.IsDuplicate(this, other, temp);
- temp.Close();
+ bool dupefound = false;
- return (this.Machine.Name == other.Machine.Name &&
+ // If either is a nodump, it's never a match
+ if (this.Nodump || other.Nodump)
+ {
+ return dupefound;
+ }
+
+ if (this.Type == ItemType.Rom && other.Type == ItemType.Rom)
+ {
+ dupefound = this.HashData.Equals(other.HashData, false);
+ }
+ else if (this.Type == ItemType.Disk && other.Type == ItemType.Disk)
+ {
+ dupefound = this.HashData.Equals(other.HashData, true);
+ }
+
+ return (this.Machine.Equals(other.Machine) &&
this.Name == other.Name &&
- isdupe);
+ dupefound);
}
}
@@ -112,7 +124,7 @@ namespace SabreTools.Helper
///
/// Intermediate struct for holding and processing Rom/Machine data
///
- public struct Machine
+ public struct Machine : IEquatable
{
public string Name;
public string Comment;
@@ -127,6 +139,16 @@ namespace SabreTools.Helper
public string Board;
public string RebuildTo;
public bool TorrentZipped;
+
+ public bool Equals(Machine other)
+ {
+ if (this.Name == other.Name)
+ {
+ return true;
+ }
+
+ return false;
+ }
}
///
diff --git a/SabreTools.Helper/Tools/RomTools.cs b/SabreTools.Helper/Tools/RomTools.cs
index fe0b760f..3b37ae5c 100644
--- a/SabreTools.Helper/Tools/RomTools.cs
+++ b/SabreTools.Helper/Tools/RomTools.cs
@@ -241,22 +241,7 @@ namespace SabreTools.Helper
/// True if the roms are duplicates, false otherwise
public static bool IsDuplicate(Rom rom, Rom lastrom, Logger logger)
{
- bool dupefound = false;
-
- // If either is a nodump, it's never a match
- if (rom.Nodump || lastrom.Nodump)
- {
- return dupefound;
- }
-
- if (rom.Type == ItemType.Rom && lastrom.Type == ItemType.Rom)
- {
- dupefound = rom.HashData.Equals(lastrom.HashData, false);
- }
- else if (rom.Type == ItemType.Disk && lastrom.Type == ItemType.Disk)
- {
- dupefound = rom.HashData.Equals(lastrom.HashData, true);
- }
+ bool dupefound = rom.Equals(lastrom);
// More wonderful SHA-1 logging that has to be done
if (rom.HashData.SHA1 == lastrom.HashData.SHA1 && rom.HashData.Size != lastrom.HashData.Size)