2023-06-03 15:17:08 +02:00
|
|
|
|
using Logging;
|
|
|
|
|
|
|
|
|
|
namespace Tranga.TrangaTasks;
|
|
|
|
|
|
|
|
|
|
public class UpdateLibrariesTask : TrangaTask
|
|
|
|
|
{
|
2023-06-20 14:57:44 +02:00
|
|
|
|
public UpdateLibrariesTask(TimeSpan reoccurrence) : base(Task.UpdateLibraries, reoccurrence)
|
2023-06-03 15:17:08 +02:00
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2023-06-20 14:57:44 +02:00
|
|
|
|
protected override bool ExecuteTask(TaskManager taskManager, Logger? logger, CancellationToken? cancellationToken = null)
|
2023-06-03 15:17:08 +02:00
|
|
|
|
{
|
2023-06-10 14:27:09 +02:00
|
|
|
|
if (cancellationToken?.IsCancellationRequested??false)
|
2023-06-20 14:57:44 +02:00
|
|
|
|
return false;
|
2023-06-03 15:17:08 +02:00
|
|
|
|
foreach(LibraryManager lm in taskManager.settings.libraryManagers)
|
|
|
|
|
lm.UpdateLibrary();
|
2023-06-20 14:57:44 +02:00
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override TrangaTask Clone()
|
|
|
|
|
{
|
|
|
|
|
return new UpdateLibrariesTask(this.reoccurrence);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override double GetProgress()
|
|
|
|
|
{
|
|
|
|
|
return 1;
|
2023-06-03 15:17:08 +02:00
|
|
|
|
}
|
|
|
|
|
}
|