Tranga-Website/Tranga/Chapter.cs

24 lines
863 B
C#
Raw Normal View History

2023-05-18 20:06:29 +02:00
using System.Globalization;
namespace Tranga;
public struct Chapter
{
public string? name { get; }
public string? volumeNumber { get; }
public string? chapterNumber { get; }
public string url { get; }
public string fileName { get; }
public Chapter(string? name, string? volumeNumber, string? chapterNumber, string url)
{
this.name = name;
this.volumeNumber = volumeNumber;
this.chapterNumber = chapterNumber;
this.url = url;
2023-05-18 20:06:29 +02:00
string chapterName = string.Concat((name ?? "").Split(Path.GetInvalidFileNameChars()));
2023-05-18 20:07:47 +02:00
double multiplied = Convert.ToDouble(chapterNumber, new NumberFormatInfo() { NumberDecimalSeparator = "." }) *
2023-05-18 20:06:29 +02:00
Convert.ToInt32(volumeNumber);
this.fileName = $"{chapterName} - V{volumeNumber}C{chapterNumber} - {multiplied}";
}
}