2023-05-20 22:10:24 +02:00
|
|
|
|
using Logging;
|
|
|
|
|
using Newtonsoft.Json;
|
2023-05-19 16:23:37 +02:00
|
|
|
|
using Tranga.Connectors;
|
2023-05-19 14:15:00 +02:00
|
|
|
|
|
|
|
|
|
namespace Tranga;
|
2023-05-17 23:23:01 +02:00
|
|
|
|
|
2023-05-19 20:03:17 +02:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Manages all TrangaTasks.
|
|
|
|
|
/// Provides a Threaded environment to execute Tasks, and still manage the Task-Collection
|
|
|
|
|
/// </summary>
|
2023-05-17 23:23:01 +02:00
|
|
|
|
public class TaskManager
|
|
|
|
|
{
|
2023-05-20 14:18:17 +02:00
|
|
|
|
private readonly Dictionary<Publication, List<Chapter>> _chapterCollection = new();
|
2023-05-18 19:25:46 +02:00
|
|
|
|
private readonly HashSet<TrangaTask> _allTasks;
|
2023-05-17 23:23:01 +02:00
|
|
|
|
private bool _continueRunning = true;
|
2023-05-20 01:06:00 +02:00
|
|
|
|
private readonly Connector[] _connectors;
|
2023-05-21 03:04:32 +02:00
|
|
|
|
private readonly Dictionary<Connector, List<TrangaTask>> _taskQueue = new();
|
2023-05-21 15:05:53 +02:00
|
|
|
|
public SettingsData settings { get; }
|
2023-05-20 22:10:24 +02:00
|
|
|
|
private Logger? logger { get; }
|
2023-05-20 14:07:38 +02:00
|
|
|
|
|
2023-05-20 22:10:24 +02:00
|
|
|
|
public Komga? komga { get; }
|
2023-05-19 16:27:56 +02:00
|
|
|
|
|
2023-05-21 15:05:53 +02:00
|
|
|
|
/// <param name="downloadFolderPath">Local path to save data (Manga) to</param>
|
|
|
|
|
/// <param name="settingsFilePath">Path to the settings file (data.json)</param>
|
2023-05-20 12:53:19 +02:00
|
|
|
|
/// <param name="komgaBaseUrl">The Url of the Komga-instance that you want to update</param>
|
2023-05-20 15:05:41 +02:00
|
|
|
|
/// <param name="komgaUsername">The Komga username</param>
|
|
|
|
|
/// <param name="komgaPassword">The Komga password</param>
|
2023-05-20 22:10:24 +02:00
|
|
|
|
/// <param name="logger"></param>
|
2023-05-21 15:05:53 +02:00
|
|
|
|
public TaskManager(string downloadFolderPath, string? settingsFilePath = null, string? komgaBaseUrl = null, string? komgaUsername = null, string? komgaPassword = null, Logger? logger = null)
|
2023-05-17 23:23:01 +02:00
|
|
|
|
{
|
2023-05-20 22:10:24 +02:00
|
|
|
|
this.logger = logger;
|
2023-05-21 15:05:53 +02:00
|
|
|
|
_allTasks = new HashSet<TrangaTask>();
|
|
|
|
|
if (komgaBaseUrl != null && komgaUsername != null && komgaPassword != null)
|
|
|
|
|
this.komga = new Komga(komgaBaseUrl, komgaUsername, komgaPassword, logger);
|
|
|
|
|
|
|
|
|
|
this.settings = new SettingsData(downloadFolderPath, settingsFilePath, this.komga, this._allTasks);
|
2023-05-21 15:14:25 +02:00
|
|
|
|
ExportData();
|
|
|
|
|
|
2023-05-21 15:05:53 +02:00
|
|
|
|
this._connectors = new Connector[]{ new MangaDex(downloadFolderPath, logger) };
|
2023-05-20 14:50:48 +02:00
|
|
|
|
foreach(Connector cConnector in this._connectors)
|
2023-05-21 03:04:32 +02:00
|
|
|
|
_taskQueue.Add(cConnector, new List<TrangaTask>());
|
2023-05-20 12:53:19 +02:00
|
|
|
|
|
|
|
|
|
Thread taskChecker = new(TaskCheckerThread);
|
|
|
|
|
taskChecker.Start();
|
|
|
|
|
}
|
|
|
|
|
|
2023-05-20 22:10:24 +02:00
|
|
|
|
public TaskManager(SettingsData settings, Logger? logger = null)
|
2023-05-20 12:53:19 +02:00
|
|
|
|
{
|
2023-05-20 22:10:24 +02:00
|
|
|
|
this.logger = logger;
|
|
|
|
|
this._connectors = new Connector[]{ new MangaDex(settings.downloadLocation, logger) };
|
2023-05-21 15:05:53 +02:00
|
|
|
|
this.settings = settings;
|
2023-05-21 15:14:25 +02:00
|
|
|
|
ExportData();
|
|
|
|
|
|
2023-05-20 14:50:48 +02:00
|
|
|
|
foreach(Connector cConnector in this._connectors)
|
2023-05-21 03:04:32 +02:00
|
|
|
|
_taskQueue.Add(cConnector, new List<TrangaTask>());
|
2023-05-20 14:07:38 +02:00
|
|
|
|
this.komga = settings.komga;
|
2023-05-20 12:53:19 +02:00
|
|
|
|
_allTasks = settings.allTasks;
|
2023-05-17 23:23:01 +02:00
|
|
|
|
Thread taskChecker = new(TaskCheckerThread);
|
|
|
|
|
taskChecker.Start();
|
|
|
|
|
}
|
|
|
|
|
|
2023-05-20 15:05:41 +02:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Runs continuously until shutdown.
|
|
|
|
|
/// Checks if tasks have to be executed (time elapsed)
|
|
|
|
|
/// </summary>
|
2023-05-17 23:23:01 +02:00
|
|
|
|
private void TaskCheckerThread()
|
|
|
|
|
{
|
2023-05-21 01:57:56 +02:00
|
|
|
|
logger?.WriteLine(this.GetType().ToString(), "Starting TaskCheckerThread.");
|
2023-05-17 23:23:01 +02:00
|
|
|
|
while (_continueRunning)
|
|
|
|
|
{
|
2023-05-20 15:05:41 +02:00
|
|
|
|
//Check if previous tasks have finished and execute new tasks
|
2023-05-21 03:04:32 +02:00
|
|
|
|
foreach (KeyValuePair<Connector, List<TrangaTask>> connectorTaskQueue in _taskQueue)
|
2023-05-17 23:23:01 +02:00
|
|
|
|
{
|
2023-05-21 01:58:24 +02:00
|
|
|
|
if(connectorTaskQueue.Value.RemoveAll(task => task.state == TrangaTask.ExecutionState.Waiting) > 0)
|
2023-05-21 15:05:53 +02:00
|
|
|
|
ExportData();
|
2023-05-21 01:58:24 +02:00
|
|
|
|
|
|
|
|
|
if (connectorTaskQueue.Value.Count > 0 && connectorTaskQueue.Value.All(task => task.state is TrangaTask.ExecutionState.Enqueued))
|
|
|
|
|
ExecuteTaskNow(connectorTaskQueue.Value.First());
|
2023-05-20 14:50:48 +02:00
|
|
|
|
}
|
|
|
|
|
|
2023-05-20 15:05:41 +02:00
|
|
|
|
//Check if task should be executed
|
|
|
|
|
//Depending on type execute immediately or enqueue
|
2023-05-20 14:50:48 +02:00
|
|
|
|
foreach (TrangaTask task in _allTasks.Where(aTask => aTask.ShouldExecute()))
|
|
|
|
|
{
|
|
|
|
|
task.state = TrangaTask.ExecutionState.Enqueued;
|
|
|
|
|
if(task.connectorName is null)
|
|
|
|
|
ExecuteTaskNow(task);
|
|
|
|
|
else
|
|
|
|
|
{
|
2023-05-20 22:10:24 +02:00
|
|
|
|
logger?.WriteLine(this.GetType().ToString(), $"Task due: {task}");
|
2023-05-21 03:04:32 +02:00
|
|
|
|
_taskQueue[GetConnector(task.connectorName!)].Add(task);
|
2023-05-20 14:50:48 +02:00
|
|
|
|
}
|
2023-05-17 23:23:01 +02:00
|
|
|
|
}
|
|
|
|
|
Thread.Sleep(1000);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2023-05-19 20:03:17 +02:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Forces the execution of a given task
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="task">Task to execute</param>
|
2023-05-19 19:20:44 +02:00
|
|
|
|
public void ExecuteTaskNow(TrangaTask task)
|
|
|
|
|
{
|
2023-05-19 20:02:58 +02:00
|
|
|
|
if (!this._allTasks.Contains(task))
|
|
|
|
|
return;
|
|
|
|
|
|
2023-05-20 22:10:24 +02:00
|
|
|
|
logger?.WriteLine(this.GetType().ToString(), $"Forcing Execution: {task}");
|
2023-05-19 19:20:44 +02:00
|
|
|
|
Task t = new Task(() =>
|
|
|
|
|
{
|
2023-05-20 22:10:24 +02:00
|
|
|
|
TaskExecutor.Execute(this, task, this._chapterCollection, logger);
|
2023-05-19 19:20:44 +02:00
|
|
|
|
});
|
|
|
|
|
t.Start();
|
|
|
|
|
}
|
|
|
|
|
|
2023-05-19 20:03:17 +02:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Creates and adds a new Task to the task-Collection
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="task">TrangaTask.Task to later execute</param>
|
|
|
|
|
/// <param name="connectorName">Name of the connector to use</param>
|
|
|
|
|
/// <param name="publication">Publication to execute Task on, can be null in case of unrelated Task</param>
|
|
|
|
|
/// <param name="reoccurrence">Time-Interval between Executions</param>
|
|
|
|
|
/// <param name="language">language, should Task require parameter. Can be empty</param>
|
|
|
|
|
/// <exception cref="ArgumentException">Is thrown when connectorName is not a available Connector</exception>
|
2023-05-20 14:07:38 +02:00
|
|
|
|
public TrangaTask AddTask(TrangaTask.Task task, string? connectorName, Publication? publication, TimeSpan reoccurrence,
|
2023-05-19 14:15:17 +02:00
|
|
|
|
string language = "")
|
|
|
|
|
{
|
2023-05-21 01:57:56 +02:00
|
|
|
|
logger?.WriteLine(this.GetType().ToString(), $"Adding new Task {task} {connectorName} {publication?.sortName}");
|
2023-05-20 14:07:38 +02:00
|
|
|
|
|
|
|
|
|
TrangaTask newTask;
|
|
|
|
|
if (task == TrangaTask.Task.UpdateKomgaLibrary)
|
2023-05-19 16:35:53 +02:00
|
|
|
|
{
|
2023-05-20 14:07:38 +02:00
|
|
|
|
newTask = new TrangaTask(task, null, null, reoccurrence, language);
|
|
|
|
|
|
|
|
|
|
//Check if same task already exists
|
|
|
|
|
// ReSharper disable once SimplifyLinqExpressionUseAll readabilty
|
|
|
|
|
if (!_allTasks.Any(trangaTask => trangaTask.task == task))
|
|
|
|
|
{
|
|
|
|
|
_allTasks.Add(newTask);
|
|
|
|
|
}
|
2023-05-19 16:35:53 +02:00
|
|
|
|
}
|
2023-05-20 14:07:38 +02:00
|
|
|
|
else
|
|
|
|
|
{
|
2023-05-21 16:22:40 +02:00
|
|
|
|
if(connectorName is null)
|
|
|
|
|
throw new ArgumentException($"connectorName can not be null for task {task}");
|
|
|
|
|
|
2023-05-20 14:07:38 +02:00
|
|
|
|
//Get appropriate Connector from available Connectors for TrangaTask
|
|
|
|
|
Connector? connector = _connectors.FirstOrDefault(c => c.name == connectorName);
|
|
|
|
|
if (connector is null)
|
|
|
|
|
throw new ArgumentException($"Connector {connectorName} is not a known connector.");
|
|
|
|
|
|
|
|
|
|
newTask = new TrangaTask(task, connector.name, publication, reoccurrence, language);
|
|
|
|
|
|
|
|
|
|
//Check if same task already exists
|
|
|
|
|
if (!_allTasks.Any(trangaTask => trangaTask.task == task && trangaTask.connectorName == connector.name &&
|
|
|
|
|
trangaTask.publication?.downloadUrl == publication?.downloadUrl))
|
|
|
|
|
{
|
|
|
|
|
if(task != TrangaTask.Task.UpdatePublications)
|
|
|
|
|
_chapterCollection.Add((Publication)publication!, new List<Chapter>());
|
|
|
|
|
_allTasks.Add(newTask);
|
|
|
|
|
}
|
|
|
|
|
}
|
2023-05-21 01:57:56 +02:00
|
|
|
|
logger?.WriteLine(this.GetType().ToString(), $"Added new Task {newTask.ToString()}");
|
2023-05-21 15:05:53 +02:00
|
|
|
|
ExportData();
|
2023-05-20 14:07:38 +02:00
|
|
|
|
|
2023-05-20 00:36:52 +02:00
|
|
|
|
return newTask;
|
2023-05-19 14:15:17 +02:00
|
|
|
|
}
|
|
|
|
|
|
2023-05-19 20:03:17 +02:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Removes Task from task-collection
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="task">TrangaTask.Task type</param>
|
|
|
|
|
/// <param name="connectorName">Name of Connector that was used</param>
|
|
|
|
|
/// <param name="publication">Publication that was used</param>
|
2023-05-21 03:04:32 +02:00
|
|
|
|
public void DeleteTask(TrangaTask.Task task, string? connectorName, Publication? publication)
|
2023-05-19 14:15:17 +02:00
|
|
|
|
{
|
2023-05-21 01:57:56 +02:00
|
|
|
|
logger?.WriteLine(this.GetType().ToString(), $"Removing Task {task} {publication?.sortName}");
|
2023-05-20 15:46:40 +02:00
|
|
|
|
if (task == TrangaTask.Task.UpdateKomgaLibrary)
|
2023-05-21 01:57:56 +02:00
|
|
|
|
{
|
2023-05-20 15:46:40 +02:00
|
|
|
|
_allTasks.RemoveWhere(uTask => uTask.task == TrangaTask.Task.UpdateKomgaLibrary);
|
2023-05-21 01:57:56 +02:00
|
|
|
|
logger?.WriteLine(this.GetType().ToString(), $"Removed Task {task}");
|
|
|
|
|
}
|
2023-05-20 15:46:40 +02:00
|
|
|
|
else if (connectorName is null)
|
|
|
|
|
throw new ArgumentException($"connectorName can not be null for Task {task}");
|
|
|
|
|
else
|
2023-05-21 01:57:56 +02:00
|
|
|
|
{
|
|
|
|
|
if(_allTasks.RemoveWhere(trangaTask =>
|
2023-05-20 15:46:40 +02:00
|
|
|
|
trangaTask.task == task && trangaTask.connectorName == connectorName &&
|
2023-05-21 01:57:56 +02:00
|
|
|
|
trangaTask.publication?.downloadUrl == publication?.downloadUrl) > 0)
|
|
|
|
|
logger?.WriteLine(this.GetType().ToString(), $"Removed Task {task} {publication?.sortName} {publication?.downloadUrl}.");
|
|
|
|
|
else
|
|
|
|
|
logger?.WriteLine(this.GetType().ToString(), $"No Task {task} {publication?.sortName} {publication?.downloadUrl} could be found.");
|
|
|
|
|
}
|
2023-05-21 15:05:53 +02:00
|
|
|
|
ExportData();
|
2023-05-19 14:15:17 +02:00
|
|
|
|
}
|
2023-05-21 03:04:32 +02:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Removes a Task from the queue
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="task"></param>
|
|
|
|
|
public void RemoveTaskFromQueue(TrangaTask task)
|
|
|
|
|
{
|
|
|
|
|
task.lastExecuted = DateTime.Now;
|
|
|
|
|
foreach (List<TrangaTask> taskList in this._taskQueue.Values)
|
|
|
|
|
taskList.Remove(task);
|
|
|
|
|
task.state = TrangaTask.ExecutionState.Waiting;
|
|
|
|
|
}
|
2023-05-21 03:18:56 +02:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Sets last execution time to start of time
|
|
|
|
|
/// Let taskManager handle enqueuing
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="task"></param>
|
|
|
|
|
public void AddTaskToQueue(TrangaTask task)
|
|
|
|
|
{
|
|
|
|
|
task.lastExecuted = DateTime.UnixEpoch;
|
|
|
|
|
}
|
2023-05-20 12:53:19 +02:00
|
|
|
|
|
2023-05-19 20:03:17 +02:00
|
|
|
|
/// <returns>All available Connectors</returns>
|
2023-05-19 16:27:56 +02:00
|
|
|
|
public Dictionary<string, Connector> GetAvailableConnectors()
|
|
|
|
|
{
|
2023-05-20 01:06:00 +02:00
|
|
|
|
return this._connectors.ToDictionary(connector => connector.name, connector => connector);
|
2023-05-19 16:27:56 +02:00
|
|
|
|
}
|
2023-05-20 12:53:19 +02:00
|
|
|
|
|
2023-05-19 20:03:17 +02:00
|
|
|
|
/// <returns>All TrangaTasks in task-collection</returns>
|
2023-05-19 16:27:56 +02:00
|
|
|
|
public TrangaTask[] GetAllTasks()
|
|
|
|
|
{
|
|
|
|
|
TrangaTask[] ret = new TrangaTask[_allTasks.Count];
|
|
|
|
|
_allTasks.CopyTo(ret);
|
|
|
|
|
return ret;
|
|
|
|
|
}
|
2023-05-20 12:53:19 +02:00
|
|
|
|
|
2023-05-19 20:03:17 +02:00
|
|
|
|
/// <returns>All added Publications</returns>
|
2023-05-19 17:36:15 +02:00
|
|
|
|
public Publication[] GetAllPublications()
|
|
|
|
|
{
|
|
|
|
|
return this._chapterCollection.Keys.ToArray();
|
|
|
|
|
}
|
2023-05-20 14:07:38 +02:00
|
|
|
|
|
2023-05-20 15:05:41 +02:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Return Connector with given Name
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="connectorName">Connector-name (exact)</param>
|
|
|
|
|
/// <exception cref="Exception">If Connector is not available</exception>
|
2023-05-21 02:13:19 +02:00
|
|
|
|
public Connector GetConnector(string? connectorName)
|
2023-05-20 14:07:38 +02:00
|
|
|
|
{
|
2023-05-20 17:18:22 +02:00
|
|
|
|
if(connectorName is null)
|
|
|
|
|
throw new Exception($"connectorName can not be null");
|
2023-05-20 14:18:03 +02:00
|
|
|
|
Connector? ret = this._connectors.FirstOrDefault(connector => connector.name == connectorName);
|
|
|
|
|
if (ret is null)
|
|
|
|
|
throw new Exception($"Connector {connectorName} is not an available Connector.");
|
|
|
|
|
return (Connector)ret!;
|
2023-05-20 14:07:38 +02:00
|
|
|
|
}
|
2023-05-19 16:27:56 +02:00
|
|
|
|
|
2023-05-19 20:03:17 +02:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Shuts down the taskManager.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="force">If force is true, tasks are aborted.</param>
|
2023-05-19 19:21:54 +02:00
|
|
|
|
public void Shutdown(bool force = false)
|
2023-05-17 23:23:01 +02:00
|
|
|
|
{
|
2023-05-20 22:10:24 +02:00
|
|
|
|
logger?.WriteLine(this.GetType().ToString(), $"Shutting down (forced={force})");
|
2023-05-17 23:23:01 +02:00
|
|
|
|
_continueRunning = false;
|
2023-05-21 15:05:53 +02:00
|
|
|
|
ExportData();
|
2023-05-19 19:21:54 +02:00
|
|
|
|
|
|
|
|
|
if(force)
|
2023-05-20 14:50:48 +02:00
|
|
|
|
Environment.Exit(_allTasks.Count(task => task.state is TrangaTask.ExecutionState.Enqueued or TrangaTask.ExecutionState.Running));
|
2023-05-19 19:21:54 +02:00
|
|
|
|
|
|
|
|
|
//Wait for tasks to finish
|
2023-05-20 14:50:48 +02:00
|
|
|
|
while(_allTasks.Any(task => task.state is TrangaTask.ExecutionState.Running or TrangaTask.ExecutionState.Enqueued))
|
2023-05-19 19:21:54 +02:00
|
|
|
|
Thread.Sleep(10);
|
2023-05-21 01:57:56 +02:00
|
|
|
|
logger?.WriteLine(this.GetType().ToString(), "Tasks finished. Bye!");
|
2023-05-19 20:22:13 +02:00
|
|
|
|
Environment.Exit(0);
|
2023-05-19 13:59:26 +02:00
|
|
|
|
}
|
|
|
|
|
|
2023-05-20 15:05:41 +02:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Loads stored data (settings, tasks) from file
|
|
|
|
|
/// </summary>
|
2023-05-21 15:26:53 +02:00
|
|
|
|
/// <param name="importFilePath">working directory, filename has to be data.json</param>
|
|
|
|
|
public static SettingsData LoadData(string importFilePath)
|
2023-05-19 13:59:26 +02:00
|
|
|
|
{
|
2023-05-21 15:26:53 +02:00
|
|
|
|
if (!File.Exists(importFilePath))
|
2023-05-21 15:05:53 +02:00
|
|
|
|
return new SettingsData(Directory.GetCurrentDirectory(), null, null, new HashSet<TrangaTask>());
|
2023-05-19 14:15:00 +02:00
|
|
|
|
|
2023-05-21 15:26:53 +02:00
|
|
|
|
string toRead = File.ReadAllText(importFilePath);
|
2023-05-20 12:53:19 +02:00
|
|
|
|
SettingsData data = JsonConvert.DeserializeObject<SettingsData>(toRead)!;
|
2023-05-19 16:23:37 +02:00
|
|
|
|
|
2023-05-20 12:53:19 +02:00
|
|
|
|
return data;
|
2023-05-19 13:59:26 +02:00
|
|
|
|
}
|
|
|
|
|
|
2023-05-20 15:05:41 +02:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Exports data (settings, tasks) to file
|
|
|
|
|
/// </summary>
|
2023-05-21 15:05:53 +02:00
|
|
|
|
private void ExportData()
|
2023-05-19 13:59:26 +02:00
|
|
|
|
{
|
2023-05-21 15:14:25 +02:00
|
|
|
|
logger?.WriteLine(this.GetType().ToString(), $"Exporting data to {settings.settingsFilePath}");
|
2023-05-20 12:53:19 +02:00
|
|
|
|
|
2023-05-21 15:05:53 +02:00
|
|
|
|
string serializedData = JsonConvert.SerializeObject(settings);
|
|
|
|
|
File.WriteAllText(settings.settingsFilePath, serializedData);
|
2023-05-20 12:53:19 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public class SettingsData
|
|
|
|
|
{
|
2023-05-20 14:07:38 +02:00
|
|
|
|
public string downloadLocation { get; set; }
|
2023-05-21 15:05:53 +02:00
|
|
|
|
public string settingsFilePath { get; }
|
2023-05-20 14:07:38 +02:00
|
|
|
|
public Komga? komga { get; set; }
|
2023-05-20 12:53:19 +02:00
|
|
|
|
public HashSet<TrangaTask> allTasks { get; }
|
|
|
|
|
|
2023-05-21 15:05:53 +02:00
|
|
|
|
public SettingsData(string downloadLocation, string? settingsFilePath, Komga? komga, HashSet<TrangaTask> allTasks)
|
2023-05-20 12:53:19 +02:00
|
|
|
|
{
|
2023-05-21 15:05:53 +02:00
|
|
|
|
this.settingsFilePath = settingsFilePath ??
|
|
|
|
|
Path.Join(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData),
|
|
|
|
|
"Tranga", "data.json");
|
2023-05-20 12:53:19 +02:00
|
|
|
|
this.downloadLocation = downloadLocation;
|
2023-05-20 14:07:38 +02:00
|
|
|
|
this.komga = komga;
|
2023-05-20 12:53:19 +02:00
|
|
|
|
this.allTasks = allTasks;
|
|
|
|
|
}
|
2023-05-17 23:23:01 +02:00
|
|
|
|
}
|
|
|
|
|
}
|