internal static void Create(Models.FileTransportInfo fileTransferInfo) { if (fileTransferInfo.SourceIsDirectory == false) { throw new InvalidOperationException("File archive is not supported. Need to support folder only"); } using (System.IO.Stream outStream = System.IO.File.Create(fileTransferInfo.DestinationFullName)) { using (ICSharpCode.SharpZipLib.Tar.TarArchive tarArchive = ICSharpCode.SharpZipLib.Tar.TarArchive.CreateOutputTarArchive(outStream)) { tarArchive.RootPath = fileTransferInfo.BasePath.Replace(@"\", "/"); if (tarArchive.RootPath.EndsWith("/")) { tarArchive.RootPath = tarArchive.RootPath.Remove(tarArchive.RootPath.Length - 1); } AddDirectoryFilesToTar(tarArchive, fileTransferInfo.SourceFullNameWithBasePath, true); tarArchive.Close(); } } }