2
0

Merge pull request '#31 #40' (!52) from cuttingedge into master

Reviewed-on: #52
This commit is contained in:
glax 2023-07-31 22:50:22 +02:00
commit 00c1cd56b8
3 changed files with 9 additions and 5 deletions

View File

@ -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;

View File

@ -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))

View File

@ -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);