Пример #1
0
        /// <summary>
        /// Announces a new collection of package versions.
        /// </summary>
        /// <param name="versions">Collection of package versions.</param>
        /// <param name="token">Token of cancellation.</param>
        /// <inheritdoc />
        public async Task AnnounceAsync(IEnumerable <PackageVersion> versions, CancellationToken token)
        {
            EnsureArg.IsNotNull(versions, nameof(versions));

            versions = versions.Stale();

            packageVersionValidator.ConfirmAvailability(versions);

            var announcement = announcementFactory.CreateNew(new string[0], versions);

            await scheduleService.ScheduleAsync(announcement, token);
        }
Пример #2
0
        private void ExtractFusion(string fusionId, IDeployAnnouncement announcement)
        {
            EnsureArg.IsNotNullOrEmpty(fusionId, nameof(fusionId));
            EnsureArg.IsNotNull(announcement, nameof(announcement));

            var fusionConfig = GetFusionConfig(fusionId);

            var packageVersions = announcement
                                  .GetPackageVersions(fusionConfig.Id)
                                  .Stale();

            packageVersionValidator
            .ConfirmAvailability(packageVersions);

            using (var packageStream = new MemoryStream())
            {
                var fusion = fusionFactory
                             .CreateNew(packageStream);

                try
                {
                    fusionBuilder.Build(fusionConfig, fusion, packageVersions);
                }
                finally
                {
                    (fusion as IDisposable)?.Dispose();
                }

                using (var packageStreamReadable = new MemoryStream(packageStream.ToArray()))
                {
                    fusionExtractor.Extract(fusionConfig, packageStreamReadable);
                }
            }
        }