Exemple #1
0
        private void downloadAllDlcsToolStripMenuItem_Click(object sender, EventArgs e)
        {
            foreach (ListViewItem itm in lstTitles.SelectedItems)
            {
                var parrent = (itm.Tag as Item);

                foreach (var a in parrent.DlcItm)
                {
                    bool contains = false;
                    foreach (var d in downloads)
                    {
                        if (d.currentDownload == a)
                        {
                            contains = true;
                            break; //already downloading
                        }
                    }

                    if (!contains)
                    {
                        DownloadWorker dw = new DownloadWorker(a, this);
                        lstDownloadStatus.Items.Add(dw.lvi);
                        lstDownloadStatus.AddEmbeddedControl(dw.progress, 3, lstDownloadStatus.Items.Count - 1);
                        downloads.Add(dw);
                    }
                }
            }
        }
Exemple #2
0
        private void button3_Click(object sender, EventArgs e)
        {
            if (listView1.SelectedItems.Count == 0)
            {
                return;
            }
            var itm = (listView1.SelectedItems[0].Tag as LibraryItem);

            if (itm.isPkg == false)
            {
                return;
            }
            if (itm.itm == null)
            {
                MessageBox.Show("Não é possivel descompactar o PKG.");
                return;
            }

            if (itm.itm.ItsPS3 && itm.path.ToLower().Contains("packages"))
            {
                File.Move(itm.path, Settings.Instance.downloadDir + Path.DirectorySeparatorChar + Path.GetFileName(itm.path));
            }

            DownloadWorker dw = new DownloadWorker(itm.itm, this);

            dw.Start();
        }
Exemple #3
0
        private void button3_Click()
        {
            if (listView1.SelectedItems.Count == 0)
            {
                return;
            }
            var itm = (LibraryItem)listView1.SelectedItems[0];

            if (itm.isPkg == false)
            {
                return;
            }
            if (itm.itm == null)
            {
                MessageBox.Show("Can't unpack unknown pkg");
                return;
            }

            if (itm.itm.ItsPS3 && itm.path.ToLower().Contains("packages"))
            {
                File.Move(itm.path,
                          Settings.Instance.DownloadDir + Path.DirectorySeparatorChar + Path.GetFileName(itm.path));
            }

            var dw = new DownloadWorker(itm.itm);

            dw.Start();
        }
Exemple #4
0
        // Form
        private void NPSBrowser_FormClosing(object sender, FormClosingEventArgs e)
        {
            Settings.Instance.history.currentlyDownloading.Clear();

            foreach (var lstItm in lstDownloadStatus.Items)
            {
                DownloadWorker dw = ((lstItm as ListViewItem).Tag as DownloadWorker);

                Settings.Instance.history.currentlyDownloading.Add(dw);
            }

            Settings.Instance.selectedRegions.Clear();
            foreach (var a in cmbRegion.CheckBoxItems)
            {
                if (a.Checked)
                {
                    Settings.Instance.selectedRegions.Add(a.Text);
                }
            }

            Settings.Instance.selectedTypes.Clear();

            foreach (var a in cmbType.CheckBoxItems)
            {
                if (a.Checked)
                {
                    Settings.Instance.selectedTypes.Add(a.Text)
                    ;
                }
            }

            Settings.Instance.Save();
            NPCache.I.Save();
        }
Exemple #5
0
        private void toolStripMenuItem1_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(Settings.Instance.compPackUrl))
            {
                MessageBox.Show("No CompPack url");
                return;
            }

            if (lstTitles.SelectedItems.Count == 0)
            {
                return;
            }

            CompPack cp = new CompPack(this, lstTitles.SelectedItems[0].Tag as Item, (item) =>
            {
                foreach (var itm in item)
                {
                    DownloadWorker dw = new DownloadWorker(itm, this);
                    lstDownloadStatus.Items.Add(dw.lvi);
                    lstDownloadStatus.AddEmbeddedControl(dw.progress, 3, lstDownloadStatus.Items.Count - 1);
                    downloads.Add(dw);
                }
            });

            cp.ShowDialog();
        }
Exemple #6
0
        private void checkForPatchesAndDownload()
        {
            if (string.IsNullOrEmpty(Settings.Instance.HMACKey))
            {
                MessageBox.Show("No hmackey");
                return;
            }

            if (lstTitles.SelectedItems.Count == 0)
            {
                return;
            }


            foreach (var entry in lstTitles.SelectedItems)
            {
                GamePatches gp = new GamePatches(lstTitles.SelectedItems[0].Tag as Item, (item) =>
                {
                    DownloadWorker dw = new DownloadWorker(item, this);
                    lstDownloadStatus.Items.Add(dw.lvi);
                    lstDownloadStatus.AddEmbeddedControl(dw.progress, 3, lstDownloadStatus.Items.Count - 1);
                    downloads.Add(dw);
                });
                gp.DownloadUpdateNoAsk();
            }
        }
Exemple #7
0
 private void retryUnpackToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (lstDownloadStatus.SelectedItems.Count == 0)
     {
         return;
     }
     foreach (ListViewItem a in lstDownloadStatus.SelectedItems)
     {
         DownloadWorker itm = (a.Tag as DownloadWorker);
         itm.Unpack();
     }
 }
Exemple #8
0
 // lstDownloadStatus Menu Strip
 private void cancelToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (lstDownloadStatus.SelectedItems.Count == 0)
     {
         return;
     }
     foreach (ListViewItem a in lstDownloadStatus.SelectedItems)
     {
         DownloadWorker itm = (a.Tag as DownloadWorker);
         itm.Cancel();
         //itm.DeletePkg();
     }
 }
Exemple #9
0
        private void NoPayStationBrowser_Load(object sender, EventArgs e)
        {
            foreach (var hi in History.I.currentlyDownloading)
            {
                DownloadWorker dw = hi;
                dw.Recreate(this);
                lstDownloadStatus.Items.Add(dw.lvi);
                lstDownloadStatus.AddEmbeddedControl(dw.progress, 3, lstDownloadStatus.Items.Count - 1);
                downloads.Add(dw);
            }

            ServicePointManager.DefaultConnectionLimit = 30;
            LoadAllDatabaes(null, null);
        }
Exemple #10
0
        // Form
        private void NPSBrowser_FormClosing(object sender, FormClosingEventArgs e)
        {
            Settings.Instance.Store();
            History.I.currentlyDownloading.Clear();

            foreach (var lstItm in lstDownloadStatus.Items)
            {
                DownloadWorker dw = ((lstItm as ListViewItem).Tag as DownloadWorker);

                History.I.currentlyDownloading.Add(dw);
            }

            History.I.Save();
        }
Exemple #11
0
        private void button5_Click(object sender, EventArgs e)
        {
            if (lstDownloadStatus.SelectedItems.Count == 0)
            {
                return;
            }
            var            worker = lstDownloadStatus.SelectedItems[0];
            DownloadWorker itm    = (worker.Tag as DownloadWorker);

            if (File.Exists(itm.Pkg))
            {
                System.Diagnostics.Process.Start("explorer.exe", "/select, " + itm.Pkg);
            }
        }
Exemple #12
0
        //private void rbnPSM_CheckedChanged(object sender, EventArgs e)
        //{
        //    if (rbnPSM.Checked)
        //    {
        //        currentDatabase = psmDbs;
        //        txtSearch_TextChanged(null, null);
        //    }
        //}

        //private void rbnPSX_CheckedChanged(object sender, EventArgs e)
        //{
        //    if (rbnPSX.Checked)
        //    {
        //        currentDatabase = psxDbs;
        //        txtSearch_TextChanged(null, null);
        //    }
        //}

        // Download
        private void btnDownload_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(Settings.Instance.downloadDir) || string.IsNullOrEmpty(Settings.Instance.pkgPath))
            {
                MessageBox.Show("You don't have a proper configuration.", "Whoops!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                Options o = new Options();
                o.ShowDialog();
                return;
            }

            if (!File.Exists(Settings.Instance.pkgPath))
            {
                MessageBox.Show("You are missing your pkg dec.", "Whoops!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                Options o = new Options();
                o.ShowDialog();
                return;
            }

            if (lstTitles.SelectedItems.Count == 0)
            {
                return;
            }

            foreach (ListViewItem itm in lstTitles.SelectedItems)
            {
                var a = (itm.Tag as Item);

                bool contains = false;
                foreach (var d in downloads)
                {
                    if (d.currentDownload == a)
                    {
                        contains = true;
                        break; //already downloading
                    }
                }

                if (!contains)
                {
                    DownloadWorker dw = new DownloadWorker(a, this);
                    lstDownloadStatus.Items.Add(dw.lvi);
                    lstDownloadStatus.AddEmbeddedControl(dw.progress, 3, lstDownloadStatus.Items.Count - 1);
                    downloads.Add(dw);
                }
            }
        }
Exemple #13
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(Settings.instance.downloadDir) || string.IsNullOrEmpty(Settings.instance.pkgPath))
            {
                MessageBox.Show("You don't have proper config", "Whops!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                Options o = new Options();
                o.ShowDialog();
                return;
            }

            if (!File.Exists(Settings.instance.pkgPath))
            {
                MessageBox.Show("You missing your pkg dec", "Whops!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                Options o = new Options();
                o.ShowDialog();
                return;
            }

            if (listView1.SelectedItems.Count == 0)
            {
                return;
            }

            foreach (ListViewItem itm in listView1.SelectedItems)
            {
                var a = (itm.Tag as Item);


                foreach (var d in downloads)
                {
                    if (d.currentDownload == a)
                    {
                        return; //already downloading
                    }
                }
                DownloadWorker dw = new DownloadWorker(a, this);
                listViewEx1.Items.Add(dw.lvi);
                listViewEx1.AddEmbeddedControl(dw.progress, 3, listViewEx1.Items.Count - 1);
                downloads.Add(dw);
            }
        }
Exemple #14
0
 public DownloadWorkerItem(DownloadWorker worker, string title)
 {
     Worker = worker;
     Title  = title;
 }
Exemple #15
0
        //private void rbnPSM_CheckedChanged(object sender, EventArgs e)
        //{
        //    if (rbnPSM.Checked)
        //    {
        //        currentDatabase = psmDbs;
        //        txtSearch_TextChanged(null, null);
        //    }
        //}

        //private void rbnPSX_CheckedChanged(object sender, EventArgs e)
        //{
        //    if (rbnPSX.Checked)
        //    {
        //        currentDatabase = psxDbs;
        //        txtSearch_TextChanged(null, null);
        //    }
        //}

        // Download
        private void btnDownload_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(Settings.Instance.downloadDir) || string.IsNullOrEmpty(Settings.Instance.pkgPath))
            {
                MessageBox.Show("You don't have a proper configuration.", "Whoops!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                Options o = new Options(this);
                o.ShowDialog();
                return;
            }


            if (lstTitles.SelectedItems.Count == 0)
            {
                return;
            }
            List <Item> toDownload = new List <Item>();

            foreach (ListViewItem itm in lstTitles.SelectedItems)
            {
                var a = (itm.Tag as Item);

                if (a.pkg.EndsWith(".json"))
                {
                    WebClient p4client = new WebClient();
                    p4client.Credentials = CredentialCache.DefaultCredentials;
                    p4client.Headers.Add("user-agent", "MyPersonalApp :)");
                    string json = p4client.DownloadString(a.pkg);

                    JsonObject fields = SimpleJson.SimpleJson.DeserializeObject <JsonObject>(json);
                    JsonArray  pieces = fields["pieces"] as JsonArray;
                    foreach (JsonObject piece in pieces)
                    {
                        Item inneritm = new Item()
                        {
                            TitleId        = a.TitleId,
                            Region         = a.Region,
                            TitleName      = a.TitleName + " (Offset " + piece["fileOffset"].ToString() + ")",
                            offset         = piece["fileOffset"].ToString(),
                            pkg            = piece["url"].ToString(),
                            zRif           = a.zRif,
                            ContentId      = a.ContentId,
                            lastModifyDate = a.lastModifyDate,

                            ItsPsp      = a.ItsPsp,
                            ItsPS3      = a.ItsPS3,
                            ItsPS4      = a.ItsPS4,
                            ItsPsx      = a.ItsPsx,
                            contentType = a.contentType,

                            IsAvatar = a.IsAvatar,
                            IsDLC    = a.IsDLC,
                            IsTheme  = a.IsTheme,
                            IsUpdate = a.IsUpdate,

                            DlcItm          = a.DlcItm,
                            ParentGameTitle = a.ParentGameTitle,
                        };

                        toDownload.Add(inneritm);
                    }
                }
                else
                {
                    toDownload.Add(a);
                }
            }

            foreach (var a in toDownload)
            {
                bool contains = false;
                foreach (var d in downloads)
                {
                    if (d.currentDownload == a)
                    {
                        contains = true;
                        break; //already downloading
                    }
                }

                if (!contains)
                {
                    if (a.IsDLC)
                    {
                        var gamesDb = GetDatabase();
                        var result  = gamesDb.FirstOrDefault(i => i.TitleId.StartsWith(a.TitleId.Substring(0, 9)))?.TitleName;
                        a.ParentGameTitle = result ?? string.Empty;
                    }

                    DownloadWorker dw = new DownloadWorker(a, this);
                    lstDownloadStatus.Items.Add(dw.lvi);
                    lstDownloadStatus.AddEmbeddedControl(dw.progress, 3, lstDownloadStatus.Items.Count - 1);
                    downloads.Add(dw);
                }
            }
        }