From 6eaba0780147aee591df074b9a7ca455a62cd5e2 Mon Sep 17 00:00:00 2001 From: glax Date: Sat, 10 Jun 2023 15:58:11 +0200 Subject: [PATCH] Changed progress type from float to double --- Tranga/Connector.cs | 2 +- Tranga/TrangaTask.cs | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Tranga/Connector.cs b/Tranga/Connector.cs index 2f91f79..f729dae 100644 --- a/Tranga/Connector.cs +++ b/Tranga/Connector.cs @@ -252,7 +252,7 @@ public abstract class Connector string extension = split[^1]; logger?.WriteLine("Connector", $"Downloading Image {chapter + 1:000}/{imageUrls.Length:000} {parentTask.publication.sortName} {parentTask.publication.internalId} Vol.{parentTask.chapter.volumeNumber} Ch.{parentTask.chapter.chapterNumber} {parentTask.progress:P2}"); DownloadImage(imageUrl, Path.Join(tempFolder, $"{chapter++}.{extension}"), requestType, referrer); - parentTask.IncrementProgress(1f / imageUrls.Length); + parentTask.IncrementProgress(1.0 / imageUrls.Length); if (cancellationToken?.IsCancellationRequested??false) return; } diff --git a/Tranga/TrangaTask.cs b/Tranga/TrangaTask.cs index 73d70fd..53e509e 100644 --- a/Tranga/TrangaTask.cs +++ b/Tranga/TrangaTask.cs @@ -21,7 +21,7 @@ public abstract class TrangaTask public DateTime lastExecuted { get; set; } public Task task { get; } [Newtonsoft.Json.JsonIgnore]public ExecutionState state { get; set; } - [Newtonsoft.Json.JsonIgnore]public float progress { get; protected set; } + [Newtonsoft.Json.JsonIgnore]public double progress { get; protected set; } [Newtonsoft.Json.JsonIgnore]public DateTime nextExecution => lastExecuted.Add(reoccurrence); [Newtonsoft.Json.JsonIgnore]public DateTime executionStarted { get; private set; } @@ -52,14 +52,14 @@ public abstract class TrangaTask this.lastChange = DateTime.MaxValue; } - public float IncrementProgress(float amount) + public double IncrementProgress(double amount) { this.progress += amount; this.lastChange = DateTime.Now; return this.progress; } - public float DecrementProgress(float amount) + public double DecrementProgress(double amount) { this.progress -= amount; this.lastChange = DateTime.Now;