public IAsyncEnumerable <SoftwareIdentity> InstallPackage(SoftwareIdentity softwareIdentity, IHostApi requestObject) { if (requestObject == null) { throw new ArgumentNullException("requestObject"); } if (softwareIdentity == null) { throw new ArgumentNullException("softwareIdentity"); } // if the provider didn't say this was trusted, we should ask the user if it's ok. if (!softwareIdentity.FromTrustedSource) { try { if (!requestObject.ShouldContinueWithUntrustedPackageSource(softwareIdentity.Name, softwareIdentity.Source)) { requestObject.Warning(requestObject.FormatMessageString(Constants.Messages.UserDeclinedUntrustedPackageInstall, softwareIdentity.Name)); return(new EmptyAsyncEnumerable <SoftwareIdentity>()); } } catch { return(new EmptyAsyncEnumerable <SoftwareIdentity>()); } } return(new SoftwareIdentityRequestObject(this, requestObject ?? new object().As <IHostApi>(), request => Provider.InstallPackage(softwareIdentity.FastPackageReference, request), Constants.PackageStatus.Installed)); }
public bool ShouldContinueWithUntrustedPackageSource(string package, string packageSource) { if (CanCallHost) { return(_hostApi.ShouldContinueWithUntrustedPackageSource(package, packageSource)); } return(false); }
public bool ShouldContinueWithUntrustedPackageSource(string package, string packageSource) { return(_hostApi.ShouldContinueWithUntrustedPackageSource(package, packageSource)); }