private static void TransferWorker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
            //needs error reporting
            formMain.HideProgressElements();

            isTransferInProgress = false;

            if (e.Cancelled)
            {
                formMain.UpdateProgressLabel($"Transfer cancelled; [{transferredFiles}/{totalFiles}] files transferred.");
            }
            else
            {
                formMain.UpdateProgressLabel($"Transfers complete. [{transferredFiles}/{totalFiles}] files transferred.");
            }

            //refresh the xciList and OLV
            //XciHelper.LoadXcis();
        }
Esempio n. 2
0
        private static void LoadXcis()
        {
            bool updatedXciCache = false;

            Log($"LoadXcis");
            formMain.UpdateToolStripLabel("Loading games..");
            formMain.olvList.EmptyListMsg = "Loading games..";

            Application.DoEvents();

            lock (pcListLock)
                xciOnPc = GetPcXcis();
            lock (sdListLock)
                xciOnSd = GetSdXcis();

            int progressCount = xciOnPc.Count + xciOnSd.Count;
            int progress      = 0;

            formMain.SetupProgressBar(0, progressCount, progress);

            lock (pcListLock)
            {
                for (int i = 0; i < xciOnPc.Count; i++)
                {
                    formMain.UpdateToolStripLabel($"Processing [{progress}/{progressCount}] {Path.GetFileName(xciOnPc[i].xciFilePath)} ");

                    xciOnPc[i] = RefreshGame(xciOnPc[i]);

                    if (Settings.config.defaultView == XciLocation.PC)
                    {
                        formMain.olvList.AddObject(xciOnPc[i]);
                    }

                    if (UpdateXciCache(xciOnPc[i]))
                    {
                        updatedXciCache = true;
                    }

                    progress++;
                    formMain.UpdateProgressBar(progress);
                }
            }

            lock (sdListLock)
            {
                for (int i = 0; i < xciOnSd.Count; i++)
                {
                    progress++;
                    formMain.UpdateProgressBar(progress);

                    formMain.UpdateToolStripLabel($"Processing [{progress}/{progressCount}] {Path.GetFileName(xciOnSd[i].xciFilePath)}");

                    if (xciOnSd[i].titleId == null)
                    {
                        xciOnSd[i] = RefreshGame(xciOnSd[i]);
                    }

                    xciOnSd[i].xciLocation = XciLocation.SD;

                    if (Settings.config.defaultView == XciLocation.SD)
                    {
                        formMain.olvList.AddObject(xciOnSd[i]);
                    }

                    if (UpdateXciCache(xciOnSd[i]))
                    {
                        updatedXciCache = true;
                    }
                }
            }

            if (updatedXciCache)
            {
                SaveXciCache();
            }

            formMain.HideProgressElements();
            formMain.UpdateToolStripLabel();

            isGameLoadingComplete = true;
        }