public IEnumerable <PackageProvider> SelectProviders(string providerName, IRequestObject requestObject)
        {
            if (providerName.Is())
            {
                // match with wildcards
                var results = _packageProviders.Values.Where(each => each.ProviderName.IsWildcardMatch(providerName)).ReEnumerable();
                if (results.Any())
                {
                    return(results.ByRef());
                }
                if (requestObject != null && !providerName.ContainsWildcards())
                {
                    // if the end user requested a provider that's not there. perhaps the bootstrap provider can find it.
                    if (RequirePackageProvider(null, providerName, Constants.MinVersion, requestObject))
                    {
                        // seems to think we found it.
                        if (_packageProviders.ContainsKey(providerName))
                        {
                            return(_packageProviders[providerName].SingleItemAsEnumerable().ByRef());
                        }
                    }
                    var hostApi = requestObject.As <IHostApi>();

                    // warn the user that that provider wasn't found.
                    hostApi.Warning(hostApi.FormatMessageString(Constants.Messages.UnknownProvider, providerName));
                }
                return(Enumerable.Empty <PackageProvider>().ByRef());
            }

            return(PackageProviders.ByRef());
        }
Ejemplo n.º 2
0
        public IEnumerable <PackageProvider> SelectProviders(string providerName, RequestImpl requestImpl)
        {
            if (providerName.Is())
            {
                // strict name match for now.
                if (_packageProviders.ContainsKey(providerName))
                {
                    return(_packageProviders[providerName].SingleItemAsEnumerable().ByRef());
                }

                if (requestImpl != null)
                {
                    // if the end user requested a provider that's not there. perhaps the bootstrap provider can find it.
                    if (RequirePackageProvider(null, providerName, Constants.MinVersion, requestImpl))
                    {
                        // seems to think we found it.
                        if (_packageProviders.ContainsKey(providerName))
                        {
                            return(_packageProviders[providerName].SingleItemAsEnumerable().ByRef());
                        }
                    }
                    var hostApi = requestImpl.As <IHostApi>();

                    // warn the user that that provider wasn't found.
                    hostApi.Warning(hostApi.FormatMessageString(Constants.UnknownProvider, providerName));
                }
                return(Enumerable.Empty <PackageProvider>().ByRef());
            }

            return(PackageProviders.ByRef());
        }