| | |
| | | try |
| | | { |
| | | |
| | | if (a31MusicModel.ServerClientType == -1) |
| | | if (a31MusicModel.ServerClientType == 1) |
| | | { |
| | | var result = OpenWeb("http://" + a31MusicModel.MainPlayIP + "/httpapi.asp?command=multiroom:getSlaveList"); |
| | | if (result != null) |
| | | var result = OpenWeb("http://" + a31MusicModel.IPAddress + "/httpapi.asp?command=multiroom:getSlaveList"); |
| | | if (result != null && result != "Failed") |
| | | { |
| | | var slaves = Newtonsoft.Json.JsonConvert.DeserializeObject<Slaves>(result); |
| | | if (slaves != null && slaves.slave_list != null) |
| | | if (slaves != null && slaves.slave_list != null && slaves.slave_list.Count != 0) |
| | | { |
| | | var slave = slaves.slave_list.Find((obj) => obj.uuid.Replace("uuid:", "") == a31MusicModel.UniqueDeviceName); |
| | | if (slave != null) |
| | | { |
| | | a31MusicModel.A31PlayStatus.vol = slave.volume; |
| | | } |
| | | a31MusicModel.Slave = slaves; |
| | | } |
| | | } |
| | | return; |
| | | } |
| | | |
| | | WebClient webClient = new WebClient(); |
| | |
| | | webClient.Headers.Add("CONTENT-TYPE", "text/xml; charset=\"utf-8\""); |
| | | |
| | | var recevieBytes = webClient.UploadData(new Uri("http://" + a31MusicModel.IPAddress + ":" + a31MusicModel.Port + "/upnp/control/rendertransport1"), "POST", System.Text.Encoding.UTF8.GetBytes("<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\"?><s:Envelope s:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\" xmlns:s=\"http://schemas.xmlsoap.org/soap/envelope/\"><s:Body><u:GetInfoEx xmlns:u=\"urn:schemas-upnp-org:service:AVTransport:1\"><InstanceID>0</InstanceID></u:GetInfoEx></s:Body></s:Envelope>")); |
| | | a31MusicModel.LastDateTime = DateTime.Now; |
| | | a31MusicModel.LastDateTime = DateTime.Now;//记录数据反馈的时间(因为有时间网络差数据不回复,导致当前播放音乐时间显示不正确) |
| | | |
| | | var se = System.Security.SecurityElement.FromString(System.Text.Encoding.UTF8.GetString(recevieBytes)).SearchForChildByTag("s:Body").SearchForChildByTag("u:GetInfoExResponse"); |
| | | |