Esempio n. 1
0
        internal static async Task <bool> ScanFMs(List <FanMission> fmsToScan, FMScanner.ScanOptions scanOptions,
                                                  bool scanFullIfNew = false, bool hideBoxIfZip = false)
        {
            // NULL_TODO: Do we need this FM null check...?
            if (fmsToScan.Count == 0 || (fmsToScan.Count == 1 && fmsToScan[0] == null))
            {
                return(false);
            }

            bool scanningOne = fmsToScan.Count == 1;

            try
            {
                #region Show progress box or block UI thread

                if (hideBoxIfZip && scanningOne)
                {
                    Log(nameof(ScanFMs) + ": Scanning one", methodName: false);
                    // Just use a cheap check and throw up the progress box for .7z files, otherwise not. Not as
                    // nice as the timer method, but that can cause race conditions I don't know how to fix, so
                    // whatever.
                    if (fmsToScan[0].Archive.ExtIs7z())
                    {
                        Core.View.ShowProgressBox(ProgressTasks.ScanAllFMs);
                    }
                    else
                    {
                        // Block user input to the form to mimic the UI thread being blocked, because we're async
                        // here
                        Core.View.Block(true);
                        // Doesn't actually show the box, but shows the meter on the taskbar I guess?
                        Core.View.ShowProgressBox(ProgressTasks.ScanAllFMs, suppressShow: true);
                    }
                }
                else
                {
                    Core.View.ShowProgressBox(ProgressTasks.ScanAllFMs);
                }
Esempio n. 2
0
 internal static async Task <bool> ScanFM(FanMission fm, FMScanner.ScanOptions scanOptions) => await ScanFMs(new List <FanMission> {
     fm
 }, scanOptions, hideBoxIfZip : true);