Ejemplo n.º 1
0
        /// <inheritdoc />
        public Package GetPackage(PackageDescription packageDescription)
        {
            var ret = new Package
                          {
                              PackageDescription = packageDescription,
                              PackageFileBytes = this.GetPackageFile(packageDescription),
                              PackageFileBytesRetrievalDateTimeUtc = DateTime.UtcNow,
                          };

            return ret;
        }
Ejemplo n.º 2
0
        /// <inheritdoc />
        public byte[] GetPackageFile(PackageDescription packageDescription)
        {
            if (string.Equals(packageDescription.Id, PackageDescription.NullPackageId, StringComparison.CurrentCultureIgnoreCase))
            {
                return null;
            }

            var workingDirectory = Path.Combine(
                this.defaultWorkingDirectory,
                "Down-" + DateTime.Now.ToString(DirectoryDateTimeToStringFormat));

            var packageFilePath = this.DownloadPackages(new[] { packageDescription }, workingDirectory).Single();
            var ret = File.ReadAllBytes(packageFilePath);

            // clean up temp files
            Directory.Delete(workingDirectory, true);

            return ret;
        }