From 9a066e7ac7dade3662a55ddf736bbd61037d3fe5 Mon Sep 17 00:00:00 2001 From: Alessandro Benetton Date: Sun, 2 Mar 2025 15:57:09 +0100 Subject: [PATCH] [cuttingedge] fix(Weebcentral): Updated CheckChapterIsDownloaded logic to also consider chapter name if present --- Tranga/Chapter.cs | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/Tranga/Chapter.cs b/Tranga/Chapter.cs index a4fa2c8..20ff851 100644 --- a/Tranga/Chapter.cs +++ b/Tranga/Chapter.cs @@ -96,17 +96,15 @@ public readonly struct Chapter : IComparable if(mangaArchive is null) { FileInfo[] archives = new DirectoryInfo(mangaDirectory).GetFiles("*.cbz"); - Regex volChRex = new(@"(?:Vol(?:ume)?\.([0-9]+)\D*)?Ch(?:apter)?\.([0-9]+(?:\.[0-9]+)*)"); + Regex volChRex = new(@"(?:Vol(?:ume)?\.([0-9]+)\D*)?Ch(?:apter)?\.([0-9]+(?:\.[0-9]+)*)(?: - (.*))?.cbz"); Chapter t = this; mangaArchive = archives.FirstOrDefault(archive => { Match m = volChRex.Match(archive.Name); - if (m.Groups[1].Success) - return m.Groups[1].Value == t.volumeNumber.ToString(GlobalBase.numberFormatDecimalPoint) && - m.Groups[2].Value == t.chapterNumber.ToString(GlobalBase.numberFormatDecimalPoint); - else - return m.Groups[2].Value == t.chapterNumber.ToString(GlobalBase.numberFormatDecimalPoint); + return (!m.Groups[1].Success || m.Groups[1].Value == t.volumeNumber.ToString(GlobalBase.numberFormatDecimalPoint)) && + m.Groups[2].Value == t.chapterNumber.ToString(GlobalBase.numberFormatDecimalPoint) && + (t.name == null || m.Groups[3].Value == t.name); }); }