2
0

Why is it so complicated to multiply some numbers

This commit is contained in:
glax 2023-05-20 02:42:36 +02:00
parent e0784b2c38
commit 22a5120c19

View File

@ -18,7 +18,7 @@ public struct Chapter
public Chapter(string? name, string? volumeNumber, string? chapterNumber, string url) public Chapter(string? name, string? volumeNumber, string? chapterNumber, string url)
{ {
this.name = name; this.name = name;
this.volumeNumber = volumeNumber; this.volumeNumber = volumeNumber is { Length: > 0 } ? volumeNumber : "1";
this.chapterNumber = chapterNumber; this.chapterNumber = chapterNumber;
this.url = url; this.url = url;
string chapterName = string.Concat((name ?? "").Split(Path.GetInvalidFileNameChars())); string chapterName = string.Concat((name ?? "").Split(Path.GetInvalidFileNameChars()));
@ -26,7 +26,7 @@ public struct Chapter
{ {
NumberDecimalSeparator = "." NumberDecimalSeparator = "."
}; };
sortNumber = decimal.Round(Convert.ToDecimal(volumeNumber) * Convert.ToDecimal(chapterNumber, nfi), 1) sortNumber = decimal.Round(Convert.ToDecimal(this.volumeNumber) * Convert.ToDecimal(this.chapterNumber, nfi), 1)
.ToString(nfi); .ToString(nfi);
this.fileName = $"{chapterName} - V{volumeNumber}C{chapterNumber} - {sortNumber}"; this.fileName = $"{chapterName} - V{volumeNumber}C{chapterNumber} - {sortNumber}";
} }