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

            string[] Spl1, Spl2, Spl3, Spl4;
            string   TmpTitle, TmpURL, TmpImgUrl, TmpType, TmpPlatForm;

            if (PlData.Contains("{\"bucket\":\""))
            {
                LV1.BeginUpdate();
                LV1.Items.Clear();
                Spl1 = Regex.Split(PlData, "{\"bucket\":\"");

                for (int i = 1; i < Spl1.Length; i++)
                {
                    if (Spl1[i].Contains("\"top_category\":\"add_on\"") || Spl1[i].Contains("\"top_category\":\"avatar\"") || Spl1[i].Contains("\"top_category\":\"theme\"") || Spl1[i].Contains("\"top_category\":\"game_content\""))
                    {
                        Spl3     = Regex.Split(Spl1[i], ",\"name\":\"");
                        Spl4     = Regex.Split(Spl3[1], "\"");
                        TmpTitle = Spl4[0].Trim();
                        TmpTitle = WebUtility.HtmlDecode(TmpTitle);
                        TmpTitle = Regex.Replace(TmpTitle, "[^a-zA-Z0-9 -<>&,]", "");
                        Spl3     = Regex.Split(Spl1[i], "/999/");
                        Spl4     = Regex.Split(Spl3[1], "/");
                        switch (Spl4[0].Trim().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;
                        }
                        TmpURL    = "https://store.playstation.com/" + titleRgn + "/product/" + Spl4[0].Trim();
                        Spl3      = Regex.Split(Spl1[i], "\"url\":\"");
                        Spl4      = Regex.Split(Spl3[1], "\"");
                        TmpImgUrl = Spl4[0].Trim();

                        Spl3        = Regex.Split(Spl1[i], "\"top_category\":\"");
                        Spl4        = Regex.Split(Spl3[1], "\"");
                        TmpType     = Spl4[0].Trim().ToUpper();
                        TmpPlatForm = "";
                        string[] TmpItem = { TmpTitle, TmpType, TmpPlatForm, TmpURL, TmpImgUrl };
                        var      LvItem  = new ListViewItem(TmpItem);
                        LV1.Items.Add(LvItem);
                    }
                }
                LV1.EndUpdate();
            }
            else if (PlData.Contains("\">Content</"))
            {
                LV1.BeginUpdate();
                LV1.Items.Clear();

                if (PlData.Contains("<h1>"))
                {
                    Spl1 = Regex.Split(PlData, "<h1>");
                    Spl2 = Regex.Split(Spl1[1], "</h1>");
                    Text = WebUtility.HtmlDecode(Spl2[0].Trim());
                }

                Spl1 = Regex.Split(PlData, "\">Content</");
                Spl2 = Regex.Split(Spl1[1], "</table>");

                Spl1 = Regex.Split(Spl2[0], "<a href=\"");

                for (int i = 1; i < Spl1.Length; i++)
                {
                    if (Spl1[i].Contains("<td>DLC</td>") || Spl1[i].Contains("<td>Avatar</td>") || Spl1[i].Contains("<td>Theme</td>") || Spl1[i].Contains("<td>Unknown</td>"))
                    {
                        Spl3     = Regex.Split(Spl1[i], ">");
                        Spl4     = Regex.Split(Spl3[1], "<");
                        TmpTitle = Spl4[0].Trim();
                        TmpTitle = WebUtility.HtmlDecode(TmpTitle);
                        TmpTitle = Regex.Replace(TmpTitle, "[^a-zA-Z0-9 -<>&,]", "");
                        Spl3     = Regex.Split(Spl1[i], "cell\">");
                        Spl4     = Regex.Split(Spl3[1], "<");
                        switch (Spl4[0].Trim().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;
                        }
                        TmpURL    = "https://store.playstation.com/" + titleRgn + "/product/" + Spl4[0].Trim();
                        TmpImgUrl = "";
                        TmpType   = "Unknown";
                        if (Spl1[i].Contains("<td>DLC</td>"))
                        {
                            TmpType = "DLC";
                        }
                        if (Spl1[i].Contains("<td>Avatar</td>"))
                        {
                            TmpType = "Avatar";
                        }
                        if (Spl1[i].Contains("<td>Theme</td>"))
                        {
                            TmpType = "Theme";
                        }
                        TmpPlatForm = "";
                        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 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.º 3
0
        void GotSearch(object sender, PDL e)
        {
            string PlData = e.SearchData;

            string[] Spl1, Spl3, Spl4;
            string   TmpTitle, TmpURL, TmpImgUrl, TmpID, TmpPlatForm;

            if (PlData.Contains("{\"bucket\":\""))
            {
                LV1.BeginUpdate();
                LV1.Items.Clear();
                Spl1 = Regex.Split(PlData, "{\"bucket\":\"");

                for (int i = 1; i < Spl1.Length; i++)
                {
                    if (Spl1[i].Contains("\"top_category\":\"downloadable_game\""))
                    {
                        Spl3     = Regex.Split(Spl1[i], "\"short_name\":\"");
                        Spl4     = Regex.Split(Spl3[1], "\"");
                        TmpTitle = Spl4[0].Trim();
                        TmpTitle = WebUtility.HtmlDecode(TmpTitle);
                        TmpTitle = Regex.Replace(TmpTitle, "[^a-zA-Z0-9 -<>&,]", "");
                        Spl3     = Regex.Split(Spl1[i], "/999/");
                        Spl4     = Regex.Split(Spl3[1], "/");
                        switch (Spl4[0].Trim().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;
                        }
                        TmpURL = "https://store.playstation.com/" + titleRgn + "/product/" + Spl4[0].Trim();
                        TmpID  = "GAME";

                        Spl3        = Regex.Split(Spl1[i], "\"url\":\"");
                        Spl4        = Regex.Split(Spl3[1], "\"");
                        TmpImgUrl   = Spl4[0].Trim();
                        TmpPlatForm = "";
                        string[] TmpItem = { TmpTitle, TmpID, TmpPlatForm, TmpURL, TmpImgUrl };
                        var      LvItem  = new ListViewItem(TmpItem);
                        LV1.Items.Add(LvItem);

                        if (Spl1[i].Contains("-CUSA") && TmpURL.Contains("-PPSA"))
                        {
                            Spl3 = Regex.Split(Spl1[i], "-CUSA");
                            Spl4 = Regex.Split(Spl3[1], "_00");
                            String cusaId = Spl4[0].Trim();
                            Spl3 = Regex.Split(TmpURL, "-PPSA");
                            Spl4 = Regex.Split(Spl3[1], "_00");
                            String ppsaId = Spl4[0].Trim();
                            TmpURL = TmpURL.Replace("-PPSA" + ppsaId, "-CUSA" + cusaId);
                            string[] TmpItem1 = { TmpTitle + " [CUSA" + cusaId + "]", TmpID, TmpPlatForm, TmpURL, TmpImgUrl };
                            var      LvItem1  = new ListViewItem(TmpItem1);
                            LV1.Items.Add(LvItem1);
                        }
                    }
                }
                LV1.EndUpdate();
            }
            else
            {
                AppLog("Nothing found in search.");
            }
        }