diff --git a/Tranga/Connectors/Connector.cs b/Tranga/Connectors/Connector.cs index 391eaa9..997aeec 100644 --- a/Tranga/Connectors/Connector.cs +++ b/Tranga/Connectors/Connector.cs @@ -77,8 +77,8 @@ public abstract class Connector public Chapter[] SelectChapters(Publication publication, string searchTerm, string? language = null) { Chapter[] availableChapters = this.GetChapters(publication, language??"en"); - Regex volumeRegex = new ("((v(ol)*(olume)*)+ *([0-9]+(-[0-9]+)?){1})", RegexOptions.IgnoreCase); - Regex chapterRegex = new ("((c(h)*(hapter)*)+ *([0-9]+(-[0-9]+)?){1})", RegexOptions.IgnoreCase); + Regex volumeRegex = new ("((v(ol)*(olume)*){1} *([0-9]+(-[0-9]+)?){1})", RegexOptions.IgnoreCase); + Regex chapterRegex = new ("((c(h)*(hapter)*){1} *([0-9]+(-[0-9]+)?){1})", RegexOptions.IgnoreCase); Regex singleResultRegex = new("([0-9]+)", RegexOptions.IgnoreCase); Regex rangeResultRegex = new("([0-9]+(-[0-9]+))", RegexOptions.IgnoreCase); Regex allRegex = new("a(ll)?", RegexOptions.IgnoreCase); @@ -114,7 +114,7 @@ public abstract class Connector } else if (chapterRegex.IsMatch(searchTerm)) { - string chapter = volumeRegex.Match(searchTerm).Value; + string chapter = chapterRegex.Match(searchTerm).Value; if (rangeResultRegex.IsMatch(chapter)) { string range = rangeResultRegex.Match(chapter).Value; diff --git a/Tranga/Migrator.cs b/Tranga/Migrator.cs index 7cf86f3..0ac0e91 100644 --- a/Tranga/Migrator.cs +++ b/Tranga/Migrator.cs @@ -9,7 +9,7 @@ namespace Tranga; public static class Migrator { - private static readonly ushort CurrentVersion = 17; + internal static readonly ushort CurrentVersion = 17; public static void Migrate(string settingsFilePath, Logger? logger) { if (!File.Exists(settingsFilePath)) diff --git a/Tranga/Tranga.cs b/Tranga/Tranga.cs index 63a51ae..997a787 100644 --- a/Tranga/Tranga.cs +++ b/Tranga/Tranga.cs @@ -38,8 +38,12 @@ public static class Tranga { logger.WriteLine("Tranga", $"Loading settings {settingsFilePath}"); settings = TrangaSettings.LoadSettings(settingsFilePath); - }else + } + else + { settings = new TrangaSettings(downloadFolderPath, applicationFolderPath); + settings.version = Migrator.CurrentVersion; + } Directory.CreateDirectory(settings.workingDirectory); Directory.CreateDirectory(settings.downloadLocation);