mirror of
https://github.com/C9Glax/tranga.git
synced 2025-07-09 14:46:05 +02:00
Moved filenaming to Chapter struct
This commit is contained in:
Tranga
@ -1,4 +1,6 @@
|
||||
namespace Tranga;
|
||||
using System.Globalization;
|
||||
|
||||
namespace Tranga;
|
||||
|
||||
public struct Chapter
|
||||
{
|
||||
@ -10,13 +12,16 @@ public struct Chapter
|
||||
|
||||
public string fileName { get; }
|
||||
|
||||
public Chapter(Publication publication, string? name, string? volumeNumber, string? chapterNumber, string url, string fileName)
|
||||
public Chapter(Publication publication, string? name, string? volumeNumber, string? chapterNumber, string url)
|
||||
{
|
||||
this.publication = publication;
|
||||
this.name = name;
|
||||
this.volumeNumber = volumeNumber;
|
||||
this.chapterNumber = chapterNumber;
|
||||
this.url = url;
|
||||
this.fileName = fileName;
|
||||
string chapterName = string.Concat((name ?? "").Split(Path.GetInvalidFileNameChars()));
|
||||
double multiplied = Convert.ToDouble(chapterName, new NumberFormatInfo() { NumberDecimalSeparator = "." }) *
|
||||
Convert.ToInt32(volumeNumber);
|
||||
this.fileName = $"{chapterName} - V{volumeNumber}C{chapterNumber} - {multiplied}";
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user