From b099da115642458d01cefae55a4c3bc47606f21f Mon Sep 17 00:00:00 2001 From: glax Date: Wed, 28 Jun 2023 00:13:23 +0200 Subject: [PATCH] Chapter fix RegexMatching on chapter number --- Tranga/Chapter.cs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/Tranga/Chapter.cs b/Tranga/Chapter.cs index 56687c4..3dcd0ce 100644 --- a/Tranga/Chapter.cs +++ b/Tranga/Chapter.cs @@ -45,15 +45,14 @@ public struct Chapter if (!Directory.Exists(Path.Join(downloadLocation, parentPublication.folderName))) return false; FileInfo[] archives = new DirectoryInfo(Path.Join(downloadLocation, parentPublication.folderName)).GetFiles(); - Regex infoRex = new(@"(Vol.[0-9]*)?Ch.[0-9]+"); - Regex chapterInfoRex = new(@"Ch.[0-9]+"); - Regex chapterRex = new(@"[0-9]+"); + Regex chapterInfoRex = new(@"Ch\.[0-9.]+"); + Regex chapterRex = new(@"[0-9]+(\.[0-9]+)?"); if (File.Exists(newFilePath)) return true; string cn = this.chapterNumber; - if (archives.FirstOrDefault(archive => chapterRex.Match(chapterInfoRex.Match(infoRex.Match(archive.Name).Value).Value).Value == cn) is { } path) + if (archives.FirstOrDefault(archive => chapterRex.Match(chapterInfoRex.Match(archive.Name).Value).Value == cn) is { } path) { File.Move(path.FullName, newFilePath); return true;