Click here to Skip to main content
15,901,035 members
Home / Discussions / .NET (Core and Framework)
   

.NET (Core and Framework)

 
AnswerRe: how to use Indesign files in asp.net Pin
Pete O'Hanlon16-Oct-07 23:48
mvePete O'Hanlon16-Oct-07 23:48 
AnswerRe: how to use Indesign files in asp.net Pin
Pete O'Hanlon18-Oct-07 22:06
mvePete O'Hanlon18-Oct-07 22:06 
GeneralRe: how to use Indesign files in asp.net Pin
gopal_Pandey24-Oct-07 0:33
gopal_Pandey24-Oct-07 0:33 
QuestionExtracting .zip files Pin
Vipul Mehta16-Oct-07 6:25
Vipul Mehta16-Oct-07 6:25 
AnswerRe: Extracting .zip files Pin
Giorgi Dalakishvili16-Oct-07 6:49
mentorGiorgi Dalakishvili16-Oct-07 6:49 
GeneralRe: Extracting .zip files Pin
Vipul Mehta16-Oct-07 18:27
Vipul Mehta16-Oct-07 18:27 
AnswerRe: Extracting .zip files Pin
Shahar Gvirtz16-Oct-07 8:44
Shahar Gvirtz16-Oct-07 8:44 
AnswerRe: Extracting .zip files Pin
Vipul Mehta16-Oct-07 18:33
Vipul Mehta16-Oct-07 18:33 
Hi,
After implementing the following logic I get "The magic number in GZip header is not correct. Make sure you are passing in a GZip stream." error


string sourceFile = @"C:\Test\MyDocs.zip";
string destinationFile = @"C:\Test";

if (File.Exists(sourceFile) == false)
{
return;
}

FileStream sourceStream = null;
FileStream destinationStream = null;
GZipStream decompressedStream = null;

byte[] quartetBuffer;
int position;
int checkLength;
byte[] buffer;

try
{
sourceStream = new FileStream(sourceFile, FileMode.Open);
decompressedStream = new GZipStream(sourceStream, CompressionMode.Decompress, true);
quartetBuffer = new Byte[4];

position = Convert.ToInt32(sourceStream.Length) - 4;
sourceStream.Position = position;
sourceStream.Read(quartetBuffer, 0, quartetBuffer.Length);
sourceStream.Position = 0;
checkLength = BitConverter.ToInt32(quartetBuffer, 0);
buffer = new byte[checkLength + 100];
int offset = 0;
int total = 0;

while (true)
{
int bytesRead;
bytesRead = decompressedStream.Read(buffer, offset, 100);
if (bytesRead == 0)
{
break;
}
else
{
offset += bytesRead;
total += bytesRead;
}
}

// Now write everything to the destination file
destinationStream = new FileStream(destinationFile, FileMode.Create);
destinationStream.Write(buffer, 0, total);

// and flush everyhting to clean out the buffer
destinationStream.Flush();
}
catch (Exception ex)
{
}
finally
{
// Make sure we allways close all streams
if (sourceStream != null)
{
sourceStream.Close();
}

if (decompressedStream != null)
{
decompressedStream.Close();
}

if (destinationStream != null)
{
destinationStream.Close();
}
}

Can any body help me out?


Regards,
Vipul Mehta

AnswerRe: Extracting .zip files Pin
rtalan17-Oct-07 1:20
rtalan17-Oct-07 1:20 
GeneralRe: Extracting .zip files Pin
Vipul Mehta17-Oct-07 20:28
Vipul Mehta17-Oct-07 20:28 
AnswerRe: Extracting .zip files Pin
Mike Dimmick17-Oct-07 2:53
Mike Dimmick17-Oct-07 2:53 
QuestionVisual C++ with .NET Framework Pin
prithaa15-Oct-07 23:31
prithaa15-Oct-07 23:31 
AnswerRe: Visual C++ with .NET Framework Pin
Pete O'Hanlon16-Oct-07 2:15
mvePete O'Hanlon16-Oct-07 2:15 
AnswerRe: Visual C++ with .NET Framework Pin
rtalan17-Oct-07 0:25
rtalan17-Oct-07 0:25 
GeneralRe: Visual C++ with .NET Framework Pin
prithaa17-Oct-07 19:08
prithaa17-Oct-07 19:08 
GeneralRe: Visual C++ with .NET Framework Pin
rtalan18-Oct-07 0:19
rtalan18-Oct-07 0:19 
Question.NETCF compliance test? Pin
Member 9615-Oct-07 17:57
Member 9615-Oct-07 17:57 
AnswerRe: .NETCF compliance test? Pin
led mike16-Oct-07 6:33
led mike16-Oct-07 6:33 
GeneralRe: .NETCF compliance test? Pin
Member 9616-Oct-07 6:43
Member 9616-Oct-07 6:43 
GeneralRe: .NETCF compliance test? Pin
led mike16-Oct-07 6:53
led mike16-Oct-07 6:53 
GeneralRe: .NETCF compliance test? Pin
Patrick Etc.16-Oct-07 7:45
Patrick Etc.16-Oct-07 7:45 
QuestionProcess::Start doesn't Pin
Phyxion15-Oct-07 10:43
Phyxion15-Oct-07 10:43 
AnswerRe: Process::Start doesn't Pin
Dave Kreskowiak15-Oct-07 12:27
mveDave Kreskowiak15-Oct-07 12:27 
QuestionSSL - I'm Desperate Now Pin
#realJSOP15-Oct-07 6:29
professional#realJSOP15-Oct-07 6:29 
AnswerRe: SSL - I'm Desperate Now Pin
led mike15-Oct-07 8:34
led mike15-Oct-07 8:34 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.