From 3ed00f732a284b5a3e96e52d4e3a71869135869b Mon Sep 17 00:00:00 2001 From: TheArcaneBrony Date: Mon, 26 Jun 2023 02:43:54 +0200 Subject: Dependency injection stuff --- MatrixRoomUtils.Core/Extensions/JsonElementExtensions.cs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'MatrixRoomUtils.Core/Extensions/JsonElementExtensions.cs') diff --git a/MatrixRoomUtils.Core/Extensions/JsonElementExtensions.cs b/MatrixRoomUtils.Core/Extensions/JsonElementExtensions.cs index 78f4456..36da644 100644 --- a/MatrixRoomUtils.Core/Extensions/JsonElementExtensions.cs +++ b/MatrixRoomUtils.Core/Extensions/JsonElementExtensions.cs @@ -7,7 +7,7 @@ using System.Text.Json.Serialization; namespace MatrixRoomUtils.Core.Extensions; public static class JsonElementExtensions { - public static void FindExtraJsonElementFields([DisallowNull] this JsonElement? res, Type t) { + public static bool FindExtraJsonElementFields([DisallowNull] this JsonElement? res, Type t) { var props = t.GetProperties(); var unknownPropertyFound = false; foreach (var field in res.Value.EnumerateObject()) { @@ -17,8 +17,10 @@ public static class JsonElementExtensions { } if (unknownPropertyFound) Console.WriteLine(res.Value.ToJson()); + + return unknownPropertyFound; } - public static void FindExtraJsonObjectFields([DisallowNull] this JsonObject? res, Type t) { + public static bool FindExtraJsonObjectFields([DisallowNull] this JsonObject? res, Type t) { var props = t.GetProperties(); var unknownPropertyFound = false; foreach (var field in res) { @@ -31,5 +33,7 @@ public static class JsonElementExtensions { } if (unknownPropertyFound) Console.WriteLine(res.ToJson()); + + return unknownPropertyFound; } } \ No newline at end of file -- cgit 1.5.1