2
0

Merge pull request 'Missing logger, breaking version in settings.json' (!51) from cuttingedge into master

Reviewed-on: #51
This commit is contained in:
glax 2023-07-31 02:14:06 +02:00
commit 6fb4098c16
4 changed files with 6 additions and 9 deletions

View File

@ -42,6 +42,7 @@ public class CommonObjects
if (logger is not null) if (logger is not null)
{ {
settings.co.logger = logger;
foreach (LibraryManager lm in settings.co.libraryManagers) foreach (LibraryManager lm in settings.co.libraryManagers)
lm.AddLogger(logger); lm.AddLogger(logger);
foreach(NotificationManager nm in settings.co.notificationManagers) foreach(NotificationManager nm in settings.co.notificationManagers)

View File

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

View File

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

View File

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