I have a .bz2 compressed file, and i want to copy the inside file to another location, without decompressing it. I use .net 4.5 with C#.
i tried like this, but this is for zip files (.zip):
using (var zip = ZipFile.Read(_targetPathComplete + "\\" + file[0].ToUpper() + "_" + file[1].ToUpper() + ".bz2"))
{
Stream s = zip[file[0].ToUpper() + "_" + file[1].ToUpper()].OpenReader();
// fiddle with stream here
using (var fileStream = File.Create(_targetPathComplete + "\\" + file[0].ToUpper() + "_" + file[1].ToUpper() + ".HDC"))
{
s.Seek(0, SeekOrigin.Begin);
s.CopyTo(fileStream);
}
}
Or compress a file with bzip2 algorithm and give an extension .HDC to it.
I think i solved it like this, at least the file i have wit this method is the same as when i copy the file from winrar.