Пример #1
0
        private IEnumerable <DynamicElement> GetProviders(BootstrapRequest request)
        {
            var master = request.DownloadSwidtag(_urls);

            if (master == null)
            {
                request.Warning(Constants.Messages.ProviderSwidtagUnavailable);
                return(Enumerable.Empty <DynamicElement>());
            }

            // they are looking for a provider
            // return all providers
            return(request.GetProviders(master));
        }
Пример #2
0
        // --- Finds packages ---------------------------------------------------------------------------------------------------
        /// <summary>
        /// </summary>
        /// <param name="name"></param>
        /// <param name="requiredVersion"></param>
        /// <param name="minimumVersion"></param>
        /// <param name="maximumVersion"></param>
        /// <param name="id"></param>
        /// <param name="request"></param>
        /// <returns></returns>
        public void FindPackage(string name, string requiredVersion, string minimumVersion, string maximumVersion, int id, BootstrapRequest request)
        {
            if (request == null)
            {
                throw new ArgumentNullException("request");
            }

            request.Debug("Calling 'Bootstrap::FindPackage'");

            var master = request.DownloadSwidtag(_urls);

            if (master == null)
            {
                request.Warning(Constants.Messages.ProviderSwidtagUnavailable);
                return;
            }

            if (name != null && name.EqualsIgnoreCase("oneget"))
            {
                // they are looking for OneGet itself.
                // future todo: let oneget update itself.
                return;
            }

            // they are looking for a provider
            if (string.IsNullOrWhiteSpace(name))
            {
                // return all providers
                var providers = request.GetProviders(master);
                foreach (var p in providers)
                {
                    request.YieldFromSwidtag(p, requiredVersion, minimumVersion, maximumVersion, name);
                }
            }
            else
            {
                // return just the one.
                var provider = request.GetProvider(master, name);
                if (provider != null)
                {
                    request.YieldFromSwidtag(provider, requiredVersion, minimumVersion, maximumVersion, name);
                }
            }

            // return any matches in the name
        }