2
0

I hate floating point

This commit is contained in:
glax 2023-05-20 02:10:10 +02:00
parent 3ff2ac1043
commit 658b93bc51

View File

@ -21,6 +21,11 @@ public struct Chapter
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()));
this.fileName = $"{chapterName} - V{volumeNumber}C{chapterNumber} - {volumeNumber}{chapterNumber}"; NumberFormatInfo nfi = new NumberFormatInfo()
{
NumberDecimalSeparator = "."
};
decimal orderNumber = Math.Floor(Convert.ToDecimal(volumeNumber) * Convert.ToDecimal(chapterNumber, nfi));
this.fileName = $"{chapterName} - V{volumeNumber}C{chapterNumber} - {orderNumber.ToString(nfi)}";
} }
} }