我正在使用以下代码压缩文件,它工作正常,但是当我使用 WinRar 解压缩时,我得到没有扩展名的原始文件名,任何线索为什么如果文件名是myReport.xls
我解压缩时我只得到myReport
?
using (var fs = new FileStream(fileName, FileMode.Open))
{
byte[] input = new byte[fs.Length];
fs.Read(input, 0, input.Length);
fs.Close();
using (var fsOutput = new FileStream(zipName, FileMode.Create, FileAccess.Write))
using(var zip = new GZipStream(fsOutput, CompressionMode.Compress))
{
zip.Write(input, 0, input.Length);
zip.Close();
fsOutput.Close();
}
}