about summary refs log tree commit diff
path: root/MatrixRoomUtils.Core
diff options
context:
space:
mode:
Diffstat (limited to 'MatrixRoomUtils.Core')
-rw-r--r--MatrixRoomUtils.Core/StateEvent.cs13
-rw-r--r--MatrixRoomUtils.Core/StateEventTypes/Spec/ProfileResponseEventData.cs3
2 files changed, 12 insertions, 4 deletions
diff --git a/MatrixRoomUtils.Core/StateEvent.cs b/MatrixRoomUtils.Core/StateEvent.cs

index 8952403..1c0a1cf 100644 --- a/MatrixRoomUtils.Core/StateEvent.cs +++ b/MatrixRoomUtils.Core/StateEvent.cs
@@ -15,7 +15,16 @@ public class StateEvent { new ClassCollector<IStateEventType>().ResolveFromAllAccessibleAssemblies(); public object TypedContent { - get => RawContent.Deserialize(GetType)!; + get { + try { + return RawContent.Deserialize(GetType)!; + } + catch (JsonException e) { + Console.WriteLine(e); + Console.WriteLine("Content:\n"+ObjectExtensions.ToJson(RawContent)); + } + return null; + } set => RawContent = JsonSerializer.Deserialize<JsonObject>(JsonSerializer.Serialize(value)); } @@ -101,4 +110,4 @@ public class StateEvent { } public string cdtype => TypedContent.GetType().Name; -} \ No newline at end of file +} diff --git a/MatrixRoomUtils.Core/StateEventTypes/Spec/ProfileResponseEventData.cs b/MatrixRoomUtils.Core/StateEventTypes/Spec/ProfileResponseEventData.cs
index 4596de9..f3a0ce9 100644 --- a/MatrixRoomUtils.Core/StateEventTypes/Spec/ProfileResponseEventData.cs +++ b/MatrixRoomUtils.Core/StateEventTypes/Spec/ProfileResponseEventData.cs
@@ -4,11 +4,10 @@ using MatrixRoomUtils.Core.Interfaces; namespace MatrixRoomUtils.Core.StateEventTypes.Spec; -[MatrixEvent(EventName = "m.room.member")] public class ProfileResponseEventData : IStateEventType { [JsonPropertyName("avatar_url")] public string? AvatarUrl { get; set; } = ""; [JsonPropertyName("displayname")] public string? DisplayName { get; set; } = ""; -} \ No newline at end of file +}