private Dictionary <string, ModuleInfo> DoGetModules(SoftwareInfo software, string basePath, IProgress <double> progress, CancellationToken token) { var productName = software.Product.Name; var modulesPath = ModuleProvider.GetPath(productName); if (modulesPath == null) { return(null); } var path = Path.Combine(basePath, modulesPath); if (!Directory.Exists(path)) { return(null); } token.ThrowIfCancellationRequested(); var extension = ModuleProvider.GetExtension(productName); var pattern = string.Format("*{0}", extension); var files = Directory.EnumerateFiles(path, pattern); var count = progress != null ? files.Count() : 0; var index = 0; var modules = new Dictionary <string, ModuleInfo>(); foreach (var file in files) { token.ThrowIfCancellationRequested(); AddFile(software, modulesPath, file, modules); if (progress != null) { progress.Report((double)(++index) / count); } } return(modules); }