Tranga-Website/Tranga/Migrate.cs
glax fa69f4488f Removed UpdateLibraryTask (deprecated).
Libraries will be updated on new Chapters downloaded.
Added Migrator, for future file-changes
2023-07-20 18:15:14 +02:00

27 lines
726 B
C#

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);
}
}