Exemple #1
0
        public void Sync(Action result)
        {
            SyncDB sync = new SyncDB();

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

            sync.Sync((g) =>
            {
                databaseAll = g;
                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();
                }));
            });
        }
Exemple #2
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();
                }));
            });
        }