private void CreateZone(XElement zoneXml)
        {
            var players = zoneXml.Descendants("ZoneGroupMember").Where(x => x.Attribute("Invisible") == null).ToList();

            if (players.Count > 0)
            {
                var zone = new SonosZone((string)zoneXml.Attribute("Coordinator"));

                foreach (var playerXml in players)
                {
                    var player = new SonosPlayer
                    {
                        Name         = (string)playerXml.Attribute("ZoneName"),
                        UUID         = (string)playerXml.Attribute("UUID"),
                        ControlPoint = ControlPoint
                    };

                    zone.AddPlayer(player);
                    Players.Add(player);

                    // This can happen before or after the topology event...
                    if (playerDevices.ContainsKey(player.UUID))
                    {
                        player.SetDevice(playerDevices[player.UUID]);
                    }
                }

                Zones.Add(zone);
            }
        }
		public void AddPlayer(SonosPlayer player)
		{
			if (player.UUID == CoordinatorUUID)
			{
				Coordinator = player;
			}

			players.Add(player);
		}
Exemple #3
0
        public void AddPlayer(SonosPlayer player)
        {
            if (player.UUID == CoordinatorUUID)
            {
                Coordinator = player;
            }

            players.Add(player);
        }
		private void CreateZone(XElement zoneXml)
		{
			var players = zoneXml.Descendants("ZoneGroupMember").Where(x => x.Attribute("Invisible") == null).ToList();
			if (players.Count > 0)
			{
				var zone = new SonosZone((string) zoneXml.Attribute("Coordinator"));

				foreach (var playerXml in players)
				{
					var player = new SonosPlayer
						             {
							             Name = (string) playerXml.Attribute("ZoneName"),
							             UUID = (string) playerXml.Attribute("UUID"),
							             ControlPoint = ControlPoint
						             };

					zone.AddPlayer(player);
					Players.Add(player);

					// This can happen before or after the topology event...
					if (playerDevices.ContainsKey(player.UUID))
					{
						player.SetDevice(playerDevices[player.UUID]);
					}
				}

				Zones.Add(zone);
			}
		}