diff --git a/Tranga/Migrate.cs b/Tranga/Migrate.cs index 9ab7eee..61b34ee 100644 --- a/Tranga/Migrate.cs +++ b/Tranga/Migrate.cs @@ -26,7 +26,8 @@ public static class Migrate return; string tasksJsonString = File.ReadAllText(settings.tasksFilePath); - List tasks = JsonConvert.DeserializeObject>(tasksJsonString, new JsonSerializerSettings { Converters = { new TrangaTask.TrangaTaskJsonConverter() } })!; - tasks.RemoveAll(t => t.task == TrangaTask.Task.UpdateLibraries); + HashSet tasks = JsonConvert.DeserializeObject>(tasksJsonString, new JsonSerializerSettings { Converters = { new TrangaTask.TrangaTaskJsonConverter() } })!; + tasks.RemoveWhere(t => t.task == TrangaTask.Task.UpdateLibraries); + File.WriteAllText(settings.tasksFilePath, JsonConvert.SerializeObject(tasks)); } } \ No newline at end of file diff --git a/Tranga/Publication.cs b/Tranga/Publication.cs index 98b66fa..c72e605 100644 --- a/Tranga/Publication.cs +++ b/Tranga/Publication.cs @@ -30,7 +30,8 @@ public struct Publication private static readonly Regex LegalCharacters = new Regex(@"[A-Z]*[a-z]*[0-9]* *\.*-*,*'*\'*\)*\(*~*!*"); - public Publication(string sortName, List authors, string? description, Dictionary altTitles, string[] tags, string? posterUrl, string? coverFileNameInCache, Dictionary? links, int? year, string? originalLanguage, string status, string publicationId, string? folderName = null, float ignoreChaptersBelow = 0) + [JsonConstructor] + public Publication(string sortName, List authors, string? description, Dictionary altTitles, string[] tags, string? posterUrl, string? coverFileNameInCache, Dictionary? links, int? year, string? originalLanguage, string status, string publicationId, string? folderName = null, float? ignoreChaptersBelow = 0) { this.sortName = sortName; this.authors = authors; @@ -49,7 +50,7 @@ public struct Publication this.folderName = this.folderName.Substring(0, this.folderName.Length - 1); string onlyLowerLetters = string.Concat(this.sortName.ToLower().Where(Char.IsLetter)); this.internalId = Convert.ToBase64String(Encoding.ASCII.GetBytes($"{onlyLowerLetters}{this.year}")); - this.ignoreChaptersBelow = ignoreChaptersBelow; + this.ignoreChaptersBelow = ignoreChaptersBelow ?? 0f; } public string CreatePublicationFolder(string downloadDirectory)