private ConcurrentBag<string> ScanPCCList(bool isTree, List<string> pccs = null)
{
ProgBarUpdater.ChangeProgressBar(0, isTree ? Tree.numPCCs : pccs.Count);
ConcurrentBag<string> errors = new ConcurrentBag<string>();
OutputBoxPrintLn("Scanning Files and generating thumbnails...");
StatusUpdater.UpdateText("Scanned: 0/" + (isTree ? Tree.numPCCs : pccs.Count));
// KFreon: Begin parallel file scan
ParallelOptions po = new ParallelOptions();
po.MaxDegreeOfParallelism = NumThreads;
int count = 0;
object countlock = new object();
//DeepScanPCC(@"R:\Games\Origin Games\Mass Effect 3\BIOGame\CookedPCConsole\BIOG_HMM_HIR_PRO_R.pcc");
Parallel.For(0, isTree ? Tree.numPCCs : pccs.Count, po, (b, loopstate) =>
{
if (cts.IsCancellationRequested)
loopstate.Stop();
string file = isTree ? Tree.GetPCC(b) : pccs[b];
DebugOutput.PrintLn("Scanning: " + file);
if (!DeepScanPCC(file))
errors.Add(file);
lock (countlock)
count++;
if (count % 10 == 0)
this.Invoke(new Action(() =>
{
MainProgressBar.Increment(10);
StatusLabel.Text = "Scanning: " + count + " / " + (isTree ? Tree.numPCCs : pccs.Count);
}));
});
return errors;
}