Cleanup build warnings, ReShaper, Dictionary

This commit is contained in:
2023-07-30 17:25:04 +02:00
parent d83aa1ef5b
commit 1afa3df316
19 changed files with 84 additions and 58 deletions

View File

@ -9,10 +9,11 @@ public class DownloadChapterTask : TrangaTask
{
public string connectorName { get; }
public Publication publication { get; }
// ReSharper disable once MemberCanBePrivate.Global
public string language { get; }
public Chapter chapter { get; }
private double _dctProgress = 0;
private double _dctProgress;
public DownloadChapterTask(string connectorName, Publication publication, Chapter chapter, string language = "en", MonitorPublicationTask? parentTask = null) : base(Task.DownloadChapter, TimeSpan.Zero, parentTask)
{
@ -27,7 +28,7 @@ public class DownloadChapterTask : TrangaTask
if (cancellationToken?.IsCancellationRequested ?? false)
return HttpStatusCode.RequestTimeout;
Connector connector = taskManager.GetConnector(this.connectorName);
connector.CopyCoverFromCacheToDownloadLocation(this.publication, taskManager.settings);
connector.CopyCoverFromCacheToDownloadLocation(this.publication);
HttpStatusCode downloadSuccess = connector.DownloadChapter(this.publication, this.chapter, this, cancellationToken);
if ((int)downloadSuccess >= 200 && (int)downloadSuccess < 300)
{

View File

@ -7,6 +7,7 @@ public class MonitorPublicationTask : TrangaTask
{
public string connectorName { get; }
public Publication publication { get; }
// ReSharper disable once MemberCanBePrivate.Global
public string language { get; }
public MonitorPublicationTask(string connectorName, Publication publication, TimeSpan reoccurrence, string language = "en") : base(Task.MonitorPublication, reoccurrence)
{
@ -25,7 +26,7 @@ public class MonitorPublicationTask : TrangaTask
publication.CreatePublicationFolder(taskManager.settings.downloadLocation);
List<Chapter> newChapters = connector.GetNewChaptersList(publication, language, ref taskManager.collection);
connector.CopyCoverFromCacheToDownloadLocation(publication, taskManager.settings);
connector.CopyCoverFromCacheToDownloadLocation(publication);
publication.SaveSeriesInfoJson(taskManager.settings.downloadLocation);

View File

@ -1,6 +1,5 @@
using System.Net;
using System.Text.Json.Serialization;
using Logging;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using JsonConverter = Newtonsoft.Json.JsonConverter;
@ -15,8 +14,7 @@ namespace Tranga.TrangaTasks;
[JsonDerivedType(typeof(DownloadChapterTask), 4)]
public abstract class TrangaTask
{
// ReSharper disable once CommentTypo ...Tell me why!
// ReSharper disable once MemberCanBePrivate.Global I want it thaaat way
// ReSharper disable once MemberCanBeProtected.Global
public TimeSpan reoccurrence { get; }
public DateTime lastExecuted { get; set; }
[Newtonsoft.Json.JsonIgnore] public ExecutionState state { get; set; }
@ -26,9 +24,12 @@ public abstract class TrangaTask
public string? parentTaskId { get; set; }
[Newtonsoft.Json.JsonIgnore] internal HashSet<TrangaTask> childTasks { get; }
public double progress => GetProgress();
// ReSharper disable once MemberCanBePrivate.Global
[Newtonsoft.Json.JsonIgnore]public DateTime executionStarted { get; private set; }
[Newtonsoft.Json.JsonIgnore]public DateTime lastChange { get; internal set; }
// ReSharper disable once MemberCanBePrivate.Global
[Newtonsoft.Json.JsonIgnore]public DateTime executionApproximatelyFinished => lastChange.Add(GetRemainingTime());
// ReSharper disable once MemberCanBePrivate.Global
public TimeSpan executionApproximatelyRemaining => executionApproximatelyFinished.Subtract(DateTime.Now);
[Newtonsoft.Json.JsonIgnore]public DateTime nextExecution => lastExecuted.Add(reoccurrence);

View File

@ -1,5 +1,4 @@
using System.Net;
using Logging;
namespace Tranga.TrangaTasks;