Пример #1
0
        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);
            }
        }
Пример #2
0
        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);
        }