mirror of
https://github.com/crskycode/GARbro.git
synced 2026-07-08 01:30:18 +08:00
fix: Stream dispose
This commit is contained in:
@@ -267,6 +267,8 @@ namespace GameRes.Formats.NeXAS
|
|||||||
if (null == pac)
|
if (null == pac)
|
||||||
return input;
|
return input;
|
||||||
if (Compression.NeedDecryptionOnly == pac.PackType)
|
if (Compression.NeedDecryptionOnly == pac.PackType)
|
||||||
|
{
|
||||||
|
using (input)
|
||||||
{
|
{
|
||||||
var data = new byte[entry.Size];
|
var data = new byte[entry.Size];
|
||||||
input.Read (data, 0, data.Length);
|
input.Read (data, 0, data.Length);
|
||||||
@@ -274,6 +276,7 @@ namespace GameRes.Formats.NeXAS
|
|||||||
data[i] = (byte)~data[i];
|
data[i] = (byte)~data[i];
|
||||||
return new BinMemoryStream (data, entry.Name);
|
return new BinMemoryStream (data, entry.Name);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (null == pent || !pent.IsPacked)
|
if (null == pent || !pent.IsPacked)
|
||||||
return input;
|
return input;
|
||||||
|
|
||||||
@@ -295,10 +298,13 @@ namespace GameRes.Formats.NeXAS
|
|||||||
return new ZLibStream (input, CompressionMode.Decompress);
|
return new ZLibStream (input, CompressionMode.Decompress);
|
||||||
case Compression.Zstd:
|
case Compression.Zstd:
|
||||||
case Compression.ZstdOrNone:
|
case Compression.ZstdOrNone:
|
||||||
|
{
|
||||||
|
using (input)
|
||||||
{
|
{
|
||||||
var unpacked = ZstdDecompress (input, pent.UnpackedSize);
|
var unpacked = ZstdDecompress (input, pent.UnpackedSize);
|
||||||
return new BinMemoryStream (unpacked, entry.Name);
|
return new BinMemoryStream (unpacked, entry.Name);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
return input;
|
return input;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user