修复Gzip解压报错文件找不到问题 (#465)
This commit is contained in:
parent
584d3c892b
commit
2bf4f29f28
|
@ -143,15 +143,13 @@ namespace N_m3u8DL_RE.Util
|
||||||
/// <param name="filePath"></param>
|
/// <param name="filePath"></param>
|
||||||
public static async Task DeGzipFileAsync(string filePath)
|
public static async Task DeGzipFileAsync(string filePath)
|
||||||
{
|
{
|
||||||
string deGzipFile = Path.ChangeExtension(filePath, ".tmp");
|
var deGzipFile = Path.ChangeExtension(filePath, ".dezip_tmp");
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
using (var fileToDecompressAsStream = File.OpenRead(filePath))
|
await using var fileToDecompressAsStream = File.OpenRead(filePath);
|
||||||
{
|
await using var decompressedStream = File.Create(deGzipFile);
|
||||||
using var decompressedStream = File.Create(deGzipFile);
|
await using var decompressionStream = new GZipStream(fileToDecompressAsStream, CompressionMode.Decompress);
|
||||||
using var decompressionStream = new GZipStream(fileToDecompressAsStream, CompressionMode.Decompress);
|
|
||||||
await decompressionStream.CopyToAsync(decompressedStream);
|
await decompressionStream.CopyToAsync(decompressedStream);
|
||||||
}
|
|
||||||
File.Delete(filePath);
|
File.Delete(filePath);
|
||||||
File.Move(deGzipFile, filePath);
|
File.Move(deGzipFile, filePath);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue