Changed progress type from float to double

This commit is contained in:
glax 2023-06-10 15:58:11 +02:00
parent 41929e0c72
commit 6eaba07801
2 changed files with 4 additions and 4 deletions

View File

@ -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;
}

View File

@ -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;