From d191f5dfc7ef8c8172c1fe99784910f161be5375 Mon Sep 17 00:00:00 2001 From: glax <--local> Date: Thu, 18 May 2023 18:42:36 +0200 Subject: [PATCH] moved fileName to Chapter for future checking if file exists. --- Tranga/Chapter.cs | 5 ++++- Tranga/Connectors/MangaDex.cs | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/Tranga/Chapter.cs b/Tranga/Chapter.cs index b167980..f51eaa1 100644 --- a/Tranga/Chapter.cs +++ b/Tranga/Chapter.cs @@ -7,13 +7,16 @@ public struct Chapter public string? volumeNumber { get; } public string? chapterNumber { get; } public string url { get; } + + public string relativeFilePath { get; } - public Chapter(Publication publication, string? name, string? volumeNumber, string? chapterNumber, string url) + public Chapter(Publication publication, string? name, string? volumeNumber, string? chapterNumber, string url, string relativeFilePath) { this.publication = publication; this.name = name; this.volumeNumber = volumeNumber; this.chapterNumber = chapterNumber; this.url = url; + this.relativeFilePath = relativeFilePath; } } \ No newline at end of file diff --git a/Tranga/Connectors/MangaDex.cs b/Tranga/Connectors/MangaDex.cs index eafd051..177fda9 100644 --- a/Tranga/Connectors/MangaDex.cs +++ b/Tranga/Connectors/MangaDex.cs @@ -149,7 +149,10 @@ public class MangaDex : Connector ? attributes["chapter"]!.GetValue() : null; - chapters.Add(new Chapter(publication, title, volume, chapterNum, chapterId)); + string chapterName = string.Concat((title ?? "").Split(Path.GetInvalidFileNameChars())); + string relativeFilePath = $"{chapterName} - V{volume}C{chapterNum}"; + + chapters.Add(new Chapter(publication, title, volume, chapterNum, chapterId, relativeFilePath)); } }