示例#1
0
        private void timer2_Tick(object sender, EventArgs e)
        {
            // Update view

            if (lstTitles.SelectedItems.Count == 0)
            {
                return;
            }
            Item itm = (lstTitles.SelectedItems[0].Tag as Item);

            if (itm != previousSelectedItem)
            {
                previousSelectedItem = itm;

                tokenSource.Cancel();
                tokenSource = new CancellationTokenSource();

                Task.Run(() =>
                {
                    Helpers.Renascene r = new Helpers.Renascene(itm);

                    if (r.imgUrl != null)
                    {
                        Invoke(new Action(() =>
                        {
                            ptbCover.LoadAsync(r.imgUrl);
                            label5.Text              = r.ToString();
                            lnkOpenRenaScene.Tag     = r.url;
                            lnkOpenRenaScene.Visible = true;
                        }));
                    }
                    else
                    {
                        Invoke(new Action(() =>
                        {
                            ptbCover.Image           = null;
                            label5.Text              = "";
                            lnkOpenRenaScene.Visible = false;
                        }));
                    }
                }, tokenSource.Token);
            }
        }
示例#2
0
        private void timer2_Tick(object sender, EventArgs e)
        {
            //update view

            if (listView1.SelectedItems.Count == 0)
            {
                return;
            }
            Item itm = (listView1.SelectedItems[0].Tag as Item);

            if (itm != previousSelectedItem)
            {
                previousSelectedItem = itm;

                tokenSource.Cancel();
                tokenSource = new CancellationTokenSource();

                Task.Run(() =>
                {
                    Helpers.Renascene r = new Helpers.Renascene(itm);

                    if (r.imgUrl != null)
                    {
                        Invoke(new Action(() =>
                        {
                            pictureBox1.LoadAsync(r.imgUrl);
                            label5.Text = r.ToString();
                        }));
                    }
                    else
                    {
                        Invoke(new Action(() =>
                        {
                            pictureBox1.Image = null;
                            label5.Text       = "";
                        }));
                    }
                }, tokenSource.Token);
            }
        }
示例#3
0
        private void listView1_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (listView1.SelectedItems.Count == 0)
            {
                return;
            }
            Item itm = (listView1.SelectedItems[0].Tag as Item);

            lbl_query_size.Text = "0 MB";

            Helpers.Renascene r = new Helpers.Renascene(itm.TitleId);

            if (r.imgUrl != null)
            {
                pictureBox1.LoadAsync(r.imgUrl);
                label5.Text = r.ToString();
            }
            else
            {
                pictureBox1.Image = null;
                label5.Text       = "";
            }
        }
示例#4
0
        private void timer2_Tick(object sender, EventArgs e)
        {
            // Update view

            if (lstTitles.SelectedItems.Count == 0)
            {
                return;
            }
            Item itm = (lstTitles.SelectedItems[0].Tag as Item);

            if (itm != previousSelectedItem)
            {
                previousSelectedItem = itm;

                tokenSource.Cancel();
                tokenSource = new CancellationTokenSource();

                Helpers.Renascene myRena = null;

                foreach (var ren in NPCache.I.renasceneCache)
                {
                    if (itm.Equals(ren.itm))
                    {
                        myRena = ren;
                    }
                }

                Task.Run(() =>
                {
                    if (myRena == null)
                    {
                        myRena = new Helpers.Renascene(itm);
                    }

                    if (myRena.imgUrl != null)
                    {
                        if (!NPCache.I.renasceneCache.Contains(myRena))
                        {
                            NPCache.I.renasceneCache.Add(myRena);
                        }

                        Invoke(new Action(() =>
                        {
                            //  ptbCover.Image = myRena.image;
                            ptbCover.LoadAsync(myRena.imgUrl);
                            label5.Text              = myRena.ToString();
                            lnkOpenRenaScene.Tag     = "https://www.google.com/search?safe=off&source=lnms&tbm=isch&sa=X&biw=785&bih=698&q=" + itm.TitleName + "%20" + itm.contentType;// r.url;
                            lnkOpenRenaScene.Visible = true;
                        }));
                    }
                    else
                    {
                        Invoke(new Action(() =>
                        {
                            ptbCover.Image           = null;
                            label5.Text              = "";
                            lnkOpenRenaScene.Visible = false;
                        }));
                    }
                }, tokenSource.Token);
            }
        }
示例#5
0
        public void Sync(Action result)
        {
            SyncDB sync = new SyncDB();

            sync.Owner = this;
            sync.Show();

            sync.Sync((g) =>
            {
                databaseAll = g;
                var dlcsDbs = GetDatabase("DLC").ToArray();

                string[] apps = new string[0];
                if (Directory.Exists(Settings.Instance.downloadDir + "\\app"))
                {
                    apps = Directory.GetDirectories(Settings.Instance.downloadDir + "\\app");
                }
                if (apps.Length > 0)
                {
                    foreach (var item in databaseAll)
                    {
                        if (apps.Contains(Settings.Instance.downloadDir + "\\app\\" + item.TitleId))
                        {
                            item.down = "S";
                            Task.Run(() =>
                            {
                                Helpers.Renascene myRena = new Helpers.Renascene(item);
                                if (myRena.imgUrl != null)
                                {
                                    if (!NPCache.I.renasceneCache.Contains(myRena))
                                    {
                                        NPCache.I.renasceneCache.Add(myRena);
                                    }
                                }
                            });
                        }
                        //verifica se tem DLC no disco
                        if (Directory.Exists(Settings.Instance.downloadDir + "\\addcont\\" + item.TitleId))
                        {
                            //pega o total de DLC
                            if (!item.IsAvatar && !item.IsDLC && !item.IsTheme && !item.IsUpdate && !item.ItsPsx)
                            {
                                item.CalculateDlCs(dlcsDbs);
                            }
                            //se tiver todos os DLC, marca como OK
                            if (Directory.GetDirectories(Settings.Instance.downloadDir + "\\addcont\\" + item.TitleId).Length == item.DLCs)
                            {
                                item.downDLC = "S";
                            }
                        }
                    }
                }

                Invoke(new Action(() =>
                {
                    FinalizeDBLoad();

                    NPCache.I.localDatabase = databaseAll;
                    NPCache.I.types         = types.ToList();
                    NPCache.I.regions       = regions.ToList();
                    NPCache.I.Save(DateTime.Now);
                    if (result != null)
                    {
                        result.Invoke();
                    }
                    sync.Close();
                }));
            });
        }