SharpZipLib中的zip压缩都是将文件进行压缩和解压缩(文件在压缩包中有一个entry),如何直接将内存中的数据进行zip压缩呢(不需要entry)?
------解决方案--------------------
直接流操作的吧,没用过sharpXXX,能移植个zlib更好
------解决方案--------------------
public static bool UnZip(Stream zipfilestren, string directoryName, string password,string strTotal)
{
bool ret = true;
try
{
IsolatedStorageFile file = IsolatedStorageFile.GetUserStoreForApplication();
{
ZipInputStream s = new ZipInputStream(zipfilestren);
if (password != null && password.Length > 0)
s.Password = password;
BinaryReader reader = new BinaryReader(s);
ZipEntry theEntry;
long sizezip = 0;
while ((theEntry = s.GetNextEntry()) != null)
{
string fileName = theEntry.Name;
if (fileName != String.Empty)
{
if (theEntry.CompressedSize == 0)
continue;
if (!theEntry.IsFile)
{