Added field sortNumber to chapter

This commit is contained in:
glax 2023-05-20 02:39:23 +02:00
parent 0afbfb6010
commit e0784b2c38
2 changed files with 5 additions and 3 deletions

View File

@ -13,6 +13,7 @@ public struct Chapter
public string? chapterNumber { get; } public string? chapterNumber { get; }
public string url { get; } public string url { get; }
public string fileName { get; } public string fileName { get; }
public string sortNumber { get; }
public Chapter(string? name, string? volumeNumber, string? chapterNumber, string url) public Chapter(string? name, string? volumeNumber, string? chapterNumber, string url)
{ {
@ -25,7 +26,8 @@ public struct Chapter
{ {
NumberDecimalSeparator = "." NumberDecimalSeparator = "."
}; };
decimal orderNumber = Convert.ToDecimal(volumeNumber) * Convert.ToDecimal(chapterNumber, nfi); sortNumber = decimal.Round(Convert.ToDecimal(volumeNumber) * Convert.ToDecimal(chapterNumber, nfi), 1)
this.fileName = $"{chapterName} - V{volumeNumber}C{chapterNumber} - {decimal.Round(orderNumber, 1).ToString(nfi)}"; .ToString(nfi);
this.fileName = $"{chapterName} - V{volumeNumber}C{chapterNumber} - {sortNumber}";
} }
} }

View File

@ -75,7 +75,7 @@ public abstract class Connector
new XElement("LanguageISO", publication.originalLanguage), new XElement("LanguageISO", publication.originalLanguage),
new XElement("Title", chapter.name), new XElement("Title", chapter.name),
new XElement("Volume", chapter.volumeNumber), new XElement("Volume", chapter.volumeNumber),
new XElement("Number", chapter.chapterNumber) new XElement("Number", chapter.sortNumber)
); );
return comicInfo.ToString(); return comicInfo.ToString();
} }