2
0

Compare commits

..

3 Commits

Author SHA1 Message Date
3b9d4a6735 Merge branch 'refs/heads/cuttingedge-merge-ServerV2' into Server-V2 2024-09-11 14:41:49 +02:00
7d3deee74c Remove unused constant 2024-09-11 14:40:28 +02:00
5980b64caa Readable Chapter comparison 2024-09-11 14:40:03 +02:00
2 changed files with 15 additions and 21 deletions

View File

@ -58,29 +58,24 @@ public readonly struct Chapter : IComparable
public int CompareTo(object? obj) public int CompareTo(object? obj)
{ {
if (obj is Chapter otherChapter) if(obj is not Chapter otherChapter)
throw new ArgumentException($"{obj} can not be compared to {this}");
if (float.TryParse(volumeNumber, GlobalBase.numberFormatDecimalPoint, out float volumeNumberFloat) &&
float.TryParse(chapterNumber, GlobalBase.numberFormatDecimalPoint, out float chapterNumberFloat) &&
float.TryParse(otherChapter.volumeNumber, GlobalBase.numberFormatDecimalPoint,
out float otherVolumeNumberFloat) &&
float.TryParse(otherChapter.chapterNumber, GlobalBase.numberFormatDecimalPoint,
out float otherChapterNumberFloat))
{ {
if (float.TryParse(volumeNumber, GlobalBase.numberFormatDecimalPoint, out float volumeNumberFloat) && return volumeNumberFloat.CompareTo(otherVolumeNumberFloat) switch
float.TryParse(chapterNumber, GlobalBase.numberFormatDecimalPoint, out float chapterNumberFloat) &&
float.TryParse(otherChapter.volumeNumber, GlobalBase.numberFormatDecimalPoint,
out float otherVolumeNumberFloat) &&
float.TryParse(otherChapter.chapterNumber, GlobalBase.numberFormatDecimalPoint,
out float otherChapterNumberFloat))
{ {
<0 => -1,
switch (volumeNumberFloat.CompareTo(otherVolumeNumberFloat)) >0 => 1,
{ _ => chapterNumberFloat.CompareTo(otherChapterNumberFloat)
case < 0: };
return -1;
case > 0:
return 1;
default:
return chapterNumberFloat.CompareTo(otherChapterNumberFloat);
}
}
else throw new FormatException($"Value could not be parsed");
} }
throw new ArgumentException($"{obj} can not be compared to {this}"); else throw new FormatException($"Value could not be parsed");
} }
/// <summary> /// <summary>

View File

@ -9,7 +9,6 @@ namespace Tranga.MangaConnectors;
internal class ChromiumDownloadClient : DownloadClient internal class ChromiumDownloadClient : DownloadClient
{ {
private IBrowser browser { get; set; } private IBrowser browser { get; set; }
private const string ChromiumVersion = "1154303";
private const int StartTimeoutMs = 30000; private const int StartTimeoutMs = 30000;
private readonly HttpDownloadClient _httpDownloadClient; private readonly HttpDownloadClient _httpDownloadClient;