public async Task DownloadPackageAsync(Version version, string destFilePath, IProgress <double> progress = null, CancellationToken cancellationToken = new CancellationToken()) { var downloadResourceResult = await _nugetHelper.DownloadPackageAsync(_packageMetadata, cancellationToken); using (var fileStream = File.OpenWrite(destFilePath)) { downloadResourceResult.PackageStream.CopyTo(fileStream); } }
public void DownloadPackage() { var downloadResourceResult = _nugetHelper.DownloadPackageAsync(TestPackageName, true, true).Result; var tempLocation = Directory.CreateDirectory("Temp\\DownloadedMod"); NugetHelper.ExtractPackageContent(downloadResourceResult, tempLocation.FullName); // Check ModConfig.json exists. string modConfigLocation = $"{tempLocation.FullName}\\ModConfig.json"; Assert.True(File.Exists(modConfigLocation)); Directory.Delete(tempLocation.FullName, true); }