@page "/RoomManager/Space/{RoomId}" @using MatrixRoomUtils.Core.Extensions @using System.Text.Json

Room manager - Viewing Space

@foreach (var room in Rooms) { }
State list @foreach (var stateEvent in States.OrderBy(x => x.StateKey).ThenBy(x => x.Type)) {

@stateEvent.StateKey/@stateEvent.Type:

@stateEvent.Content.ToJson()
}
@code { [Parameter] public string RoomId { get; set; } = "invalid!!!!!!"; private Room? Room { get; set; } private StateEventResponse[] States { get; set; } = Array.Empty>(); private List Rooms { get; } = new(); private List ServersInSpace { get; } = new(); protected override async Task OnInitializedAsync() { await LocalStorageWrapper.LoadFromLocalStorage(LocalStorage); Room = await RuntimeCache.CurrentHomeServer.GetRoom(RoomId.Replace('~', '.')); var state = await Room.GetStateAsync(""); if (state != null) { // Console.WriteLine(state.Value.ToJson()); States = state.Value.Deserialize[]>()!; foreach (var stateEvent in States) { if (stateEvent.Type == "m.space.child") { // if (stateEvent.Content.ToJson().Length < 5) return; var roomId = stateEvent.StateKey; var room = await RuntimeCache.CurrentHomeServer.GetRoom(roomId); if (room != null) { Rooms.Add(room); } } else if (stateEvent.Type == "m.room.member") { var serverName = stateEvent.StateKey.Split(':').Last(); if (!ServersInSpace.Contains(serverName)) { ServersInSpace.Add(serverName); } } } // if(state.Value.TryGetProperty("Type", out var Type)) // { // } // else // { // //this is fine, apprently... // //Console.WriteLine($"Room {room.RoomId} has no Content.Type in m.room.create!"); // } } await base.OnInitializedAsync(); } private async Task JoinAllRooms() { foreach (var room in Rooms) { room.JoinAsync(ServersInSpace.ToArray()); } } }