Ejemplo n.º 1
0
        void GotDlcList(object sender, PDL e)
        {
            string PlData = e.DlcListData;

            if (Strings.InStr(PlData, "cell__title") > 0)
            {
                string[] Spl1, Spl2, Spl3, Spl4;
                string   TmpTitle, TmpURL, TmpImgUrl, TmpType, TmpPlatForm;

                if (Strings.InStr(PlData, "paginator-control__end paginator-control__arrow-navigation internal-app-link ember-view") > 0)
                {
                    pageNum   = pageNum + 1;
                    htmBuffer = htmBuffer + PlData;
                    PDL1.GetDlcList(titleID, titleRgn, pageNum);
                }
                else
                {
                    htmBuffer = htmBuffer + PlData;
                    LV1.BeginUpdate();
                    LV1.Items.Clear();

                    Spl1 = Regex.Split(htmBuffer, "desktop-presentation__grid-cell__base");

                    for (int i = 1; i < Information.UBound(Spl1) + 1; i++)
                    {
                        Spl2 = Regex.Split(Spl1[i], "grid-cell__footer");

                        if (Strings.InStr(Spl2[0], "class=\"grid-cell__title\">") > 0)
                        {
                            Spl3 = Regex.Split(Spl2[0], "class=\"grid-cell__title\">");
                            Spl4 = Regex.Split(Spl3[1], "<");
                        }
                        else
                        {
                            Spl3 = Regex.Split(Spl2[0], "<span title=\"");
                            Spl4 = Regex.Split(Spl3[1], "\"");
                        }
                        TmpTitle = Strings.Trim(Spl4[0]);
                        TmpTitle = WebUtility.HtmlDecode(TmpTitle);

                        Spl3   = Regex.Split(Spl2[0], "a href=\"");
                        Spl4   = Regex.Split(Spl3[1], "\"");
                        TmpURL = "https://store.playstation.com" + Strings.Trim(Spl4[0]);

                        Spl3      = Regex.Split(Spl2[0], "img src=\"http");
                        Spl4      = Regex.Split(Spl3[1], "\"");
                        TmpImgUrl = "http" + Strings.Trim(Spl4[0]);

                        Spl3    = Regex.Split(Spl2[0], "left-detail--detail-2\">");
                        Spl4    = Regex.Split(Spl3[1], "<");
                        TmpType = Strings.Trim(Spl4[0]);
                        TmpType = WebUtility.HtmlDecode(TmpType);

                        Spl3        = Regex.Split(Spl2[0], "left-detail--detail-1\">");
                        Spl4        = Regex.Split(Spl3[1], "<");
                        TmpPlatForm = Strings.Trim(Spl4[0]);
                        TmpPlatForm = WebUtility.HtmlDecode(TmpPlatForm);

                        if (isAllowed(TmpType))
                        {
                            string[] TmpItem = { TmpTitle, TmpType, TmpPlatForm, TmpURL, TmpImgUrl };
                            var      LvItem  = new ListViewItem(TmpItem);
                            LV1.Items.Add(LvItem);
                        }
                    }
                    LV1.EndUpdate();
                }
            }
            else
            {
                AppLog("ERROR: No HTML content found.");
            }
        }
Ejemplo n.º 2
0
        void GotPkgList(object sender, PDL e)
        {
            string PlData = e.PkgListData;

            if (PlData.Contains("titleid="))
            {
                string   ContentID, TmpTitle;;
                string[] Spl1, Spl2;

                Spl1      = Regex.Split(PlData, "content_id=\"");
                Spl2      = Regex.Split(Spl1[1], "\"");
                ContentID = Spl2[0].Trim();

                Spl1        = Regex.Split(PlData, "manifest_url=\"");
                Spl2        = Regex.Split(Spl1[1], "\"");
                selManifest = Spl2[0].Trim();

                Spl1     = Regex.Split(PlData, "<title>");
                Spl2     = Regex.Split(Spl1[1], "</title>");
                TmpTitle = Spl2[0].Trim();
                TmpTitle = WebUtility.HtmlDecode(TmpTitle);
                Regex rgrep = new Regex("[^ -~]+");
                TmpTitle = rgrep.Replace(TmpTitle, "");
                Text     = TmpTitle;

                if (ContentID.Length >= 19)
                {
                    Button3.Visible = true;
                    htmBuffer       = string.Empty;
                    titleID         = ContentID.Substring(7, 12);

                    switch (ContentID.Substring(0, 1))
                    {
                    case "U":
                        titleRgn = "en-us";
                        break;

                    case "E":
                        titleRgn = "en-gb";
                        break;

                    case "I":
                        titleRgn = "en-us";
                        break;

                    default:
                        titleRgn = "ja-jp";
                        break;
                    }

                    PDL1.GetDlcList(titleID, titleRgn);
                }
                else
                {
                    AppLog("ERROR: Invalid Content ID" + Environment.NewLine + "Failed to load content id for " + textBox1.Text);
                }
            }
            else
            {
                AppLog("ERROR: No XML content found.");
            }
        }