CASCExplorer.ScanForm.ScanFile C# (CSharp) Method

ScanFile() private method

private ScanFile ( CASCFile file ) : void
file CASCFile
return void
        private void ScanFile(CASCFile file)
        {
            if (scanBackgroundWorker.CancellationPending)
                throw new OperationCanceledException();

            NumScanned++;

            var fileNames = scanner.ScanFile(file);

            if (fileNames.Any())
            {
                // only report progress when not skipping a file, it's faster that way
                int progress = (int)(NumScanned / (float)NumFiles * 100);

                scanBackgroundWorker.ReportProgress(progress, file.FullName);

                foreach (var fileName in fileNames)
                {
                    ulong hash = Hasher.ComputeHash(fileName);

                    if ((CASC.Root as WowRootHandler).IsUnknownFile(hash))
                    {
                        BeginInvoke((MethodInvoker)(() => UpdateFileNames(fileName, file.FullName)));
                    }
                }
            }
        }