mirror of
https://github.com/C9Glax/tranga-website.git
synced 2025-06-12 23:07:54 +02:00
Removed UpdateLibraryTask (deprecated).
Libraries will be updated on new Chapters downloaded. Added Migrator, for future file-changes
This commit is contained in:
27
Tranga/Migrate.cs
Normal file
27
Tranga/Migrate.cs
Normal file
@ -0,0 +1,27 @@
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Tranga;
|
||||
|
||||
public static class Migrate
|
||||
{
|
||||
private static readonly ushort CurrentVersion = 16;
|
||||
public static void Files(TrangaSettings settings)
|
||||
{
|
||||
settings.version ??= 15;
|
||||
switch (settings.version)
|
||||
{
|
||||
case 15:
|
||||
RemoveUpdateLibraryTask(settings);
|
||||
break;
|
||||
}
|
||||
|
||||
settings.version = CurrentVersion;
|
||||
settings.ExportSettings();
|
||||
}
|
||||
|
||||
private static void RemoveUpdateLibraryTask(TrangaSettings settings)
|
||||
{
|
||||
List<TrangaTask> tasks = JsonConvert.DeserializeObject<List<TrangaTask>>(settings.tasksFilePath)!;
|
||||
tasks.RemoveAll(t => t.task == TrangaTask.Task.UpdateLibraries);
|
||||
}
|
||||
}
|
@ -37,6 +37,7 @@ public class TaskManager
|
||||
};
|
||||
|
||||
this.settings = settings;
|
||||
Migrate.Files(settings);
|
||||
ImportData();
|
||||
ExportDataAndSettings();
|
||||
Thread taskChecker = new(TaskCheckerThread);
|
||||
|
@ -15,6 +15,7 @@ public class TrangaSettings
|
||||
[JsonIgnore] public string coverImageCache => Path.Join(workingDirectory, "imageCache");
|
||||
public HashSet<LibraryManager> libraryManagers { get; }
|
||||
public HashSet<NotificationManager> notificationManagers { get; }
|
||||
public ushort? version { get; set; }
|
||||
|
||||
public TrangaSettings(string downloadLocation, string workingDirectory, HashSet<LibraryManager>? libraryManagers,
|
||||
HashSet<NotificationManager>? notificationManagers)
|
||||
|
@ -3,6 +3,9 @@ using Logging;
|
||||
|
||||
namespace Tranga.TrangaTasks;
|
||||
|
||||
/// <summary>
|
||||
/// LEGACY DEPRECATED
|
||||
/// </summary>
|
||||
public class UpdateLibrariesTask : TrangaTask
|
||||
{
|
||||
public UpdateLibrariesTask(TimeSpan reoccurrence) : base(Task.UpdateLibraries, reoccurrence)
|
||||
|
Reference in New Issue
Block a user