Bugfixes: ZipFile.GetInputStream().GetAllBytes/.Length doesn't work; Divide by zero when no shellmaps are available; UseAsShellmap isn't saved by the editor; Duplicate maps crashes game.

This commit is contained in:
Paul Chote
2010-12-30 16:39:26 +13:00
parent 47bbc3a6de
commit cb50182fac
4 changed files with 28 additions and 7 deletions

View File

@@ -46,7 +46,15 @@ namespace OpenRA.FileFormats
public Stream GetContent(string filename)
{
return pkg.GetInputStream(pkg.GetEntry(filename));
var ms = new MemoryStream();
var z = pkg.GetInputStream(pkg.GetEntry(filename));
int bufSize = 2048;
byte[] buf = new byte[bufSize];
while ((bufSize = z.Read(buf, 0, buf.Length)) > 0)
ms.Write(buf, 0, bufSize);
ms.Seek(0, SeekOrigin.Begin);
return ms;
}
public IEnumerable<uint> AllFileHashes()