(ArcFile.OpenView): dispose of the intermediate stream.

This commit is contained in:
morkt 2015-06-19 15:59:06 +04:00
parent 6f8b57cc03
commit f47432fc09

View File

@ -153,10 +153,18 @@ namespace GameRes
/// </summary>
public ArcView OpenView (Entry entry)
{
var stream = OpenEntry (entry);
uint size = stream.CanSeek ? (uint)stream.Length : entry.Size;
using (var stream = OpenEntry (entry))
{
uint size;
if (stream.CanSeek)
size = (uint)stream.Length;
else if (entry is PackedEntry)
size = (entry as PackedEntry).UnpackedSize;
else
size = entry.Size;
return new ArcView (stream, entry.Name, size);
}
}
/// <summary>
/// Open specified <paramref name="entry"/> as a seekable Stream.