예제 #1
0
        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);
        }
예제 #2
0
        /// <summary>
        /// this expects a document with a top level <Room> </Room> xml node
        /// </summary>
        /// <param name="roomXmlDocument"></param>
        /// <returns></returns>
        public static RoomProperties GetRoomPropertiesFromXml(XmlDocument roomXmlDocument, IServerAssetRepository serverAssetRepository)
        {
            XmlNode roomXmlNode = roomXmlDocument.SelectSingleNode("Rooms/Room");

            if (roomXmlNode != null)
            {
                //the room node is parsed out of the xml doc and passed to the GetRoomFromXml(XmlNode) function
                return(GetRoomPropertiesFromXml(roomXmlNode, serverAssetRepository));
            }
            else
            {
                StateServerAssert.Assert(new System.Exception("Error: could not find top level Room node"));
            }
            return(null);
        }
예제 #3
0
        public static List <RoomProperties> GetRoomsPropertiesFromXml(XmlDocument xmlResponse, IServerAssetRepository serverAssetRepository)
        {
            //store available rooms that are rooms marked as Enabled="true" in the xml
            List <RoomProperties> availableRooms = new List <RoomProperties>();

            //look for all Room Nodes in the xml response
            XmlNodeList roomNodeListXml = xmlResponse.SelectNodes("Rooms/Room");

            foreach (XmlNode roomXmlNode in roomNodeListXml)
            {
                RoomProperties room = GetRoomPropertiesFromXml(roomXmlNode, serverAssetRepository);
                if (room != null)
                {
                    availableRooms.Add(room);
                }
            }

            return(availableRooms);
        }