Home Forums .NET libraries Xceed Zip & Real-Time Zip for .NET Unzip TGZ and Z archives

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • User (Old forums)
    Member
    Post count: 23064
    #20181 |

    Hello,

    I am trying to extract TGZ and Z files using your libraries, but seems like I do not know how to do it.

    Is there any sample for such archive formats?

    Do you support them?

    Thanks.

    Imported from legacy forums. Posted by Yaniv (had 2141 views)

    User (Old forums)
    Member
    Post count: 23064

    Files having a .Z extension were compressed using the Unix “compress” utility.  We don’t support this compression format.

    However, a .tgz extension means that the file is actually a .tar.gzip archive.  They are synonymous. 

    Tar support is located in the Xceed.Tar.dll assembly, which also requires Xceed.GZip.dll, Xceed.FileSystem.dll and Xceed.Compression.dll.

    GZip support is located in the Xceed.GZip.dll, which also requires Xceed.FileSystem.dll and Xceed.Compression.dll. If you only need GZip support (without Tar), you don’t need Xceed.Tar.dll.

    We have this example in the section 7.2.1 of the FileSystem Snippet Explorer:

    using System;
    using System.IO;
    using System.Windows.Forms;
    using Xceed.FileSystem;
    using Xceed.Ftp;
    using Xceed.Tar;
    using Xceed.GZip;

    namespace Xceed.FileSystem.Samples.SnippetExplorer
    {
      public class Snippet
      {
        public void Example()
        {
          // We will connect to the following FTP server, using the specified
          // username and password. You must have rights to create and delete
          // stuff on that server for this sample to work.
          string hostname = “localhost”;
          string username = “anonymous”;
          string password = “guest”;
          // Always start with an FtpConnection.
          using( FtpConnection connection = new FtpConnection( hostname, username, password ) )
          {
            // We want to create a TAR.GZ archive on our FTP server.
            AbstractFile gzipFile = new FtpFile( connection, “Xceed.Test.tar.gz” );
            if( gzipFile.Exists )
              gzipFile.Delete();
           
            // This file can be seen as a folder containing a TAR file.
            AbstractFile tarFile = new GZippedFile( gzipFile, “Xceed.Test.tar” );
            // And we want to create a text file in that TAR archive.
            AbstractFile destFile = new TarredFile( tarFile, “Xceed.Test.txt” );
            // Any file can be written to, on disk or… in a Tar archive, itself
            // in a GZip archive, itself in an FTP server.
            using( StreamWriter writer = new StreamWriter( destFile.CreateWrite() ) )
            {
              string line = null;
              Console.WriteLine( “Please enter text to write. Enter an empty line to stop.” );
              while( ( line = Console.ReadLine() ).Length > 0 )
              {
                writer.WriteLine( line );
              }
            }
           
            // And reading that file is again as easy.
            using( StreamReader reader = new StreamReader( destFile.OpenRead() ) )
            {
              string line = null;
              Console.WriteLine( “File {0} contains:”, destFile.HostedFullName );
              while( ( line = reader.ReadLine() ) != null )
              {
                Console.WriteLine( ”  {0}”, line );
              }
            }      
          }
        }

        public Snippet( Xceed.Samples.SnippetExplorer.MainForm resultsForm )
        {
          m_resultsForm = resultsForm;
        }
       
        private Xceed.Samples.SnippetExplorer.MainForm m_resultsForm = null;
      }
    }

     

    Imported from legacy forums. Posted by Ghislain (had 1730 views)

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.