private MutableEnumerable <string> FindFiles(string path) { if (FilesystemExtensions.LooksLikeAFilename(path)) { ProviderInfo providerInfo; var paths = GetResolvedProviderPathFromPSPath(path, out providerInfo).ReEnumerable(); return (paths.SelectMany( each => FilesystemExtensions.FileExists(each) ? CollectionExtensions.SingleItemAsEnumerable(each) : FilesystemExtensions.DirectoryExists(each) ? Directory.GetFiles(each) : Microsoft.PackageManagement.Internal.Constants.Empty) .ReEnumerable()); } return(Microsoft.PackageManagement.Internal.Constants.Empty.ReEnumerable()); }
public override bool ProcessRecordAsync() { // record the names in the collection. if (!CollectionExtensions.IsNullOrEmpty(Name)) { foreach (var name in Name) { DictionaryExtensions.GetOrAdd(_resultsPerName, name, () => null); } } // it's searching for packages. // we need to do the actual search for the packages now, // and hold the results until EndProcessingAsync() // where we can determine if we we have no ambiguity left. SearchForPackages(); return(true); }
protected virtual void SearchForPackages() { try { var providers = SelectedProviders.ToArray(); // filter the items into three types of searches _names = CollectionExtensions.IsNullOrEmpty(Name) ? CollectionExtensions.SingleItemAsEnumerable(string.Empty) : Name.Where(each => !IsUri(each) && !IsFile(each)).ToArray(); foreach (var n in _names) { Debug("Calling SearchForPackages. Name='{0}'", n); } ProcessRequests(providers.Where(pv => string.Equals(pv.ProviderName, "bootstrap", StringComparison.OrdinalIgnoreCase)).ToArray()); ProcessRequests(providers.Where(pv => !string.Equals(pv.ProviderName, "bootstrap", StringComparison.OrdinalIgnoreCase)).ToArray()); } catch (Exception ex) { Debug(ex.ToString()); } }