473,698 Members | 2,234 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Zip Libraries in Framework 1.1

Hello,

Are there a class within the Framework that support zip
which Microsoft has written?

I'm aware of the open source SharpLibZip.

Thanks
Nov 16 '05 #1
15 4273
BuddyWork <an*******@disc ussions.microso ft.com> wrote:
Are there a class within the Framework that support zip
which Microsoft has written?

I'm aware of the open source SharpLibZip.


There's nothing in V1.0 or V1.1. V2.0 contains some support, although I
don't know what it's like offhand.

--
Jon Skeet - <sk***@pobox.co m>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 16 '05 #2
>V2.0 contains some support, although I don't know what it's like offhand.
That is very interesting.
Would you mind telling me from where you have got that information?

--
Regards,
Dennis JD Myrén
Oslo Kodebureau
"Jon Skeet [C# MVP]" <sk***@pobox.co m> wrote in message
news:MP******** *************** @msnews.microso ft.com...
BuddyWork <an*******@disc ussions.microso ft.com> wrote:
Are there a class within the Framework that support zip
which Microsoft has written?

I'm aware of the open source SharpLibZip.


There's nothing in V1.0 or V1.1. V2.0 contains some support, although I
don't know what it's like offhand.

--
Jon Skeet - <sk***@pobox.co m>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too

Nov 16 '05 #3
Hi,

Nop, nothing.

Use SharpLibZip, it's the best thatI know of.
Cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"BuddyWork" <an*******@disc ussions.microso ft.com> wrote in message
news:48******** *************** *****@phx.gbl.. .
Hello,

Are there a class within the Framework that support zip
which Microsoft has written?

I'm aware of the open source SharpLibZip.

Thanks

Nov 16 '05 #4
Well, that was a stupid question.
I guess it is in the BETA.

--
Regards,
Dennis JD Myrén
Oslo Kodebureau
"Dennis Myrén" <de****@oslokb. no> wrote in message
news:fS******** ***********@new s4.e.nsc.no...
V2.0 contains some support, although I don't know what it's like offhand.

That is very interesting.
Would you mind telling me from where you have got that information?

--
Regards,
Dennis JD Myrén
Oslo Kodebureau
"Jon Skeet [C# MVP]" <sk***@pobox.co m> wrote in message
news:MP******** *************** @msnews.microso ft.com...
BuddyWork <an*******@disc ussions.microso ft.com> wrote:
Are there a class within the Framework that support zip
which Microsoft has written?

I'm aware of the open source SharpLibZip.


There's nothing in V1.0 or V1.1. V2.0 contains some support, although I
don't know what it's like offhand.

--
Jon Skeet - <sk***@pobox.co m>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too


Nov 16 '05 #5
Dennis Myrén <de****@oslokb. no> wrote:
V2.0 contains some support, although I don't know what it's like offhand..

That is very interesting.
Would you mind telling me from where you have got that information?


http://msdn2.microsoft.com/library/S...mpression.aspx

--
Jon Skeet - <sk***@pobox.co m>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 16 '05 #6
That is awesome!

--
Regards,
Dennis JD Myrén
Oslo Kodebureau
"Jon Skeet [C# MVP]" <sk***@pobox.co m> wrote in message
news:MP******** *************** *@msnews.micros oft.com...
Dennis Myrén <de****@oslokb. no> wrote:
V2.0 contains some support, although I don't know what it's like offhand.

That is very interesting.
Would you mind telling me from where you have got that information?


http://msdn2.microsoft.com/library/S...mpression.aspx

--
Jon Skeet - <sk***@pobox.co m>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 16 '05 #7
I wrote this up a while ago, includes sample code:

How to use the compression routines in Visual Studio 2005
This is sort of an impractical example, but I whipped these up to see the
comparison between clear-text, gzip and deflate. This is a bit lame because
the Write() function takes an integer, so these can only read/write as many
bytes as an integer can hold.

Anyhow, if nothing else, these are quick, clean examples of how to
read/write zipped files - which can compress a text file upto 98% or 40:1

public class FileOper

{

/// <summary>

/// Private because all members are static

/// </summary>

private FileOper()

{

}

/// <summary>

/// Read the entire contents of a text file

/// </summary>

/// <param name="PathAndFi leName">The full path and filename to a text
file</param>

/// <returns>The contents of the file</returns>

public static string ReadTextFile(st ring PathAndFileName )

{

System.IO.FileS tream objStream = System.IO.File. OpenRead(PathAn dFileName);

int intLen = ((int)((objStre am.Length > int.MaxValue) ? int.MaxValue :
objStream.Lengt h));

byte[] bytTxt = new byte[intLen];

objStream.Read( bytTxt, 0, intLen);

objStream.Flush ();

objStream.Close ();

return System.Text.ASC IIEncoding.ASCI I.GetString(byt Txt);

}

/// <summary>

/// Write text to a text file

/// </summary>

/// <param name="PathAndFi leName">The full path and filename to a text
file</param>

/// <param name="DataToWri te">The contents to write to the file</param>

/// <returns>The length of the file after the write</returns>

public static long WriteTextFile(s tring PathAndFileName , string DataToWrite)

{

byte[] bytTxt = System.Text.ASC IIEncoding.ASCI I.GetBytes(Data ToWrite);

System.IO.FileS tream objStream = System.IO.File. Create(PathAndF ileName);

objStream.Write (bytTxt, 0, bytTxt.Length);

objStream.Flush ();

objStream.Close ();
System.IO.FileI nfo f = new System.IO.FileI nfo(PathAndFile Name);

return f.Length;

}

/// <summary>

/// Write text to a zip file using GZip

/// </summary>

/// <param name="PathAndFi lename">The full path and filename to a
file</param>

/// <param name="DataToWri te">The contents to write to the file</param>

/// <returns>The length of the file after the write</returns>

public static long WriteZipFile(st ring PathAndFilename , string DataToWrite)

{

byte[] bytTxt = System.Text.ASC IIEncoding.ASCI I.GetBytes(Data ToWrite);

System.IO.FileS tream objStream = System.IO.File. Create(PathAndF ilename);

System.IO.Compr ession.GZipStre am objZS = new
System.IO.Compr ession.GZipStre am(objStream,
System.IO.Compr ession.Compress ionMode.Compres s);

objZS.Write(byt Txt, 0, bytTxt.Length);

objZS.Flush();

objZS.Close();

System.IO.FileI nfo f = new System.IO.FileI nfo(PathAndFile name);

return f.Length;

}

/// <summary>

/// Read text from a GZipped text file

/// </summary>

/// <param name="PathAndFi leName">The full path and filename to a
file</param>

/// <returns>The contents of the file</returns>

public static string ReadZipFile(str ing PathAndFileName )

{

System.IO.FileS tream objStream = System.IO.File. OpenRead(PathAn dFileName);

System.IO.Compr ession.GZipStre am objZS = new
System.IO.Compr ession.GZipStre am(objStream,
System.IO.Compr ession.Compress ionMode.Decompr ess);

int intLen = ((int)((objStre am.Length > int.MaxValue) ? int.MaxValue :
objStream.Lengt h));

byte[] bytTxt = new byte[intLen];

objZS.Read(bytT xt, 0, intLen);

objZS.Flush();

objZS.Close();

return System.Text.ASC IIEncoding.ASCI I.GetString(byt Txt);

}

/// <summary>

/// Write text to a file using Deflate

/// </summary>

/// <param name="PathAndFi lename">The full path and filename to a
file</param>

/// <param name="DataToWri te"></param>

/// <returns>The length of the file after contents have been
written</returns>

public static long WriteDeflateFil e(string PathAndFilename , string
DataToWrite)

{

byte[] bytTxt = System.Text.ASC IIEncoding.ASCI I.GetBytes(Data ToWrite);

System.IO.FileS tream objStream = System.IO.File. Create(PathAndF ilename);

System.IO.Compr ession.DeflateS tream objZS = new
System.IO.Compr ession.DeflateS tream(objStream ,
System.IO.Compr ession.Compress ionMode.Compres s);

objZS.Write(byt Txt, 0, bytTxt.Length);

objZS.Flush();

objZS.Close();

System.IO.FileI nfo f = new System.IO.FileI nfo(PathAndFile name);

return f.Length;

}

/// <summary>

/// Read text from a Deflated text file

/// </summary>

/// <param name="PathAndFi leName">The full path and filename to a
file</param>

/// <returns>The contents of the file</returns>

public static string ReadDeflateFile (string PathAndFileName )

{

System.IO.FileS tream objStream = System.IO.File. OpenRead(PathAn dFileName);

System.IO.Compr ession.DeflateS tream objZS = new
System.IO.Compr ession.DeflateS tream(objStream ,
System.IO.Compr ession.Compress ionMode.Decompr ess);

int intLen = ((int)((objStre am.Length > int.MaxValue) ? int.MaxValue :
objStream.Lengt h));

byte[] bytTxt = new byte[intLen];

objZS.Read(bytT xt, 0, intLen);

objZS.Flush();

objZS.Close();

return System.Text.ASC IIEncoding.ASCI I.GetString(byt Txt);

}

}

"Dennis Myrén" <de****@oslokb. no> wrote in message
news:nb******** ***********@new s4.e.nsc.no...
That is awesome!

--
Regards,
Dennis JD Myrén
Oslo Kodebureau
"Jon Skeet [C# MVP]" <sk***@pobox.co m> wrote in message
news:MP******** *************** *@msnews.micros oft.com...
Dennis Myrén <de****@oslokb. no> wrote:
V2.0 contains some support, although I don't know what it's like
offhand. That is very interesting.
Would you mind telling me from where you have got that information?


http://msdn2.microsoft.com/library/S...mpression.aspx

--
Jon Skeet - <sk***@pobox.co m>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too

Nov 16 '05 #8
Thank you Drebin.
Currently i am using SharpZipLib but (with all respect to SharpZipLib)
built-in compression routines are preferred.

--
Regards,
Dennis JD Myrén
Oslo Kodebureau
"Drebin" <th*******@hotm ail.com> wrote in message
news:Fh******** ********@newssv r16.news.prodig y.com...
I wrote this up a while ago, includes sample code:

How to use the compression routines in Visual Studio 2005
This is sort of an impractical example, but I whipped these up to see the
comparison between clear-text, gzip and deflate. This is a bit lame
because
the Write() function takes an integer, so these can only read/write as
many
bytes as an integer can hold.

Anyhow, if nothing else, these are quick, clean examples of how to
read/write zipped files - which can compress a text file upto 98% or 40:1

public class FileOper

{

/// <summary>

/// Private because all members are static

/// </summary>

private FileOper()

{

}

/// <summary>

/// Read the entire contents of a text file

/// </summary>

/// <param name="PathAndFi leName">The full path and filename to a text
file</param>

/// <returns>The contents of the file</returns>

public static string ReadTextFile(st ring PathAndFileName )

{

System.IO.FileS tream objStream = System.IO.File. OpenRead(PathAn dFileName);

int intLen = ((int)((objStre am.Length > int.MaxValue) ? int.MaxValue :
objStream.Lengt h));

byte[] bytTxt = new byte[intLen];

objStream.Read( bytTxt, 0, intLen);

objStream.Flush ();

objStream.Close ();

return System.Text.ASC IIEncoding.ASCI I.GetString(byt Txt);

}

/// <summary>

/// Write text to a text file

/// </summary>

/// <param name="PathAndFi leName">The full path and filename to a text
file</param>

/// <param name="DataToWri te">The contents to write to the file</param>

/// <returns>The length of the file after the write</returns>

public static long WriteTextFile(s tring PathAndFileName , string
DataToWrite)

{

byte[] bytTxt = System.Text.ASC IIEncoding.ASCI I.GetBytes(Data ToWrite);

System.IO.FileS tream objStream = System.IO.File. Create(PathAndF ileName);

objStream.Write (bytTxt, 0, bytTxt.Length);

objStream.Flush ();

objStream.Close ();
System.IO.FileI nfo f = new System.IO.FileI nfo(PathAndFile Name);

return f.Length;

}

/// <summary>

/// Write text to a zip file using GZip

/// </summary>

/// <param name="PathAndFi lename">The full path and filename to a
file</param>

/// <param name="DataToWri te">The contents to write to the file</param>

/// <returns>The length of the file after the write</returns>

public static long WriteZipFile(st ring PathAndFilename , string
DataToWrite)

{

byte[] bytTxt = System.Text.ASC IIEncoding.ASCI I.GetBytes(Data ToWrite);

System.IO.FileS tream objStream = System.IO.File. Create(PathAndF ilename);

System.IO.Compr ession.GZipStre am objZS = new
System.IO.Compr ession.GZipStre am(objStream,
System.IO.Compr ession.Compress ionMode.Compres s);

objZS.Write(byt Txt, 0, bytTxt.Length);

objZS.Flush();

objZS.Close();

System.IO.FileI nfo f = new System.IO.FileI nfo(PathAndFile name);

return f.Length;

}

/// <summary>

/// Read text from a GZipped text file

/// </summary>

/// <param name="PathAndFi leName">The full path and filename to a
file</param>

/// <returns>The contents of the file</returns>

public static string ReadZipFile(str ing PathAndFileName )

{

System.IO.FileS tream objStream = System.IO.File. OpenRead(PathAn dFileName);

System.IO.Compr ession.GZipStre am objZS = new
System.IO.Compr ession.GZipStre am(objStream,
System.IO.Compr ession.Compress ionMode.Decompr ess);

int intLen = ((int)((objStre am.Length > int.MaxValue) ? int.MaxValue :
objStream.Lengt h));

byte[] bytTxt = new byte[intLen];

objZS.Read(bytT xt, 0, intLen);

objZS.Flush();

objZS.Close();

return System.Text.ASC IIEncoding.ASCI I.GetString(byt Txt);

}

/// <summary>

/// Write text to a file using Deflate

/// </summary>

/// <param name="PathAndFi lename">The full path and filename to a
file</param>

/// <param name="DataToWri te"></param>

/// <returns>The length of the file after contents have been
written</returns>

public static long WriteDeflateFil e(string PathAndFilename , string
DataToWrite)

{

byte[] bytTxt = System.Text.ASC IIEncoding.ASCI I.GetBytes(Data ToWrite);

System.IO.FileS tream objStream = System.IO.File. Create(PathAndF ilename);

System.IO.Compr ession.DeflateS tream objZS = new
System.IO.Compr ession.DeflateS tream(objStream ,
System.IO.Compr ession.Compress ionMode.Compres s);

objZS.Write(byt Txt, 0, bytTxt.Length);

objZS.Flush();

objZS.Close();

System.IO.FileI nfo f = new System.IO.FileI nfo(PathAndFile name);

return f.Length;

}

/// <summary>

/// Read text from a Deflated text file

/// </summary>

/// <param name="PathAndFi leName">The full path and filename to a
file</param>

/// <returns>The contents of the file</returns>

public static string ReadDeflateFile (string PathAndFileName )

{

System.IO.FileS tream objStream = System.IO.File. OpenRead(PathAn dFileName);

System.IO.Compr ession.DeflateS tream objZS = new
System.IO.Compr ession.DeflateS tream(objStream ,
System.IO.Compr ession.Compress ionMode.Decompr ess);

int intLen = ((int)((objStre am.Length > int.MaxValue) ? int.MaxValue :
objStream.Lengt h));

byte[] bytTxt = new byte[intLen];

objZS.Read(bytT xt, 0, intLen);

objZS.Flush();

objZS.Close();

return System.Text.ASC IIEncoding.ASCI I.GetString(byt Txt);

}

}

"Dennis Myrén" <de****@oslokb. no> wrote in message
news:nb******** ***********@new s4.e.nsc.no...
That is awesome!

--
Regards,
Dennis JD Myrén
Oslo Kodebureau
"Jon Skeet [C# MVP]" <sk***@pobox.co m> wrote in message
news:MP******** *************** *@msnews.micros oft.com...
Dennis Myrén <de****@oslokb. no> wrote:
> >V2.0 contains some support, although I don't know what it's like offhand. > That is very interesting.
> Would you mind telling me from where you have got that information?


http://msdn2.microsoft.com/library/S...mpression.aspx

--
Jon Skeet - <sk***@pobox.co m>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too


Nov 16 '05 #9
"Dennis Myrén" <de****@oslokb. no> wrote in message
news:0p******** ***********@new s4.e.nsc.no...
Currently i am using SharpZipLib but (with all respect to SharpZipLib)
built-in compression routines are preferred.


Looking at the docs Jon linked to and the code Drebin posted, it doesn't
seem directly comparable. SharpZipLib as I recall, creates proper Zip
files, just like PKZip or Winzip (multiple files with internal table of
contents). The framework's functions appear to just handle the compressing
of text (which, granted, is the hard part, but still leave you some work to
do).

--
Truth,
James Curran
Home: www.noveltheory.com Work: www.njtheater.com
Blog: www.honestillusion.com Day Job: www.partsearch.com
(note new day job!)
Nov 16 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
1719
by: jbailo | last post by:
I have been working with c#/dotnet and mono and also the Gtk toolkit ( I have used Qt as well). I am working on a java project at work too. My question is: why do we need to have local assemblies or libraries for link or run? Can't a single 'framework server' be set up on the Internet to sent the services of the framework?
5
1692
by: Cecil Westerhoff | last post by:
I just started with programming under linux with c++. I have programmed for years with Borland C++ Builder. So I have some experience. But I can not find the libraries for intenet stuff. (Ping, fetching a page, etc.) The only thing I found was a library for CGI. Can someone tell me where to find those libraries? Or for that mather where to look for libraries in general?
2
3051
by: Nicholas Witchey | last post by:
Does anyone know of a set of graphics libraries written in C#? My goal is to create a set of graphics images in memory then dump them to a file or network stream in any format. Unfortunately the System.Drawing classes all resolve down to calls in gdiplus.dll which are implemented natively. Basically, I would like to use the System.Drawing namespace, classes, and methods to manipulate bitmaps in memory but not have any fundamental...
2
2272
by: Yang Pang | last post by:
I have a project where the GUI is in VB.NET, the libraries in unmanaged C++ which is wrapped in managed C++ and compiled as DLL. The application runs fine on Windows 2000 with VC++ development environment installed, but fails to load on any Windows 2000 system with only the .NET Framework (tried .NET Framework SDK too) installed. Tried suggestions given in "Mixed DLL Loading Problem"
7
5204
by: Steve | last post by:
Hi, We have an application framework library that gets statically linked to any applications we produce. (Windows apps, but I don't think that matters here). The framework is based heavily on the STL and the API uses many STL constructs. Because of the static linking, and the fact that both app and framework are built by the same compiler, we don't have any problems.
6
2573
by: Chris Stankevitz | last post by:
At link time, MSVC determines some of my libraries are unused and doesn't link them into my exe. This undesirable feature causes problems when I employ the factory pattern. With the factory pattern, the app decides at run time which code to use. Is there a link option to turn of this feature? MSVC 7.1 .net 2003 69462-270-0000007-18536 Thanks,
3
18532
by: Fernando Chilvarguer | last post by:
Hello! I created a Class Library project in VS2005. Then, using VS, I was able to add a connection string to the project settings, which automaticaly created an app.config file for me. If I try to access the configuration using System.Configuration.ConfigurationManager, I get a NullException. The code: string connectionString =
2
4234
by: Mike | last post by:
In the previous version of the .net framework, system.configuration.configuration manager was available for use in Class Libraries. I'm now working with VS2005/framework 2.0 and it appears that this is not an option. Why is this class unavailable now in Class Libraries? I need it to reference a machine.config key on my webserver. Thanks.
4
3489
by: Nindi | last post by:
Hi I have a scenario with exceptions that I cannot explain. I have an exception class 'MyException' derived from 'std::exception' There are two libraries 'plugin' and 'framework' linked together by loading at runtime. The issue is that an exception of type 'MyException' is being thrown in
0
8674
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8604
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9157
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8861
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7728
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4619
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3046
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2330
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2001
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.