/// <summary> /// Extracts <see cref="Archive"/>s to the <see cref="_store"/>. /// </summary> /// <param name="archives">The archives to extract over each other in order.</param> /// <param name="files">The downloaded archive files, indexes matching those in <paramref name="archives"/>.</param> /// <param name="manifestDigest">The digest the extracted archives should produce.</param> /// <exception cref="OperationCanceledException">An IO task was canceled from another thread.</exception> /// <exception cref="NotSupportedException">A file format, protocal, etc. is unknown or not supported.</exception> /// <exception cref="IOException">A downloaded file could not be written to the disk or extracted.</exception> /// <exception cref="ImplementationAlreadyInStoreException">There is already an <see cref="Implementation"/> with the specified <paramref name="manifestDigest"/> in the store.</exception> /// <exception cref="UnauthorizedAccessException">Write access to <see cref="IStore"/> is not permitted.</exception> /// <exception cref="DigestMismatchException">An <see cref="Implementation"/>'s <see cref="Archive"/>s don't match the associated <see cref="ManifestDigest"/>.</exception> private void ApplyArchives([NotNull, ItemNotNull] IList <Archive> archives, [NotNull, ItemNotNull] IList <TemporaryFile> files, ManifestDigest manifestDigest) { var archiveFileInfos = new ArchiveFileInfo[archives.Count]; for (int i = 0; i < archiveFileInfos.Length; i++) { archiveFileInfos[i] = new ArchiveFileInfo { Path = files[i].Path, SubDir = archives[i].Extract, Destination = archives[i].Destination, MimeType = archives[i].MimeType, StartOffset = archives[i].StartOffset, OriginalSource = archives[i].Href }; } _store.AddArchives(archiveFileInfos, manifestDigest, Handler); }