mirror of
https://github.com/RPCS3/discord-bot.git
synced 2026-01-31 01:25:22 +01:00
21 lines
690 B
C#
21 lines
690 B
C#
namespace CompatBot.Utils;
|
|
|
|
internal class DiscordAttachmentComparer : IEqualityComparer<DiscordAttachment>
|
|
{
|
|
bool IEqualityComparer<DiscordAttachment>.Equals(DiscordAttachment? x, DiscordAttachment? y)
|
|
{
|
|
if (x is null && y is null)
|
|
return true;
|
|
|
|
if (x is null || y is null)
|
|
return false;
|
|
|
|
return x.FileName == y.FileName && x.FileSize == y.FileSize;
|
|
}
|
|
|
|
int IEqualityComparer<DiscordAttachment>.GetHashCode(DiscordAttachment obj)
|
|
=> HashCode.Combine((obj.FileName ?? "").GetHashCode(), obj.FileSize.GetHashCode());
|
|
|
|
public static DiscordAttachmentComparer Instance { get; } = new DiscordAttachmentComparer();
|
|
}
|