|
|
|
@ -2,29 +2,29 @@
|
|
|
|
|
|
|
|
|
|
namespace DiscordChatExporter.Domain.Discord.Models.Common
|
|
|
|
|
{
|
|
|
|
|
public partial class ChannelPositionBasedComparer : IComparer<Channel>
|
|
|
|
|
public partial class PositionBasedComparer : IComparer<IHasIdAndPosition>
|
|
|
|
|
{
|
|
|
|
|
public int Compare(Channel? x, Channel? y)
|
|
|
|
|
public int Compare(IHasIdAndPosition? x, IHasIdAndPosition? y)
|
|
|
|
|
{
|
|
|
|
|
int result;
|
|
|
|
|
if (x != null)
|
|
|
|
|
{
|
|
|
|
|
result = x.Position.CompareTo(y?.Position);
|
|
|
|
|
}
|
|
|
|
|
else if (y != null)
|
|
|
|
|
{
|
|
|
|
|
result = -y.Position.CompareTo(x?.Position);
|
|
|
|
|
if(result == 0)
|
|
|
|
|
{
|
|
|
|
|
result = x.Id.Value.CompareTo(y?.Id.Value);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
result = 0;
|
|
|
|
|
result = y == null ? 0 : -1;
|
|
|
|
|
}
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public partial class ChannelPositionBasedComparer
|
|
|
|
|
public partial class PositionBasedComparer
|
|
|
|
|
{
|
|
|
|
|
public static ChannelPositionBasedComparer Instance { get; } = new();
|
|
|
|
|
public static PositionBasedComparer Instance { get; } = new();
|
|
|
|
|
}
|
|
|
|
|
}
|