Exemplo n.º 1
0
        void DownloadFileCompleted(object sender, System.ComponentModel.AsyncCompletedEventArgs e)
        {
            PDL DataEvent = new PDL();

            if (e.Error == null)
            {
                GotImage(this, DataEvent);
                if (Globals.Downloaded == false)
                {
                    Globals.Downloaded = true;
                }
            }
            else
            {
                if (e.Error.InnerException != null)
                {
                    DataEvent.ImageErrorMessage = e.Error.InnerException.Message;
                }
                else
                {
                    DataEvent.ImageErrorMessage = e.Error.Message;
                }
                ImageError(this, DataEvent);
            }
        }
Exemplo n.º 2
0
        void GotDlcInfo(object sender, PDL e)
        {
            string PlData = e.DlcInfoData, fsData, dlcDesc, dlcType, dlcImgUrl, dlcPlatfrm;

            string[] Spl1, Spl2;

            if (PlData.Contains("\"default_sku\""))
            {
                Spl1    = Regex.Split(PlData.Replace("\\\"", "'"), "\"long_desc\":\"");
                Spl2    = Regex.Split(Spl1[1], "\"");
                dlcDesc = Spl2[0].Trim();
                dlcDesc = dlcDesc.Replace("\\r", "");
                dlcDesc = dlcDesc.Replace("\\n", "");
                dlcDesc = WebUtility.HtmlDecode(dlcDesc);
                dlcDesc = Regex.Replace(dlcDesc, "[^a-zA-Z0-9 -<>&,]", "");
                dlcDesc = Regex.Replace(dlcDesc, "<br>", "\n");
                dlcDesc = Regex.Replace(dlcDesc, "<.*?>", "");

                Spl1   = Regex.Split(PlData, "\"size\":");
                Spl2   = Regex.Split(Spl1[1], ",");
                fsData = Spl2[0].Trim().Replace("}]", "");;

                Spl1    = Regex.Split(PlData, "\"game_contentType\":\"");
                Spl2    = Regex.Split(Spl1[1], "\"");
                dlcType = Spl2[0].Trim();
                dlcType = WebUtility.HtmlDecode(dlcType);

                Spl1      = Regex.Split(PlData, "\"images\":");
                Spl1      = Regex.Split(Spl1[1], "\"url\":\"");
                Spl2      = Regex.Split(Spl1[1], "\"");
                dlcImgUrl = Spl2[0].Trim();

                Spl1       = Regex.Split(PlData, "\"playable_platform\",\"values\":\\[");
                Spl2       = Regex.Split(Spl1[1], "\\]");
                dlcPlatfrm = Spl2[0].Trim();
                dlcPlatfrm = Regex.Replace(dlcPlatfrm, "[^a-zA-Z0-9 -<>&,]", "");
                dlcPlatfrm = Regex.Replace(dlcPlatfrm, "\"", "");

                pictureBox1.ImageLocation = dlcImgUrl;
                pictureBox1.LoadAsync();

                label4.Text = dlcDesc.Replace("<br>", "\n");
                label5.Text = "Size: " + FileSize(fsData);

                if (dlcType == "null" || String.IsNullOrEmpty(dlcType))
                {
                    dlcType = "Unknown";
                }
                label6.Text = "Type: " + dlcType;
                label7.Text = "Platform: " + dlcPlatfrm;

                panel2.Visible = true;
            }
            else
            {
                AppLog("No dlc information");
            }
        }
Exemplo n.º 3
0
        void GotImage(object sender, PDL e)
        {
            string imagePath = AppDomain.CurrentDomain.BaseDirectory + "fake_dlc_temp/sce_sys/icon0";
            var    bitmap    = Bitmap.FromFile(imagePath + ".jpeg");

            bitmap.Save(imagePath + ".png", ImageFormat.Png);
            bitmap.Dispose();
            File.Delete(imagePath + ".jpeg");
            CreatePKG(selCid, selName, titleID, true);
        }
Exemplo n.º 4
0
        void GotDlcInfo(object sender, PDL e)
        {
            string PlData = e.DlcInfoData, fsData, fsUnit, fsValue, dlcDesc, dlcType, dlcImgUrl, dlcPlatfrm;

            string[] Spl1, Spl2;

            Spl1    = Regex.Split(PlData, "\"long-description\":\"");
            Spl2    = Regex.Split(Spl1[1], "\"");
            dlcDesc = Strings.Trim(Spl2[0]);
            dlcDesc = WebUtility.HtmlDecode(dlcDesc);
            dlcDesc = Regex.Replace(dlcDesc, "[^a-zA-Z0-9 -<>&,]", "");

            Spl1    = Regex.Split(PlData, "\"file-size\":{");
            Spl2    = Regex.Split(Spl1[1], "}");
            fsData  = Strings.Trim(Spl2[0]);
            Spl1    = Regex.Split(fsData, "\"unit\":\"");
            Spl2    = Regex.Split(Spl1[1], "\"");
            fsUnit  = Strings.Trim(Spl2[0]);
            Spl1    = Regex.Split(fsData, "\"value\":");
            fsValue = Strings.Trim(Spl1[1]);
            fsUnit  = WebUtility.HtmlDecode(fsUnit);

            Spl1    = Regex.Split(PlData, "\"game-content-type\":\"");
            Spl2    = Regex.Split(Spl1[1], "\"");
            dlcType = Strings.Trim(Spl2[0]);
            dlcType = WebUtility.HtmlDecode(dlcType);

            Spl1      = Regex.Split(PlData, "\"thumbnail-url-base\":\"");
            Spl2      = Regex.Split(Spl1[1], "\"");
            dlcImgUrl = Strings.Trim(Spl2[0]) + "?w=350&h=350";

            Spl1       = Regex.Split(PlData, "\"platforms\":\\[");
            Spl2       = Regex.Split(Spl1[1], "\\]");
            dlcPlatfrm = Strings.Trim(Spl2[0]);
            dlcPlatfrm = WebUtility.HtmlDecode(dlcPlatfrm);

            pictureBox1.ImageLocation = dlcImgUrl;
            pictureBox1.LoadAsync();

            label4.Text = dlcDesc.Replace("<br>", "\n");
            if (fsValue == "null" || String.IsNullOrEmpty(fsUnit))
            {
                fsValue = "0";
                fsUnit  = "Bytes";
            }
            label5.Text = "Size: " + fsValue + " " + fsUnit;
            if (dlcType == "null" || String.IsNullOrEmpty(dlcType))
            {
                dlcType = "Unknown";
            }
            label6.Text = "Type: " + dlcType;
            label7.Text = "Platform: " + dlcPlatfrm.Replace("\"", "");

            panel2.Visible = true;
        }
Exemplo n.º 5
0
        void GotManifest(object sender, PDL e)
        {
            string PlData = e.ManifestData;

            string[] Spl1, Spl2;
            Spl1 = Regex.Split(PlData, "\"url\":\"");
            for (int i = 1; i < Information.UBound(Spl1) + 1; i++)
            {
                Spl2          = Regex.Split(Spl1[i], "\"");
                textBox2.Text = textBox2.Text + Spl2[0] + Environment.NewLine;
            }
        }
Exemplo n.º 6
0
        void GetDlcInfo_DownloadStringCompleted(object sender, DownloadStringCompletedEventArgs e)
        {
            PDL DataEvent = new PDL();

            try
            {
                DataEvent.DlcInfoData = e.Result;
                GotDlcInfo(this, DataEvent);
            }
            catch (Exception ex)
            {
                if (ex.InnerException != null)
                {
                    DataEvent.DlcInfoErrorMessage = ex.InnerException.Message;
                }
                else
                {
                    DataEvent.DlcInfoErrorMessage = ex.Message;
                }
                DlcInfoError(this, DataEvent);
            }
        }
Exemplo n.º 7
0
 void ImageError(object sender, PDL e)
 {
     AppLog("IMAGE ERROR: " + e.ImageErrorMessage + Environment.NewLine + "Creating without icon0.png");
     CreatePKG(selCid, selName, titleID);
 }
Exemplo n.º 8
0
 void DlcInfoError(object sender, PDL e)
 {
     panel2.Visible = false;
     AppLog("ERROR: " + e.DlcInfoErrorMessage);
 }
Exemplo n.º 9
0
 void ManifestError(object sender, PDL e)
 {
     AppLog("ERROR: " + e.ManifestErrorMessage);
 }
Exemplo n.º 10
0
 void PkgListError(object sender, PDL e)
 {
     AppLog("ERROR: " + e.PkgListErrorMessage);
 }
Exemplo n.º 11
0
        void GotPkgList(object sender, PDL e)
        {
            string PlData = e.PkgListData;

            if (Strings.InStr(PlData, "titleid=") > 0)
            {
                string   ContentID, TmpTitle;;
                string[] Spl1, Spl2;

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

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

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

                Text = TmpTitle;

                if (ContentID.Length >= 19)
                {
                    Button3.Visible = true;
                    Button6.Visible = true;
                    pageNum         = 1;
                    htmBuffer       = string.Empty;
                    titleID         = Strings.Mid(ContentID, 8, 12);

                    switch (Strings.Mid(ContentID, 1, 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, pageNum);
                }
                else
                {
                    AppLog("ERROR: Invalid Content ID" + Environment.NewLine + "Failed to load content id for " + textBox1.Text);
                }
            }
            else
            {
                AppLog("ERROR: No XML content found.");
            }
        }
Exemplo n.º 12
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.");
            }
        }
Exemplo n.º 13
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.");
            }
        }
Exemplo n.º 14
0
 void SearchDataError(object sender, PDL e)
 {
     AppLog("ERROR: " + e.SearchDataErrorMessage);
 }
Exemplo n.º 15
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.");
            }
        }