Beispiel #1
0
        private void LoadHotGame(String str)
        {
            //绑定一个列表
            ObservableCollection <AppData> gameCollection = new ObservableCollection <AppData>();

            gamelist.ItemsSource = gameCollection;


            //循环添加AppData
            String bod = Regex.Split(str, @"<div class=""applications"">")[1];

            for (int i = 0; i < 4; i++)
            {
                AppData date = new AppData()
                {
                    Tag       = "/game/" + Regex.Split(bod, "game/")[i + 1].Split('"')[0],
                    Thumbnail = new Uri(Regex.Split(bod, "src=")[i + 1].Split('"')[1], UriKind.RelativeOrAbsolute),
                    Title     = Regex.Split(bod, @"sp-name""")[i + 1].Split('>')[1].Split('<')[0],
                    Describe  = Regex.Split(bod, @"sp-time""")[i + 1].Split('>')[1].Split('<')[0]
                };
                gameCollection.Add(date);
            }


            //循环添加AppData
            String body = Regex.Split(str, @"<div class=""game_left_three"">")[1];

            String[] bodys = Regex.Split(body, @"\n");
            for (int i = 0; i < 9; i++)
            {
                AppData date = new AppData()
                {
                    Tag       = bodys[i * 15 + 6].Split('"')[1].Split('/')[2],
                    Thumbnail = new Uri(bodys[i * 15 + 6 + 3].Split('"')[3], UriKind.RelativeOrAbsolute),
                    Title     = Web.ReplaceHtml(bodys[i * 15 + 6 + 5].Split('>')[1].Split('<')[0]),
                    Describe  = Web.ReplaceHtml(bodys[i * 15 + 6 + 7].Split('>')[1].Split('<')[0])
                };
                gameCollection.Add(date);
            }
        }
Beispiel #2
0
        private async void LaunchAppViewLoad(String str)
        {
            try { jstr = Web.ReplaceHtml(Regex.Split(Regex.Split(Regex.Split(str, "应用简介</p>")[1], @"<div class=""apk_left_title_info"">")[1], "</div>")[0].Trim()); } catch (Exception) { }
            try { vmstr = Web.ReplaceHtml(Regex.Split(Regex.Split(str, @"<p class=""apk_left_title_info"">")[2], "</p>")[0].Replace("<br />", "").Replace("<br/>", "").Trim()); } catch (Exception) { }
            try { dstr = Web.ReplaceHtml(Regex.Split(Regex.Split(str, @"<p class=""apk_left_title_info"">")[1], "</p>")[0].Replace("<br />", "").Replace("<br/>", "").Trim()); } catch (Exception) { }
            vstr  = Regex.Split(str, @"<p class=""detail_app_title"">")[1].Split('>')[1].Split('<')[0].Trim();
            mstr  = Regex.Split(str, @"<p class=""apk_topba_message"">")[1].Split('<')[0].Trim().Replace("\n", "").Replace(" ", "");
            nstr  = Regex.Split(str, @"<p class=""detail_app_title"">")[1].Split('<')[0].Trim();
            iurl  = Regex.Split(str, @"<div class=""apk_topbar"">")[1].Split('"')[1].Trim();
            vtstr = Regex.Split(str, "更新时间:")[1].Split('<')[0].Trim();
            rstr  = Regex.Split(str, @"<p class=""rank_num"">")[1].Split('<')[0].Trim();
            pstr  = Regex.Split(str, @"<p class=""apk_rank_p1"">")[1].Split('<')[0].Trim();

            //Download URI
            ddstr = Regex.Split(Regex.Split(Regex.Split(str, "function onDownloadApk")[1], "window.location.href")[1], @"""")[1];

            AppIconImage.Source = new BitmapImage(new Uri(iurl, UriKind.RelativeOrAbsolute));
            AppTitleText.Text   = nstr;
            AppVTText.Text      = vtstr;
            AppV2Text.Text      = vstr;
            AppVText.Text       = vstr;
            AppMText.Text       = Regex.Split(mstr, "/")[2] + " " + Regex.Split(mstr, "/")[3] + " " + rstr + "分";
            AppXText.Text       = Regex.Split(mstr, "/")[1] + " · " + Regex.Split(mstr, "/")[0];

            if (Regex.Split(str, @"<p class=""apk_left_title_info"">").Length > 3)
            {
                //当应用有点评
                AppVMText.Text    = vmstr;
                AppDText.Text     = dstr;
                DPanel.Visibility = Visibility.Visible;
            }
            else
            {
                //当应用无点评的时候(小编要是一个一个全好好点评我就不用加判断了嘛!)
                AppVMText.Text = dstr;
                AppDText.Text  = "";
            }
            if (dstr.Contains("更新时间") && dstr.Contains("ROM") && dstr.Contains("名称"))
            {
                UPanel.Visibility = Visibility.Collapsed;
            }


            //加载截图!
            String images = Regex.Split(Regex.Split(str, @"<div class=""ex-screenshot-thumb-carousel"">")[1], "</div>")[0];

            String[] imagearray = Regex.Split(images, "<img");
            for (int i = 0; i < imagearray.Length - 1; i++)
            {
                String imageUrl = imagearray[i + 1].Split('"')[1];
                if (!imageUrl.Equals(""))
                {
                    Image newImage = new Image
                    {
                        Height = 100,
                        //获得图片
                        Source = new BitmapImage(new Uri(imageUrl, UriKind.RelativeOrAbsolute))
                    };
                    //添加到缩略视图
                    ScreenShotView.Items.Add(newImage);
                }
            }
            images     = Regex.Split(Regex.Split(str, @"<div class=""carousel-inner"">")[1], @"<a class=""left carousel-control""")[0];
            imagearray = Regex.Split(images, "<img");
            for (int i = 0; i < imagearray.Length - 1; i++)
            {
                String imageurl = imagearray[i + 1].Split('"')[1];
                Image  newImage = new Image
                {
                    //获得图片
                    Source = new BitmapImage(new Uri(imageurl, UriKind.RelativeOrAbsolute))
                };
                //添加到视图
                ScreenShotFlipView.Items.Add(newImage);
            }

            //还有简介(丧心病狂啊)
            AppJText.Text = jstr;

            //评分。。
            AppRText.Text = rstr;
            AppPText.Text = pstr;
            //星星
            double rdob = Double.Parse(rstr);

            if (rdob > 4.5)
            {
            }
            else if (rdob > 3.0)
            {
                star5.Symbol = Symbol.OutlineStar;
            }
            else if (rdob > 4.0)
            {
                star4.Symbol = Symbol.OutlineStar;
                star5.Symbol = Symbol.OutlineStar;
            }
            else if (rdob > 3.0)
            {
                star3.Symbol = Symbol.OutlineStar;
                star4.Symbol = Symbol.OutlineStar;
                star5.Symbol = Symbol.OutlineStar;
            }
            else if (rdob < 2.0)
            {
                //没有评分那么差的应用吧233
                star2.Symbol = Symbol.OutlineStar;
                star3.Symbol = Symbol.OutlineStar;
                star4.Symbol = Symbol.OutlineStar;
                star5.Symbol = Symbol.OutlineStar;
            }


            //获取开发者
            String knstr = Web.ReplaceHtml(Regex.Split(Regex.Split(str, "开发者名称:")[1], "</p>")[0]);

            try
            {
                AppKNText.Text   = knstr;
                AppKImage.Source = new BitmapImage(new Uri(await CoolApkSDK.GetCoolApkUserFaceUri(knstr), UriKind.RelativeOrAbsolute));
            }
            catch (Exception)
            {
                KPanel.Visibility = Visibility.Collapsed;
            }
        }