コード例 #1
0
ファイル: ContextFactory.cs プロジェクト: Mpit4365/teamcity
        private async Task <Result> AddEntry([NotNull] TarOutputStream archive, [NotNull] string filePathInArchive, [NotNull] Stream contentStream)
        {
            if (archive == null)
            {
                throw new ArgumentNullException(nameof(archive));
            }

            if (filePathInArchive == null)
            {
                throw new ArgumentNullException(nameof(filePathInArchive));
            }

            if (contentStream == null)
            {
                throw new ArgumentNullException(nameof(contentStream));
            }

            var entry = TarEntry.CreateTarEntry(filePathInArchive);

            entry.Size           = contentStream.Length;
            entry.TarHeader.Mode = Chmod; //chmod 755
            archive.PutNextEntry(entry);
            var result = await _streamService.Copy(contentStream, archive, $"Adding {filePathInArchive}");

            archive.CloseEntry();
            return(result);
        }