| | |
| | | public string Name=string.Empty; |
| | | /// <summary> |
| | | /// 上一次更新的时间 |
| | | /// 记录数据反馈的时间(因为有时间网络差数据不回复,导致刷新当前播放音乐时间不正确) |
| | | /// ((当前时间)DateTime.Now - (记录时间)LastDateTimeLastDateTime).TotalSeconds=误差时间(秒) |
| | | /// </summary> |
| | | public DateTime LastDateTime; |
| | | /// <summary> |
| | |
| | | /// </summary> |
| | | public int Port = 49153; |
| | | |
| | | |
| | | public bool IsEnd; |
| | | /// <summary> |
| | | /// 是否是播放器列表最后一个(true) |
| | | /// </summary> |
| | | public bool IsEnd=false; |
| | | |
| | | public int A31DeviceType; |
| | | |
| | |
| | | public bool IsOnLine = true; |
| | | |
| | | /// <summary> |
| | | /// 喜爱列表 |
| | | /// 喜爱音乐列表 |
| | | /// </summary> |
| | | public List<MusicInfo> LoveMusicInfoList = new List<MusicInfo>(); |
| | | |
| | |
| | | public List<MusicInfo> vTunerList = new List<MusicInfo>(); |
| | | |
| | | /// <summary> |
| | | /// 电台所有列表 |
| | | /// 喜爱电台列表 |
| | | /// </summary> |
| | | public List<MusicInfo> CnLoveRadioInfoList = new List<MusicInfo>(); |
| | | public List<MusicInfo> LoveRadioInfoList = new List<MusicInfo>(); |
| | | |
| | | /// <summary> |
| | | /// Pandora电台所有列表 |
| | |
| | | /// </summary> |
| | | public int ServerClientType; |
| | | /// <summary> |
| | | /// 表示从的播放器IP |
| | | /// 记录主播放器IP |
| | | /// </summary> |
| | | public string ServerIP = string.Empty; |
| | | |
| | | public string MainPlayIP = string.Empty; |
| | | /// <summary> |
| | | /// 记录主播放器名称 |
| | | /// </summary> |
| | | public string MainPlayName = string.Empty; |
| | | |
| | | public Slaves Slave = new Slaves(); |
| | | |
| | |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 调节音量 |
| | | /// </summary> |
| | | /// <param name="volume">Volume.</param> |
| | | public void ControlVolume(int volume) |
| | | { |
| | | System.Threading.Tasks.Task.Run(() => { |
| | | ProgressDateTime = DateTime.Now; |
| | | try |
| | | { |
| | | if (ServerClientType == -1) |
| | | { |
| | | new System.Net.WebClient().DownloadData(new Uri("http://" + ServerIP + "/httpapi.asp?command=multiroom:SlaveVolume:" + IPAddress + ":" + volume)); |
| | | } |
| | | else if (ServerClientType == 1) |
| | | { |
| | | new System.Net.WebClient().DownloadData(new Uri("http://" + IPAddress + "/httpapi.asp?command=setPlayerCmd:slave_vol:" + volume)); |
| | | } |
| | | else |
| | | { |
| | | var sb = new StringBuilder(); |
| | | sb.AppendLine("<s:Envelope s:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\" xmlns:s=\"http://schemas.xmlsoap.org/soap/envelope/\">"); |
| | | sb.AppendLine("<s:Body>"); |
| | | sb.AppendLine("<u:SetVolume xmlns:u=\"urn:schemas-upnp-org:service:RenderingControl:1\">"); |
| | | sb.AppendLine("<InstanceID>0</InstanceID>"); |
| | | sb.AppendLine("<Channel>Master</Channel>"); |
| | | sb.AppendLine("<DesiredVolume>" + volume + "</DesiredVolume>"); |
| | | sb.AppendLine("</u:SetVolume>"); |
| | | sb.AppendLine("</s:Body>"); |
| | | sb.AppendLine("</s:Envelope>"); |
| | | |
| | | var webClient =new System.Net.WebClient(); |
| | | webClient.Headers.Add("SOAPACTION", "\"urn:schemas-upnp-org:service:RenderingControl:1#SetVolume\""); |
| | | webClient.Headers.Add("CONTENT-TYPE", "text/xml; charset=\"utf-8\""); |
| | | webClient.UploadData(new Uri("http://" + IPAddress + ":" + Port + "/upnp/control/rendercontrol1"), "POST", Encoding.UTF8.GetBytes(sb.ToString())); |
| | | } |
| | | } |
| | | catch { } |
| | | }); |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | } |