Kavita/API/Comparators/ChapterSortComparer.cs
Joseph Milazzo f694145cd9
Feature/tech debt (#199)
* Added an icon for building the exe

* Technical debt
2021-05-05 21:00:50 -05:00

18 lines
444 B
C#

using System.Collections.Generic;
namespace API.Comparators
{
public class ChapterSortComparer : IComparer<double>
{
public int Compare(double x, double y)
{
if (x == 0.0 && y == 0.0) return 0;
// if x is 0, it comes second
if (x == 0.0) return 1;
// if y is 0, it comes second
if (y == 0.0) return -1;
return x.CompareTo(y);
}
}
}