mirror of
https://github.com/aelurum/AssetStudio.git
synced 2025-05-25 05:40:21 -04:00
Fixed bundle reading for Unity 5.3+ bundles with LZMA
This commit is contained in:
parent
f7948e58b4
commit
88d78e5166
@ -122,5 +122,23 @@ namespace SevenZip.Compression.LZMA
|
|||||||
return newOutStream;
|
return newOutStream;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static MemoryStream StreamDecompress(MemoryStream newInStream, long outSize)
|
||||||
|
{
|
||||||
|
SevenZip.Compression.LZMA.Decoder decoder = new SevenZip.Compression.LZMA.Decoder();
|
||||||
|
|
||||||
|
newInStream.Seek(0, 0);
|
||||||
|
MemoryStream newOutStream = new MemoryStream();
|
||||||
|
|
||||||
|
byte[] properties2 = new byte[5];
|
||||||
|
if (newInStream.Read(properties2, 0, 5) != 5)
|
||||||
|
throw (new Exception("input .lzma is too short"));
|
||||||
|
decoder.SetDecoderProperties(properties2);
|
||||||
|
|
||||||
|
long compressedSize = newInStream.Length - newInStream.Position;
|
||||||
|
decoder.Code(newInStream, newOutStream, compressedSize, outSize, null);
|
||||||
|
|
||||||
|
newOutStream.Position = 0;
|
||||||
|
return newOutStream;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -173,7 +173,7 @@ namespace Unity_Studio
|
|||||||
var uncompressedBytes = new byte[uncompressedSize];
|
var uncompressedBytes = new byte[uncompressedSize];
|
||||||
using (var mstream = new MemoryStream(compressedBytes))
|
using (var mstream = new MemoryStream(compressedBytes))
|
||||||
{
|
{
|
||||||
var decoder = SevenZip.Compression.LZMA.SevenZipHelper.StreamDecompress(mstream);
|
var decoder = SevenZip.Compression.LZMA.SevenZipHelper.StreamDecompress(mstream, uncompressedSize);
|
||||||
decoder.Read(uncompressedBytes, 0, uncompressedSize);
|
decoder.Read(uncompressedBytes, 0, uncompressedSize);
|
||||||
decoder.Dispose();
|
decoder.Dispose();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user