This commit is contained in:
glax 2023-07-31 02:07:39 +02:00
parent f832fe0de3
commit 835e239be5
3 changed files with 5 additions and 9 deletions

View File

@ -16,8 +16,8 @@ public static class Migrator
return;
JsonNode settingsNode = JsonNode.Parse(File.ReadAllText(settingsFilePath))!;
ushort version = settingsNode["version"] is not null
? settingsNode["version"].GetValue<ushort>()
: settingsNode["ts"]["version"].GetValue<ushort>();
? settingsNode["version"]!.GetValue<ushort>()
: settingsNode["ts"]!["version"]!.GetValue<ushort>();
logger?.WriteLine("Migrator", $"Migrating {version} -> {CurrentVersion}");
switch (version)
{
@ -91,7 +91,7 @@ public static class Migrator
if (lunaSeaNode is not null)
nms.Add(new LunaSea(lunaSeaNode["id"]!.GetValue<string>()));
CommonObjects co = new (lms, nms, null, settingsFilePath);
CommonObjects co = new (lms, nms, logger, settingsFilePath);
TrangaSettings.SettingsJsonObject sjo = new(ts, co);
File.WriteAllText(settingsFilePath, JsonConvert.SerializeObject(sjo));

View File

@ -21,7 +21,7 @@ public class TaskManager
public TaskManager(TrangaSettings settings, Logging.Logger? logger)
{
commonObjects = CommonObjects.LoadSettings(settings.settingsFilePath, logger);
commonObjects.logger?.WriteLine("Tranga", value: "\n"+
commonObjects.logger?.WriteLine(this.GetType().ToString(), value: "\n"+
@"-----------------------------------------------------------------"+"\n"+
@" |¯¯¯¯¯¯|°|¯¯¯¯¯¯\ /¯¯¯¯¯¯| |¯¯¯\|¯¯¯| /¯¯¯¯¯¯\' /¯¯¯¯¯¯| "+"\n"+
@" | | | x <|' / ! | | '| | (/¯¯¯\° / ! | "+ "\n"+
@ -205,8 +205,6 @@ public class TaskManager
{
switch (taskType)
{
case TrangaTask.Task.UpdateLibraries:
return _allTasks.Where(tTask => tTask.task == TrangaTask.Task.UpdateLibraries);
case TrangaTask.Task.MonitorPublication:
if(connectorName is null)
return _allTasks.Where(tTask => tTask.task == taskType);

View File

@ -1,6 +1,4 @@
using System.Text.Json.Nodes;
using Logging;
using Newtonsoft.Json;
using Newtonsoft.Json;
using Tranga.LibraryManagers;
using Tranga.NotificationManagers;