(OpenSeekableEntry): added capacity prediction and fixed positioning.

This commit is contained in:
morkt 2015-06-27 14:31:41 +04:00
parent 128f1f1477
commit 7704f2b34f

View File

@ -176,8 +176,13 @@ namespace GameRes
return input;
using (input)
{
var copy = new MemoryStream ((int)entry.Size);
int capacity = (int)entry.Size;
var packed_entry = entry as PackedEntry;
if (packed_entry != null && packed_entry.UnpackedSize != 0)
capacity = (int)packed_entry.UnpackedSize;
var copy = new MemoryStream (capacity);
input.CopyTo (copy);
copy.Position = 0;
return copy;
}
}