about summary refs log tree commit diff
path: root/LibMatrix/StateEvent.cs
diff options
context:
space:
mode:
authorTheArcaneBrony <myrainbowdash949@gmail.com>2023-12-27 19:45:22 +0100
committerTheArcaneBrony <myrainbowdash949@gmail.com>2023-12-27 19:45:22 +0100
commit94b83d4de5e435796da9cc14667c1023a09df8eb (patch)
tree359f0d41431d4f647dddd213ab44f20780531ccd /LibMatrix/StateEvent.cs
parentSetImpersonate optimisation (dont execute if already set), cleanup (diff)
downloadLibMatrix-94b83d4de5e435796da9cc14667c1023a09df8eb.tar.xz
Cleanup
Diffstat (limited to '')
-rw-r--r--LibMatrix/StateEvent.cs64
1 files changed, 32 insertions, 32 deletions
diff --git a/LibMatrix/StateEvent.cs b/LibMatrix/StateEvent.cs
index cfc7011..ad7605a 100644
--- a/LibMatrix/StateEvent.cs
+++ b/LibMatrix/StateEvent.cs
@@ -43,7 +43,7 @@ public class StateEvent {
                 // return null;
             // }
             try {
-                return (EventContent)RawContent.Deserialize(GetType, TypedContentSerializerOptions)!;
+                return (EventContent)RawContent.Deserialize(GetStateEventType(Type), TypedContentSerializerOptions)!;
             }
             catch (JsonException e) {
                 Console.WriteLine(e);
@@ -76,37 +76,37 @@ public class StateEvent {
         get => _rawContent;
         set => _rawContent = value;
     }
-
-    [JsonIgnore]
-    public new Type GetType {
-        get {
-            var type = GetStateEventType(Type);
-
-            //special handling for some types
-            // if (type == typeof(RoomEmotesEventContent)) {
-            //     RawContent["emote"] = RawContent["emote"]?.AsObject() ?? new JsonObject();
-            // }
-            //
-            // if (this is StateEventResponse stateEventResponse) {
-            //     if (type == null || type == typeof(object)) {
-            //         Console.WriteLine($"Warning: unknown event type '{Type}'!");
-            //         Console.WriteLine(RawContent.ToJson());
-            //         Directory.CreateDirectory($"unknown_state_events/{Type}");
-            //         File.WriteAllText($"unknown_state_events/{Type}/{stateEventResponse.EventId}.json",
-            //             RawContent.ToJson());
-            //         Console.WriteLine($"Saved to unknown_state_events/{Type}/{stateEventResponse.EventId}.json");
-            //     }
-            //     else if (RawContent is not null && RawContent.FindExtraJsonObjectFields(type)) {
-            //         Directory.CreateDirectory($"unknown_state_events/{Type}");
-            //         File.WriteAllText($"unknown_state_events/{Type}/{stateEventResponse.EventId}.json",
-            //             RawContent.ToJson());
-            //         Console.WriteLine($"Saved to unknown_state_events/{Type}/{stateEventResponse.EventId}.json");
-            //     }
-            // }
-
-            return type;
-        }
-    }
+    //
+    // [JsonIgnore]
+    // public new Type GetType {
+    //     get {
+    //         var type = GetStateEventType(Type);
+    //
+    //         //special handling for some types
+    //         // if (type == typeof(RoomEmotesEventContent)) {
+    //         //     RawContent["emote"] = RawContent["emote"]?.AsObject() ?? new JsonObject();
+    //         // }
+    //         //
+    //         // if (this is StateEventResponse stateEventResponse) {
+    //         //     if (type == null || type == typeof(object)) {
+    //         //         Console.WriteLine($"Warning: unknown event type '{Type}'!");
+    //         //         Console.WriteLine(RawContent.ToJson());
+    //         //         Directory.CreateDirectory($"unknown_state_events/{Type}");
+    //         //         File.WriteAllText($"unknown_state_events/{Type}/{stateEventResponse.EventId}.json",
+    //         //             RawContent.ToJson());
+    //         //         Console.WriteLine($"Saved to unknown_state_events/{Type}/{stateEventResponse.EventId}.json");
+    //         //     }
+    //         //     else if (RawContent is not null && RawContent.FindExtraJsonObjectFields(type)) {
+    //         //         Directory.CreateDirectory($"unknown_state_events/{Type}");
+    //         //         File.WriteAllText($"unknown_state_events/{Type}/{stateEventResponse.EventId}.json",
+    //         //             RawContent.ToJson());
+    //         //         Console.WriteLine($"Saved to unknown_state_events/{Type}/{stateEventResponse.EventId}.json");
+    //         //     }
+    //         // }
+    //
+    //         return type;
+    //     }
+    // }
 
     //debug
     [JsonIgnore]