Results 1 to 14 of 14

Thread: .tgz archive extraction in .NET

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Feb 2006
    Posts
    28

    .tgz archive extraction in .NET

    Hi,

    I'm looking for the ability to extract .tgz archives from a .NET application. From what I understand, .NET has libraries that handle gzip compression, but not tar.

    I've also found online the "SharpZipLib" utilities someone's written to support both tar and gzip compression.

    Has anyone used these, or have a better suggestion to offer? I'm new to .NET programming, and I'd like to be sure I'm taking the right approach before I dive in.

    Thanks,
    Drew

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: .tgz archive extraction in .NET

    I've never used tarballs before. Is TGZ a combination of TAR and GZIP? If so then I guess #ZipLib will do the job. I've made a CodeBank submission (see my signature) that wraps #ZipLib to make it friendlier to use, but I've only included ZIP support. You're welcome to use the source code as a basis to learn how to use #ZipLib for other formats though. The code is VB.NET but if you're using C# you could make use of the code converter link in my sig.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Feb 2006
    Posts
    28

    Re: .tgz archive extraction in .NET

    Quote Originally Posted by jmcilhinney
    I've never used tarballs before. Is TGZ a combination of TAR and GZIP? If so then I guess #ZipLib will do the job. I've made a CodeBank submission (see my signature) that wraps #ZipLib to make it friendlier to use, but I've only included ZIP support. You're welcome to use the source code as a basis to learn how to use #ZipLib for other formats though. The code is VB.NET but if you're using C# you could make use of the code converter link in my sig.
    Yes, tgz is a combination of tar and gzip...very common in the Linux environment.

    I'm writing in VB.NET, so if you could help and offer the code you have, that would be fantastic. I'm brand new to VB.NET, and I must admit I was a bit lost when I looked through the code for SharpZipLib. I have no idea how to merge it into the app I'm writing.

    Thanks,
    Drew

  4. #4
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: .tgz archive extraction in .NET

    Follow the ZIP link in my signature to my CodeBank submission. Like I said, it doesn't support anything but the ZIP format but to use #ZipLib with other formats it should just be a case of doing the same thing with the types that correspond to that format.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  5. #5

    Thread Starter
    Junior Member
    Join Date
    Feb 2006
    Posts
    28

    Re: .tgz archive extraction in .NET

    Quote Originally Posted by jmcilhinney
    Follow the ZIP link in my signature to my CodeBank submission. Like I said, it doesn't support anything but the ZIP format but to use #ZipLib with other formats it should just be a case of doing the same thing with the types that correspond to that format.
    Thank you so much...I'll look it over and come back if I have any questions.

    Drew

  6. #6

    Thread Starter
    Junior Member
    Join Date
    Feb 2006
    Posts
    28

    Re: .tgz archive extraction in .NET

    Quote Originally Posted by jmcilhinney
    Follow the ZIP link in my signature to my CodeBank submission. Like I said, it doesn't support anything but the ZIP format but to use #ZipLib with other formats it should just be a case of doing the same thing with the types that correspond to that format.
    I'm having trouble compiling #ZipLib. In AssemblyInfo.cs, it says Error: Use command line option '/keyfile' or appropriate project settings instead of 'AssemblyKeyFile'.

    I tried compiling in VisualStudio and SharpDevelop and get similar errors. I have no idea what this 'key' business is all about.

    Drew

  7. #7
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: .tgz archive extraction in .NET

    I think I just downloaded the precompiled version, given that I didn't really need or want to change their source.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  8. #8

    Thread Starter
    Junior Member
    Join Date
    Feb 2006
    Posts
    28

    Re: .tgz archive extraction in .NET

    Quote Originally Posted by jmcilhinney
    I think I just downloaded the precompiled version, given that I didn't really need or want to change their source.
    Alright...I'll track that down. I didn't know it existed.

  9. #9
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: .tgz archive extraction in .NET

    See attached screenshot.
    Attached Images Attached Images  
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  10. #10

    Thread Starter
    Junior Member
    Join Date
    Feb 2006
    Posts
    28

    Re: .tgz archive extraction in .NET

    I got my .tgz files extracting! Thanks for your help.

    I do have one more question, though. My app won't run without the dll included. Is there any way to statically link the #ziplib classes? Or should I just grab the relevant source files and include them with my project?

    Thanks,
    Drew

  11. #11
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: .tgz archive extraction in .NET

    You can distribute the #ZipLib library with your app with no issue. Unless you specify otherwise it will automatically be copied to your output folder so it is a simple task to distribute it with your app. The other option is install it in the Global Assembly Cache. I've never installed anything in the GAC myself so I don't know all the details. Either way, the #ZipLib library has to be present on the machine for your app to work. The advantage of using the GAC is that multiple apps can use the one library instead of providing their own copy every time.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  12. #12

    Thread Starter
    Junior Member
    Join Date
    Feb 2006
    Posts
    28

    Re: .tgz archive extraction in .NET

    Quote Originally Posted by jmcilhinney
    You can distribute the #ZipLib library with your app with no issue. Unless you specify otherwise it will automatically be copied to your output folder so it is a simple task to distribute it with your app. The other option is install it in the Global Assembly Cache. I've never installed anything in the GAC myself so I don't know all the details. Either way, the #ZipLib library has to be present on the machine for your app to work. The advantage of using the GAC is that multiple apps can use the one library instead of providing their own copy every time.
    Well, I'd really like this app to be a single file so people don't have to worry about grabbing the dll whenever they pass it around (it's not an installation). I'll try to compile the #ziplib source files into the project and see how that works.

    Drew

  13. #13
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: .tgz archive extraction in .NET

    Take a good look at the license for #ZipLib. You are not just free to do whatever you want with that source code. You may have to include a ReadMe or something specifying that you have used that code, and you may have to use the code in it's entirety. It may be that you are not allowed to compile it into your own assembly. I don't know what the conditions are but you should definitely check before you do anything.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  14. #14

    Thread Starter
    Junior Member
    Join Date
    Feb 2006
    Posts
    28

    Re: .tgz archive extraction in .NET

    Quote Originally Posted by jmcilhinney
    Take a good look at the license for #ZipLib. You are not just free to do whatever you want with that source code. You may have to include a ReadMe or something specifying that you have used that code, and you may have to use the code in it's entirety. It may be that you are not allowed to compile it into your own assembly. I don't know what the conditions are but you should definitely check before you do anything.
    It's licensed under the GPL, which means I can use it and modify it as long as I include the source with its distribution. I planned to do that anyway, since I'm writing this for a GPL licensed poject.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width