c# vs2008 and zip files

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Peted

    c# vs2008 and zip files

    Hello,

    Using VS2008 c#, 3.5

    can anyone advise me regarding interacting c# and zip files.

    Im being given a zip file, with im told a definte no changing
    directory structre of which i need to extract or navigate to a specfic
    file that may be of different name in each zip file but should be in
    the same directory structure each time.

    To emilniate the need to manually unzip the contents, i want to use a
    directory picker (or something) to be able to select the zip file and
    directly/programatically navigate the directory structure of the zip
    file, select the file in question and import it into my application.
    The file is a text file.

    Can i do this in c# dot net, without a 3rd party zip library. From
    what i have found c# could extract a zip file contents, but not if the
    zip file has directories ??

    Could anyone apply thier amazing intellect to this conundrum, and
    illuminate a poor wandering soul lost in the world of dotnet.


    any advice appreciated

    thanks

    Peter




  • Mark Rae [MVP]

    #2
    Re: c# vs2008 and zip files

    "Peted" wrote in message news:5csig415vi 0pl3ev5937p9jv9 5ik8gvaem@4ax.c om...
    Can I do this in C# without a 3rd party zip library? From
    what I have found C# could extract a zip file contents, but not if the
    zip file has directories ??
    >
    Could anyone apply thier amazing intellect to this conundrum, and
    illuminate a poor wandering soul lost in the world of .NET?
    According to Peter Bromberg, whose amazing intellect is well known round
    these parts, this is not possible natively.


    Peter's article suggests using this 3rd-party utility:
    ICSharpCode has 20 repositories available. Follow their code on GitHub.


    FWIW, I use this one: http://www.chilkatsoft.com/zip-features.asp


    --
    Mark Rae
    ASP.NET MVP


    Comment

    • =?ISO-8859-1?Q?G=F6ran_Andersson?=

      #3
      Re: c# vs2008 and zip files

      Peted wrote:
      Hello,
      >
      Using VS2008 c#, 3.5
      >
      can anyone advise me regarding interacting c# and zip files.
      >
      Im being given a zip file, with im told a definte no changing
      directory structre of which i need to extract or navigate to a specfic
      file that may be of different name in each zip file but should be in
      the same directory structure each time.
      >
      To emilniate the need to manually unzip the contents, i want to use a
      directory picker (or something) to be able to select the zip file and
      directly/programatically navigate the directory structure of the zip
      file, select the file in question and import it into my application.
      The file is a text file.
      >
      Can i do this in c# dot net, without a 3rd party zip library. From
      what i have found c# could extract a zip file contents, but not if the
      zip file has directories ??
      >
      Could anyone apply thier amazing intellect to this conundrum, and
      illuminate a poor wandering soul lost in the world of dotnet.
      >
      >
      any advice appreciated
      >
      thanks
      >
      Peter
      >
      The current version of the framework has no support for the zip file
      format. It can compress and decompress the data streams, but not read
      the file structure that contains the data streams.

      You either have to write the code yourself to read the file structure,
      or use third party code.

      --
      Göran Andersson
      _____
      Göran Anderssons privata hemsida.

      Comment

      • =?Utf-8?B?RmFtaWx5IFRyZWUgTWlrZQ==?=

        #4
        RE: c# vs2008 and zip files

        I am far from an amazing intellect, but the guys that developed sharpziplib
        are:

        ICSharpCode has 20 repositories available. Follow their code on GitHub.


        "Peted" wrote:
        Hello,
        >
        Using VS2008 c#, 3.5
        >
        can anyone advise me regarding interacting c# and zip files.
        >
        Im being given a zip file, with im told a definte no changing
        directory structre of which i need to extract or navigate to a specfic
        file that may be of different name in each zip file but should be in
        the same directory structure each time.
        >
        To emilniate the need to manually unzip the contents, i want to use a
        directory picker (or something) to be able to select the zip file and
        directly/programatically navigate the directory structure of the zip
        file, select the file in question and import it into my application.
        The file is a text file.
        >
        Can i do this in c# dot net, without a 3rd party zip library. From
        what i have found c# could extract a zip file contents, but not if the
        zip file has directories ??
        >
        Could anyone apply thier amazing intellect to this conundrum, and
        illuminate a poor wandering soul lost in the world of dotnet.
        >
        >
        any advice appreciated
        >
        thanks
        >
        Peter
        >
        >
        >
        >
        >

        Comment

        • Jeff Johnson

          #5
          Re: c# vs2008 and zip files

          <Petedwrote in message news:5csig415vi 0pl3ev5937p9jv9 5ik8gvaem@4ax.c om...
          can anyone advise me regarding interacting c# and zip files.
          Just another vote for SharpZipLib. Other than the actual compression
          routines, the code's pretty easy to follow. I've modified it to add
          functionality that didn't come "out of the box" and it wasn't hard at all.


          Comment

          • =?ISO-8859-1?Q?Arne_Vajh=F8j?=

            #6
            Re: c# vs2008 and zip files

            Peted wrote:
            Using VS2008 c#, 3.5
            >
            can anyone advise me regarding interacting c# and zip files.
            >
            Im being given a zip file, with im told a definte no changing
            directory structre of which i need to extract or navigate to a specfic
            file that may be of different name in each zip file but should be in
            the same directory structure each time.
            >
            To emilniate the need to manually unzip the contents, i want to use a
            directory picker (or something) to be able to select the zip file and
            directly/programatically navigate the directory structure of the zip
            file, select the file in question and import it into my application.
            The file is a text file.
            >
            Can i do this in c# dot net, without a 3rd party zip library. From
            what i have found c# could extract a zip file contents, but not if the
            zip file has directories ??
            >
            Could anyone apply thier amazing intellect to this conundrum, and
            illuminate a poor wandering soul lost in the world of dotnet.
            I like SharpZipLib pointe to by several other.

            If you for some reason have a problem using non-MS code you
            can check if you can install the J# redistributable and use
            vjslib.dll from that due to the fact that it is from MS.

            Then you can use the ZIP code in java.util.zip !

            Arne

            Comment

            • Cheeso

              #7
              Re: c# vs2008 and zip files

              On Oct 30, 6:31 pm, Arne Vajhøj <a...@vajhoej.d kwrote:
              Peted wrote:
              Using VS2008 c#, 3.5
              >
              can anyone advise me regarding interacting c# andzipfiles.
              >
              Im being given azipfile, with im told a definte no changing
              directory structre of which i need to extract or navigate to a specfic
              file that may be of different name in eachzipfile but should be in
              the same directory structure each time.
              >
              To emilniate the need to manually unzip the contents, i want to use a
              directory picker (or something)  to be able to select thezipfile and
              directly/programatically  navigate the directory structure of thezip
              file, select the file in question and import it into my application.
              The file is a text file.
              >
              Can i do this in c# dotnet, without a 3rd partyziplibrary . From
              what i have found c# could extract azipfile contents, but not if the
              zipfile has  directories ??
              >
              Could anyone apply thier amazing intellect to this conundrum, and
              illuminate a poor wandering soul lost in the world of dotnet.
              >
              I like SharpZipLib pointe to by several other.
              Also try www.codeplex.com/DotNetZip - simple and easy.
              Example:

              using (ZipFile zip = ZipFile.Read(Ex istingZipFile))
              {
              foreach (ZipEntry e in zip)
              {
              e.Extract(Targe tDirectory);
              }
              }

              >
              If you for some reason have a problem using non-MS code you
              can check if you can install the J# redistributable and use
              vjslib.dll from that due to the fact that it is from MS.
              >
              Then you can use theZIPcode in java.util.zip!
              >
              Don't do that. Too hard.



              Comment

              Working...