Close() public method

Closes the archive and releases any associated resources.
public Close ( ) : void
return void
Ejemplo n.º 1
0
        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();
                }
            }
        }