From 84272ddd1e3086c91a39b7fa88a47554899a293b Mon Sep 17 00:00:00 2001 From: Glax Date: Wed, 7 Feb 2024 18:08:57 +0100 Subject: [PATCH] https://github.com/C9Glax/tranga/issues/111#issuecomment-1932447848 --- Tranga/Chapter.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Tranga/Chapter.cs b/Tranga/Chapter.cs index 12151f7..8d0622c 100644 --- a/Tranga/Chapter.cs +++ b/Tranga/Chapter.cs @@ -91,13 +91,13 @@ public readonly struct Chapter : IComparable if (!Directory.Exists(Path.Join(downloadLocation, parentManga.folderName))) return false; FileInfo[] archives = new DirectoryInfo(Path.Join(downloadLocation, parentManga.folderName)).GetFiles(); - Regex volChRex = new(@".*Vol(?:ume)?\.?([0-9]+).*Ch(?:apter)?\.?([0-9]+[\.0-9]*).*"); + Regex volChRex = new(@"(?:Vol(?:ume)?.*([0-9]+).*)?Ch(?:apter)?.*([0-9]+[\.0-9]*)"); Chapter t = this; return archives.Select(archive => archive.Name).Any(archiveFileName => { Match m = volChRex.Match(archiveFileName); - string archiveVolNum = m.Groups[1].Value; + string archiveVolNum = m.Groups[1].Success ? m.Groups[1].Value : "0"; string archiveChNum = m.Groups[2].Value; return archiveVolNum == t.volumeNumber && archiveChNum == t.chapterNumber;