示例#1
0
        private bool InstallProviderFromInstaller(Package provider, Link link, string fastPath, BootstrapRequest request)
        {
            switch (link.MediaType)
            {
            case Iso19770_2.MediaType.MsiPackage:
            case Iso19770_2.MediaType.MsuPackage:
                return(InstallPackageFile(provider, fastPath, request));

            case Iso19770_2.MediaType.PackageReference:
                // let the core figure out how to install this package
                var packages = PackageManagementService.FindPackageByCanonicalId(link.HRef.AbsoluteUri, request).ToArray();
                switch (packages.Length)
                {
                case 0:
                    request.Warning("Unable to resolve package reference '{0}'", link.HRef);
                    return(false);

                case 1:
                    return(InstallPackageReference(provider, fastPath, request, packages));

                default:
                    request.Warning("Package Reference '{0}' resolves to {1} packages.", packages.Length);
                    return(false);
                }

            default:
                request.Warning("Provider '{0}' with link '{1}' has unknown media type '{2}'.", provider.Name, link.HRef, link.MediaType);
                return(false);
            }
        }
示例#2
0
        private bool InstallPackageFile(Package provider, string fastPath, BootstrapRequest request)
        {
            // we can download and verify this package and get the core to install it.
            var file = request.DownloadAndValidateFile(provider.Name, provider._swidtag.Links.Where(each => each.Relationship == Iso19770_2.Relationship.InstallationMedia));

            if (file != null)
            {
                // we have a valid file.
                // run the installer
                if (request.ProviderServices.Install(file, "", request))
                {
                    // it installed ok!
                    request.YieldFromSwidtag(provider, fastPath);
                    PackageManagementService.LoadProviders(request.As <IRequest>());
                    return(true);
                }
                request.Warning(Constants.Messages.FailedProviderBootstrap, fastPath);
            }
            return(false);
        }
示例#3
0
        private bool InstallProviderFromInstaller(Package provider, Link link, string fastPath, BootstrapRequest request)
        {
            switch (link.MediaType) {
                case Iso19770_2.MediaType.MsiPackage:
                case Iso19770_2.MediaType.MsuPackage:
                    return InstallPackageFile(provider, fastPath, request);

                case Iso19770_2.MediaType.PackageReference:
                    // let the core figure out how to install this package
                    var packages = PackageManagementService.FindPackageByCanonicalId(link.HRef.AbsoluteUri, request).ToArray();
                    switch (packages.Length) {
                        case 0:
                            request.Warning("Unable to resolve package reference '{0}'", link.HRef);
                            return false;

                        case 1:
                            return InstallPackageReference(provider, fastPath, request, packages);

                        default:
                            request.Warning("Package Reference '{0}' resolves to {1} packages.", packages.Length);
                            return false;
                    }

                default:
                    request.Warning("Provider '{0}' with link '{1}' has unknown media type '{2}'.", provider.Name, link.HRef, link.MediaType);
                    return false;
            }
        }
示例#4
0
 private bool InstallPackageFile(Package provider, string fastPath, BootstrapRequest request)
 {
     // we can download and verify this package and get the core to install it.
     var file = request.DownloadAndValidateFile(provider.Name, provider._swidtag.Links.Where(each => each.Relationship == Iso19770_2.Relationship.InstallationMedia));
     if (file != null) {
         // we have a valid file.
         // run the installer
         if (request.ProviderServices.Install(file, "", request)) {
             // it installed ok!
             request.YieldFromSwidtag(provider, fastPath);
             PackageManagementService.LoadProviders(request.As<IRequest>());
             return true;
         }
         request.Warning(Constants.Messages.FailedProviderBootstrap, fastPath);
     }
     return false;
 }