From a3a96b6b55c440dfa15674378effa220bec1118d Mon Sep 17 00:00:00 2001 From: glax Date: Fri, 9 Jun 2023 23:38:28 +0200 Subject: [PATCH] Added DecrementProgress function to TrangaTask --- Tranga/TrangaTask.cs | 7 +++++++ Tranga/TrangaTasks/DownloadNewChaptersTask.cs | 7 +++++++ 2 files changed, 14 insertions(+) diff --git a/Tranga/TrangaTask.cs b/Tranga/TrangaTask.cs index a0d51ec..710c396 100644 --- a/Tranga/TrangaTask.cs +++ b/Tranga/TrangaTask.cs @@ -58,6 +58,13 @@ public abstract class TrangaTask this.lastChange = DateTime.Now; return this.progress; } + + public float DecrementProgress(float amount) + { + this.progress -= amount; + this.lastChange = DateTime.Now; + return this.progress; + } /// /// BL for concrete Tasks diff --git a/Tranga/TrangaTasks/DownloadNewChaptersTask.cs b/Tranga/TrangaTasks/DownloadNewChaptersTask.cs index 6db6572..1d1caa0 100644 --- a/Tranga/TrangaTasks/DownloadNewChaptersTask.cs +++ b/Tranga/TrangaTasks/DownloadNewChaptersTask.cs @@ -24,6 +24,13 @@ public class DownloadNewChaptersTask : TrangaTask this.lastChange = DateTime.Now; return this.progress; } + + public new float DecrementProgress(float amount) + { + this.progress -= amount / this.childTaskAmount; + this.lastChange = DateTime.Now; + return this.progress; + } protected override void ExecuteTask(TaskManager taskManager, Logger? logger) {