public static Chat GetChat(int UsrK) { Chat c = null; try { c = new Chat(UsrK); } catch { c = new Chat(); c.UsrK = UsrK; } return c; }
void insertRoom(Dictionary<Guid, RoomStub> rooms, List<Guid> roomsOrder, int listOrder, Chat.RoomSpec spec, bool guest) { Guid g = spec.Guid; string name = spec.GetName(Usr.Current); string url = spec.GetUrl(Usr.Current); if (!rooms.ContainsKey(g)) { rooms.Add(g, getRoomStub(g, name, url, spec.IsPinnable, guest, spec.IsReadOnly, true, spec.IsPhotoChatRoom, spec.IsPrivateChatRoom, spec.IsNewPhotoAlertsRoom, spec.GetPrivateChatRoomPresence(Usr.Current), spec.Icon, spec.IsStarredByDefault, listOrder, spec.IsStarredByDefault, spec.IsStarrable, spec.HasArchive, spec.HiddenFromRoomList, spec.IsStreamRoom)); //roomsOrder.Insert(0, g); for (int i = 0; i <= roomsOrder.Count; i++) { if (i == roomsOrder.Count) { roomsOrder.Add(g); break; } else if (rooms[roomsOrder[i]].listOrder > listOrder) { roomsOrder.Insert(i, g); break; } } } }