[cuttingedge] fix(Chapter): Minor logic change to account for all chapterName cases

This commit is contained in:
Alessandro Benetton 2025-03-02 16:06:21 +01:00
parent 9a066e7ac7
commit c6bb1c9180
No known key found for this signature in database
GPG Key ID: ED63A304CE2C0303

View File

@ -102,9 +102,14 @@ public readonly struct Chapter : IComparable
mangaArchive = archives.FirstOrDefault(archive => mangaArchive = archives.FirstOrDefault(archive =>
{ {
Match m = volChRex.Match(archive.Name); Match m = volChRex.Match(archive.Name);
/*
* 1. If the volumeNumber is not present in the filename, it is not checked.
* 2. Check the chapterNumber in the chapter against the one in the filename.
* 3. The chpaterName has to either be absent both in the chapter and the filename or match.
*/
return (!m.Groups[1].Success || m.Groups[1].Value == t.volumeNumber.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) && m.Groups[2].Value == t.chapterNumber.ToString(GlobalBase.numberFormatDecimalPoint) &&
(t.name == null || m.Groups[3].Value == t.name); ((!m.Groups[3].Success && string.IsNullOrEmpty(t.name)) || m.Groups[3].Value == t.name);
}); });
} }