2
0

Fix wrong deserialization

This commit is contained in:
glax 2023-07-21 00:32:18 +02:00
parent 18323f9f51
commit 77eec0f696

View File

@ -1,4 +1,5 @@
using Newtonsoft.Json;
using Logging;
using Newtonsoft.Json;
namespace Tranga;
@ -21,7 +22,11 @@ public static class Migrate
private static void RemoveUpdateLibraryTask(TrangaSettings settings)
{
List<TrangaTask> tasks = JsonConvert.DeserializeObject<List<TrangaTask>>(settings.tasksFilePath)!;
if (!File.Exists(settings.tasksFilePath))
return;
string tasksJsonString = File.ReadAllText(settings.tasksFilePath);
List<TrangaTask> tasks = JsonConvert.DeserializeObject<List<TrangaTask>>(tasksJsonString, new JsonSerializerSettings { Converters = { new TrangaTask.TrangaTaskJsonConverter() } })!;
tasks.RemoveAll(t => t.task == TrangaTask.Task.UpdateLibraries);
}
}