From d2f46e46379595a9741b73226e0a43134790b160 Mon Sep 17 00:00:00 2001 From: glax Date: Mon, 19 Jun 2023 11:27:07 +0200 Subject: [PATCH] #21 Deserialization of LunaSea Object --- Tranga/NotificationManager.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Tranga/NotificationManager.cs b/Tranga/NotificationManager.cs index 6488d63..2612725 100644 --- a/Tranga/NotificationManager.cs +++ b/Tranga/NotificationManager.cs @@ -27,11 +27,14 @@ public abstract class NotificationManager return (objectType == typeof(NotificationManager)); } - public override object ReadJson(JsonReader reader, Type objectType, object? existingValue, JsonSerializer serializer) + public override object ReadJson(JsonReader reader, Type objectType, object? existingValue, + JsonSerializer serializer) { JObject jo = JObject.Load(reader); if (jo["notificationManagerType"]!.Value() == (byte)NotificationManagerType.Gotify) return jo.ToObject(serializer)!; + else if (jo["notificationManagerType"]!.Value() == (byte)NotificationManagerType.LunaSea) + return jo.ToObject(serializer)!; throw new Exception(); }