diff --git a/Metadata/DeviceReportV2.cs b/Metadata/DeviceReportV2.cs index ed517cc80..320c5fffe 100644 --- a/Metadata/DeviceReportV2.cs +++ b/Metadata/DeviceReportV2.cs @@ -1683,9 +1683,30 @@ namespace DiscImageChef.CommonTypes.Metadata } } - public class DensityCode + public class DensityCode : IEquatable { + [JsonIgnore] [Key] + public int Id { get; set; } + public int Code { get; set; } + + public bool Equals(DensityCode other) + { + if(ReferenceEquals(null, other)) return false; + if(ReferenceEquals(this, other)) return true; + + return Code == other.Code; + } + + public override bool Equals(object obj) + { + if(ReferenceEquals(null, obj)) return false; + if(ReferenceEquals(this, obj)) return true; + + return obj.GetType() == GetType() && Equals((DensityCode)obj); + } + + public override int GetHashCode() => Code; } } \ No newline at end of file