| | |
| | | var webClient = new Shared.Net.MyWebClient (2000); |
| | | return webClient.DownloadString (url); |
| | | } catch (Exception e) { |
| | | System.Console.WriteLine (e.Message); |
| | | Utlis.WriteLine (e.Message); |
| | | return null; |
| | | } |
| | | } |
| | |
| | | thread.Abort (); |
| | | } |
| | | } catch (Exception e) { |
| | | System.Console.WriteLine (e.Message); |
| | | Utlis.WriteLine (e.Message); |
| | | } |
| | | } |
| | | } |
| | |
| | | threadLists.Remove (thread); |
| | | thread.Abort (); |
| | | } catch (Exception e) { |
| | | System.Console.WriteLine (e.Message); |
| | | Utlis.WriteLine (e.Message); |
| | | } |
| | | } |
| | | } |
| | |
| | | } |
| | | } |
| | | } |
| | | } catch (Exception e) { System.Console.WriteLine (e.Message); } |
| | | } catch (Exception e) { Utlis.WriteLine (e.Message); } |
| | | } |
| | | |
| | | } catch (Exception e) { System.Console.WriteLine (e.Message); } finally { |
| | | } catch (Exception e) { Utlis.WriteLine (e.Message); } finally { |
| | | Application.RunOnMainThread (() => { |
| | | MainPage.Loading.Hide (); |
| | | if (d) { |
| | |
| | | a31MusicModel.IsCanShow = true; |
| | | a31MusicModel.IsOnLine = true; |
| | | } |
| | | } catch (Exception e) { System.Console.WriteLine (e.Message); } |
| | | } catch (Exception e) { Utlis.WriteLine (e.Message); } |
| | | }); |
| | | } |
| | | } |
| | |
| | | try { |
| | | udpClient = new System.Net.Sockets.UdpClient (localPort); |
| | | break; |
| | | } catch (Exception e) { System.Console.WriteLine (e.Message); } |
| | | } catch (Exception e) { Utlis.WriteLine (e.Message); } |
| | | } |
| | | |
| | | System.Threading.Tasks.Task.Run (() => { |
| | |
| | | //如果1000毫秒没有数据回复,就关闭当前Socket,不再等待接收数据 |
| | | } |
| | | System.Threading.Thread.Sleep (500); |
| | | } catch (Exception e) { System.Console.WriteLine (e.Message); } |
| | | } catch (Exception e) { Utlis.WriteLine (e.Message); } |
| | | } |
| | | }); |
| | | while (true) { |
| | |
| | | try { |
| | | udpClient.Close (); |
| | | udpClient = null; |
| | | } catch (Exception e) { System.Console.WriteLine (e.Message); } |
| | | } catch (Exception e) { Utlis.WriteLine (e.Message); } |
| | | break; |
| | | } |
| | | |
| | |
| | | //一行一行数据判断,找出需要的信息 |
| | | while ((tempLine = sr.ReadLine ()) != null) { |
| | | //找出Ip地址相关的信息 |
| | | //System.Console.WriteLine (tempLine); |
| | | //Utlis.WriteLine (tempLine); |
| | | if (tempLine.StartsWith ("LOCATION: http://")) { |
| | | tempLine = tempLine.Replace ("LOCATION: http://", "").Split ('/') [0]; |
| | | string [] ipAndPort = tempLine.Split (':'); |
| | |
| | | try { |
| | | udpClient.Close (); |
| | | udpClient = null; |
| | | } catch (Exception e) { System.Console.WriteLine (e.Message); } |
| | | } catch (Exception e) { Utlis.WriteLine (e.Message); } |
| | | break; |
| | | } |
| | | } |
| | | } catch (Exception e) { System.Console.WriteLine (e.Message); } |
| | | } catch (Exception e) { Utlis.WriteLine (e.Message); } |
| | | } |
| | | }); |
| | | } |
| | |
| | | } |
| | | #endregion |
| | | } catch (Exception e) { |
| | | System.Console.WriteLine (e.Message); |
| | | Utlis.WriteLine (e.Message); |
| | | } |
| | | refreshUI (a31image, a31player, a31horizontalSeekBarvol, a31btnPlayMusic, a31palyername, a31currentMusic, a31currentartist, serverOrClientBtn, a31frameLayout, colorBtn); |
| | | }); |
| | |
| | | a31currentMusic.Enable = false; |
| | | } |
| | | } catch (Exception e) { |
| | | System.Console.WriteLine (e.Message); |
| | | Utlis.WriteLine (e.Message); |
| | | } |
| | | } |
| | | |
| | |
| | | a31MusicModel.A31PlayStatus.TrackURL = se.SearchForTextOfTag ("TrackURI"); |
| | | |
| | | } catch (Exception ex) { |
| | | Console.WriteLine (ex.Message); |
| | | Utlis.WriteLine (ex.Message); |
| | | } |
| | | } |
| | | |
| | |
| | | string deviceType = null; |
| | | |
| | | while ((line = sr.ReadLine ()) != null) { |
| | | //System.Console.WriteLine (line); |
| | | //Utlis.WriteLine (line); |
| | | if (line.StartsWith ("<friendlyName>")) { |
| | | deviceName = line.Replace ("<friendlyName>", "").Replace ("</friendlyName>", ""); |
| | | } else if (line.StartsWith ("<manufacturer>")) { |
| | |
| | | } |
| | | |
| | | } catch (Exception e) { |
| | | System.Console.WriteLine (e.Message); |
| | | Utlis.WriteLine (e.Message); |
| | | } finally { |
| | | if (sr != null) { |
| | | sr.Close (); |
| | |
| | | try { |
| | | byte [] recevieBytes1 = webClient.DownloadData (new Uri ("http://" + a31.IPAddress + "/httpapi.asp?command=setPlayerCmd:" + cmd)); |
| | | } catch (Exception e) { |
| | | System.Console.WriteLine (e.Message); |
| | | Utlis.WriteLine (e.Message); |
| | | } |
| | | }); |
| | | } |