public void TryChangeDownloadPackage(Hash packageId, bool start) { if (!packageRegistry.TryGetPackage(packageId, out LocalPackageInfo package) || package.LockProvider.IsMarkedToDelete) { return; } if (start) { packageDownloadManager.StartDownloadPackage(package); } else { packageDownloadManager.StopDownloadPackage(package); } }
public PackageResponse Package([FromBody] PackageRequest request) { if (!packageRegistry.TryGetPackage(request.PackageId, out LocalPackageInfo package) || package.LockProvider.IsMarkedToDelete) { return(new PackageResponse() { Found = false }); } return(new PackageResponse() { Found = true, Hashes = package.Hashes, BytesDownloaded = package.DownloadStatus.Data.DownloadedBytes }); }