From d9a7eeb5c359f07918773d31592d755fa3742924 Mon Sep 17 00:00:00 2001 From: glax Date: Sat, 20 May 2023 02:42:36 +0200 Subject: [PATCH] Why is it so complicated to multiply some numbers --- Tranga/Chapter.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Tranga/Chapter.cs b/Tranga/Chapter.cs index 0c4acf0..7d3e91a 100644 --- a/Tranga/Chapter.cs +++ b/Tranga/Chapter.cs @@ -18,7 +18,7 @@ public struct Chapter public Chapter(string? name, string? volumeNumber, string? chapterNumber, string url) { this.name = name; - this.volumeNumber = volumeNumber; + this.volumeNumber = volumeNumber is { Length: > 0 } ? volumeNumber : "1"; this.chapterNumber = chapterNumber; this.url = url; string chapterName = string.Concat((name ?? "").Split(Path.GetInvalidFileNameChars())); @@ -26,7 +26,7 @@ public struct Chapter { 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); this.fileName = $"{chapterName} - V{volumeNumber}C{chapterNumber} - {sortNumber}"; }