From 44ebca36ecf42256dc49ae0407aed5b6c1e663da Mon Sep 17 00:00:00 2001 From: Joseph Milazzo Date: Tue, 19 Jan 2021 12:51:41 -0600 Subject: [PATCH] Cleaned up some TODOs. --- API/Controllers/ReaderController.cs | 2 +- API/Services/CacheService.cs | 5 ++--- API/Services/DirectoryService.cs | 4 ++-- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/API/Controllers/ReaderController.cs b/API/Controllers/ReaderController.cs index 59bb517f3..d2fed05f7 100644 --- a/API/Controllers/ReaderController.cs +++ b/API/Controllers/ReaderController.cs @@ -66,7 +66,7 @@ namespace API.Controllers user.Progresses.Add(new AppUserProgress { - PagesRead = bookmarkDto.PageNum, // TODO: PagesRead is misleading. Should it be PageNumber or PagesRead (+1)? + PagesRead = bookmarkDto.PageNum, VolumeId = bookmarkDto.VolumeId, SeriesId = bookmarkDto.SeriesId, }); diff --git a/API/Services/CacheService.cs b/API/Services/CacheService.cs index 0c69abae8..ae92e3261 100644 --- a/API/Services/CacheService.cs +++ b/API/Services/CacheService.cs @@ -110,10 +110,9 @@ namespace API.Services { var path = GetVolumeCachePath(volume.Id, mangaFile); var files = DirectoryService.GetFiles(path); - var array = files.ToArray(); - Array.Sort(array, _numericComparer); // TODO: Find a way to apply numericComparer to IList. + Array.Sort(files, _numericComparer); - return array.ElementAt(page - pagesSoFar); + return files.ElementAt(page - pagesSoFar); } pagesSoFar += mangaFile.NumberOfPages; diff --git a/API/Services/DirectoryService.cs b/API/Services/DirectoryService.cs index 25c6349c9..a67cd66a2 100644 --- a/API/Services/DirectoryService.cs +++ b/API/Services/DirectoryService.cs @@ -51,9 +51,9 @@ namespace API.Services reSearchPattern.IsMatch(Path.GetExtension(file))); } - public static IList GetFiles(string path) + public static string[] GetFiles(string path) { - if (!Directory.Exists(path)) return ImmutableList.Empty; + if (!Directory.Exists(path)) return Array.Empty(); return Directory.GetFiles(path); }