Lots of work for chapters. This code will be refactored in a chapter rewrite.
This commit is contained in:
parent
f430595d11
commit
a42e54a078
11 changed files with 99 additions and 13 deletions
18
API/Comparators/ChapterSortComparer.cs
Normal file
18
API/Comparators/ChapterSortComparer.cs
Normal file
|
@ -0,0 +1,18 @@
|
|||
using System.Collections.Generic;
|
||||
|
||||
namespace API.Comparators
|
||||
{
|
||||
public class ChapterSortComparer : IComparer<int>
|
||||
{
|
||||
public int Compare(int x, int y)
|
||||
{
|
||||
if (x == 0 && y == 0) return 0;
|
||||
// if x is 0, it comes second
|
||||
if (x == 0) return 1;
|
||||
// if y is 0, it comes second
|
||||
if (y == 0) return -1;
|
||||
|
||||
return x.CompareTo(y);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue