Hi,
I am hitting my head at the wall and pulling my hair trying to figure out why since the xap format is a .zip file, I can't extract any files from it using the SharpZipLib (which by the way is great!). I get a message saying the compression method is not supported (256), I have tried to look for such a compression method but in the WinZip website mentions type 96 and 97 if I remember well, but nothing like 256.
This is very confusing since even the windows explorer can view the contents of the xap file when it is renamed as a zip file. (I also did that before openning the file with my program).
The exact exception is:
"Library cannot extract this entry. Version required is (256)"
Here is the C# code:
private void UnpackDll(String pXapFileName)
{
// pXapFileName includes the whole Path, ex. "C:\XapFiles\xyz.xap"
String sDllFullPath = pXapFileName.Replace(".zip", ".dll");
String sDllName = Path.GetFileName(pXapFileName).Replace(".zip", ".dll");
String sOutputDirectory = Path.GetDirectoryName(pXapFileName);
ZipInputStream OZIS = new ZipInputStream(File.OpenRead(pXapFileName));
ZipEntry OZE = OZIS.GetNextEntry();
while (OZE != null)
{
String sFileName = Path.GetFileName(OZE.Name);
if (sFileName == sDllName)
{
FileStream OFS = File.Create(sDllFullPath);
int iByteCounter = 2048;
Byte[ aBlock = new Byte[2048];
while (true)
{
iByteCounter = OZIS.Read(aBlock, 0, aBlock.Length);
if (iByteCounter > 0)
{
OFS.Write(aBlock, 0, iByteCounter);
}
else
{
break;
}
}
}
OZE = OZIS.GetNextEntry();
}
}
Is it something I am doing wrong? does SharpZipLib doesn't extract this kind of compression? Is there any workaround or some small modification I can do to the source code in order to make it work?
Any help will be greatly appreciated
Thanks in advance.