Пример #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
        }
Пример #3
0
        public void InstallPackage(string fastPath, BootstrapRequest request)
        {
            if (request == null)
            {
                throw new ArgumentNullException("request");
            }
            // ensure that mandatory parameters are present.
            request.Debug("Calling 'Bootstrap::InstallPackage'");

            // verify the package integrity (ie, check if it's digitally signed before installing)

            var master = request.DownloadSwidtag(_urls);

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

            var provider = request.GetProvider(master, fastPath);

            if (provider != null)
            {
                // install the 'package'

                if (provider.XPath("/swid:SoftwareIdentity/swid:Meta[@providerType = 'assembly']").Any())
                {
                    InstallAssemblyProvider(provider, fastPath, request);
                    return;
                }

                if (provider.XPath("/swid:SoftwareIdentity/swid:Meta[@providerType = 'psmodule']").Any())
                {
                    InstallModuleProvider(provider, fastPath, request);
                    return;
                }


                InstallProviderFromInstaller(provider, fastPath, request);
            }
            else
            {
                request.Error(ErrorCategory.InvalidData, fastPath, Constants.Messages.UnableToResolvePackage, fastPath);
            }
        }