I'm reading a .gz file from some slow source (like FTP Server) and am processing the received data right away. Looks something like this:
FtpWebResponse response = ftpclientRequest.GetResponse() as FtpWebResponse;
using (Stream ftpStream = response.GetResponseStream())
using (GZipStream unzipped = new GZipStream(ftpStream, CompressionMode.Decompress))
using (StreamReader linereader = new StreamReader(unzipped))
{
String l;
while ((l = linereader.ReadLine()) != null)
{
...
}
}
My problem is showing an accurate progress bar. In advance I can get the compressed .gz file size, but I got no clue how large the content would be uncompressed. Reading the file line by line I know quite well how many uncompressed bytes I read, but I don't know how this does relate to the compressed file size.
So, is there any way to get from GZipStream how far the file pointer is advanced into the compressed file? I only need the current position, the gz file size I can fetch before reading the file.