/// <summary> /// This function creates the room on the database... /// ...and then uses AddRoomToManager to update the RoomManager class' internal data structures /// </summary> public virtual void CreateNewRoomInDatabase(Guid sessionId, string roomName, RoomType roomType, PrivacyLevel privacyLevel, System.Action <IServerDistributedRoom> createRoomFinishedCallback) { Action <XmlDocument> createRoomServiceCallback = delegate(XmlDocument xmlResponse) { RoomId roomId = null; XmlNode newRoomNode = xmlResponse.SelectSingleNode("Rooms/Room"); AccountId accountId = null; List <ItemId> itemIds = new List <ItemId>(); RoomXmlUtil.GetRoomInfoFromRoomXmlNode(newRoomNode, out accountId, out privacyLevel, out roomName, out roomId, out roomType, out itemIds); XmlDocument roomItemsDnaXml = mServerStateMachine.ServerAssetRepository.GetXmlDna(itemIds); IServerDistributedRoom newRoom = CreateServerDistributedRoom(accountId, roomName, roomId, roomType, privacyLevel, roomItemsDnaXml); AddRoomToRoomManager(newRoom); createRoomFinishedCallback(newRoom); }; CreateNewRoomInDatabaseService(sessionId, roomName, privacyLevel, createRoomServiceCallback); }
public static RoomProperties GetRoomPropertiesFromXml(XmlNode roomXmlNode, IServerAssetRepository serverAssetRepository) { RoomProperties returnRoomProperties = null; string roomName = string.Empty; RoomId roomId = null; RoomType roomType = RoomType.Default; List <ItemId> itemIds = new List <ItemId>(); AccountId accountId = null; PrivacyLevel privacyLevel = PrivacyLevel.Default; //if we find a room that's marked as Enabled="true", load it into memory if (RoomXmlUtil.GetRoomInfoFromRoomXmlNode(roomXmlNode, out accountId, out privacyLevel, out roomName, out roomId, out roomType, out itemIds)) { XmlDocument roomItemsDnaXml = serverAssetRepository.GetXmlDna(itemIds); returnRoomProperties = new RoomProperties(accountId, roomName, roomId, roomType, privacyLevel, roomItemsDnaXml); } return(returnRoomProperties); }