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); ScanProgressState state = new ScanProgressState(); state.NumFilesScanned = NumScanned; state.NumFilesTotal = NumFiles; state.CurrentFileName = file.FullName; scanBackgroundWorker.ReportProgress(progress, state); foreach (var fileName in fileNames) { ulong hash = Hasher.ComputeHash(fileName); if ((CASC.Root as WowRootHandler).IsUnknownFile(hash)) { BeginInvoke((MethodInvoker)(() => UpdateFileNames(fileName, file.FullName))); } } } }