internal bool FindViaFile(PackageProvider packageProvider, string searchKey, string filePath) { var found = false; try { // found at least some files // this is probably the right path. //foreach (var file in filePaths) { var foundThisFile = false; using (var packages = packageProvider.FindPackageByFile(filePath, 0, this).CancelWhen(_cancellationEvent.Token)) { foreach (var p in packages) { foundThisFile = true; found = true; ProcessPackage(packageProvider, searchKey, p); } } if (foundThisFile == true) { lock (_filesWithoutMatches) { _filesWithoutMatches.Remove(filePath, searchKey); } } } catch { // didn't actually map to a filename ... keep movin' } // it doesn't look like we found any files. // either because we didn't find any file paths that match // or the provider couldn't make sense of the files. return(found); }
internal bool FindViaFile(PackageProvider packageProvider, string filePath) { var found = false; if (filePath.LooksLikeAFilename()) { // if it does have that it *might* be a file. // if we don't get back anything from this query // then fall thru to the next type // first, try to resolve the filenames try { ProviderInfo providerInfo = null; var files = GetResolvedProviderPathFromPSPath(filePath, out providerInfo).Where(File.Exists).ReEnumerable(); if (files.Any()) { // found at least some files // this is probably the right path. foreach (var file in files) { var foundThisFile = false; using (var packages = CancelWhenStopped(packageProvider.FindPackageByFile(file, 0, this))) { foreach (var p in packages) { foundThisFile = true; found = true; ProcessPackage(packageProvider, filePath, p); } } if (foundThisFile == false) { // one of the files we found on disk, isn't actually a recognized package // let's whine about this. Warning(Constants.FileNotRecognized, file); } } } } catch { // didn't actually map to a filename ... keep movin' } // it doesn't look like we found any files. // either because we didn't find any file paths that match // or the provider couldn't make sense of the files. } return(found); }