diff options
author | Emma [it/its]@Rory& <root@rory.gay> | 2024-06-03 04:59:40 +0200 |
---|---|---|
committer | Emma [it/its]@Rory& <root@rory.gay> | 2024-06-03 04:59:40 +0200 |
commit | 2a37322d78c9ce1d27cbc12e24dd918407a931e3 (patch) | |
tree | d3483edae6792bab1f10516b95779367220a2a8d /LibMatrix.EventTypes.Abstractions/BaseMatrixEventContent.cs | |
parent | Add all projects to sln (diff) | |
download | LibMatrix-dev/event-rewrite.tar.xz |
Update dependencies, some tests, other things github/dev/event-rewrite dev/event-rewrite
Diffstat (limited to 'LibMatrix.EventTypes.Abstractions/BaseMatrixEventContent.cs')
-rw-r--r-- | LibMatrix.EventTypes.Abstractions/BaseMatrixEventContent.cs | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/LibMatrix.EventTypes.Abstractions/BaseMatrixEventContent.cs b/LibMatrix.EventTypes.Abstractions/BaseMatrixEventContent.cs index eba50a5..0906e30 100644 --- a/LibMatrix.EventTypes.Abstractions/BaseMatrixEventContent.cs +++ b/LibMatrix.EventTypes.Abstractions/BaseMatrixEventContent.cs @@ -6,15 +6,19 @@ using ArcaneLibs.Extensions; namespace LibMatrix.EventTypes; +public interface IMatrixEvent { + +} + // <T> : MatrixEventContent where T : MatrixEventContent<T>, new() { /// <summary> /// Extensible Event Content, aims to provide an API similar to JsonNode/JsonObject /// <seealso cref="System.Text.Json.Nodes.JsonNode"/> /// <seealso cref="System.Text.Json.Nodes.JsonObject"/> /// </summary> -[JsonConverter(typeof(MatrixEventContentConverter<BaseMatrixEventContent>))] +// [JsonConverter(typeof(BaseMatrixEventContent.MatrixEventContentConverter<BaseMatrixEventContent>))] // [JsonSerializable(typeof(MatrixEventContent))] -public class BaseMatrixEventContent { +public abstract class BaseMatrixEventContent { public JsonObject InternalJson { get; set; } = new(); public BaseMatrixEventContent() { } @@ -23,7 +27,7 @@ public class BaseMatrixEventContent { InternalJson = json.AsObject(); } - public static implicit operator BaseMatrixEventContent(JsonNode json) => new(json); + // public static implicit operator BaseMatrixEventContent(JsonNode json) => new(json); // public static implicit operator JsonNode(MatrixEventContent content) => content.InternalJson; @@ -33,7 +37,10 @@ public class BaseMatrixEventContent { [JsonIgnore] public string EventType => EventTypes.First(); - public JsonNode? this[string key] => InternalJson[key]; + public JsonNode? this[string key] { + get => InternalJson[key]; + set => InternalJson[key] = value; + } public string ToJson() => InternalJson.ToJson(); |