Compare commits

..

2 Commits

Author SHA1 Message Date
Bogdan 1c01452952
Merge 2e784c7f36 into b81c3ee4a8 2024-04-20 15:23:26 +00:00
Bogdan 2e784c7f36 Implement equality checks for providers 2024-04-20 18:23:13 +03:00
1 changed files with 19 additions and 1 deletions

View File

@ -1,6 +1,7 @@
using System;
using System.Linq;
using System.Text.RegularExpressions;
using Equ;
using FluentValidation;
using NzbDrone.Common.Extensions;
using NzbDrone.Core.Annotations;
@ -40,10 +41,12 @@ namespace NzbDrone.Core.Indexers.Torznab
}
}
public class TorznabSettings : NewznabSettings, ITorrentIndexerSettings
public class TorznabSettings : NewznabSettings, ITorrentIndexerSettings, IEquatable<TorznabSettings>
{
private static readonly TorznabSettingsValidator Validator = new ();
private static readonly MemberwiseEqualityComparer<TorznabSettings> Comparer = MemberwiseEqualityComparer<TorznabSettings>.ByProperties;
public TorznabSettings()
{
MinimumSeeders = IndexerDefaults.MINIMUM_SEEDERS;
@ -62,5 +65,20 @@ namespace NzbDrone.Core.Indexers.Torznab
{
return new NzbDroneValidationResult(Validator.Validate(this));
}
public bool Equals(TorznabSettings other)
{
return Comparer.Equals(this, other);
}
public override bool Equals(object obj)
{
return Equals(obj as TorznabSettings);
}
public override int GetHashCode()
{
return Comparer.GetHashCode(this);
}
}
}