示例#1
0
 public static void SendOnTopTenChanged(TopTenCollection arg)
 {
     if (OnTopTenChanged != null)
     {
         OnTopTenChanged(null, arg);
     }
 }
示例#2
0
        public BackThread()
        {
            this._nowPlayObj     = new NowPlay();
            this._historyPlayObj = new HistoryPlayCollection();
            this._topTenObj      = new TopTenCollection();

            Global.OnNowPlayChanged += delegate
            {
                new Thread(new ThreadStart(delegate
                {
                    HistoryPlayObj = HistoryPlayCollection.CreateNewObject();
                    TopTenObj      = TopTenCollection.CreateNewObject();
                })).Start();
            };
        }
示例#3
0
        public static TopTenCollection CreateNewObject()
        {
            try
            {
                HttpWebRequest request = (HttpWebRequest)WebRequest.Create("http://eradio.ua/top_ten.php");
                var            data    = Encoding.ASCII.GetBytes("src=http://eradio.ua/rock/");
                request.Method      = "POST";
                request.ContentType = "application/x-www-form-urlencoded; charset=UTF-8";
                request.Headers.Add("Accept-Encoding", "gzip, deflate");
                request.ContentLength = data.Length;
                var stream = request.GetRequestStream();
                stream.Write(data, 0, data.Length);
                stream.Close();
                HttpWebResponse response         = (HttpWebResponse)request.GetResponse();
                Stream          streamResponse   = response.GetResponseStream();
                GZipStream      streamDecompress = new GZipStream(streamResponse, CompressionMode.Decompress);
                StreamReader    sr = new StreamReader(streamDecompress);
                string          s  = sr.ReadToEnd();
                sr.Close();

                string sPicture = "<img src=\"[^\"]*\"";
                string sArtist  = "</audio>[^-]*";
                string sTrack   = "- <span>[^<]*";
                string sSrcFile = "\" src=\"..[^\"]*";

                MatchCollection pictures = Regex.Matches(s, sPicture);
                MatchCollection artists  = Regex.Matches(s, sArtist);
                MatchCollection tracks   = Regex.Matches(s, sTrack);
                MatchCollection srcFiles = Regex.Matches(s, sSrcFile);

                TopTenCollection historyPlayObj = new TopTenCollection();
                for (int i = 0; i < artists.Count; i++)
                {
                    historyPlayObj._lstTopTen.Add(new TopTenItem
                    {
                        ImagePath   = pictures[i].Value.Remove(0, 10).Trim('"'),
                        ArtistName  = artists[i].Value.Remove(0, 9).Trim(' '),
                        TrackName   = tracks[i].Value.Remove(0, 8),
                        SrcFilePath = "http://eradio.ua" + srcFiles[i].Value.Remove(0, 9),
                        ImageBitmap = WebProvider.GetImageBitmapFromUrl(pictures[i].Value.Remove(0, 10).Trim('"'))
                    });
                }
                return(historyPlayObj);
            }
            catch { return(null); }
        }
示例#4
0
 public TopTenAdapter(Activity activity, TopTenCollection topTen)
 {
     _activity  = activity;
     _topTenObj = topTen;
 }
示例#5
0
文件: ActMain.cs 项目: shyshka/Eradio
 private void OnTopTenChanged(object obj, TopTenCollection arg)
 {
     RunOnUiThread(() => {
         lViewTopTen.Adapter = new TopTenAdapter(this, arg);
     });
 }