mirror of
https://github.com/crskycode/GARbro.git
synced 2026-07-08 01:30:18 +08:00
(UnityFS): deserialize textures with "StreamingInfo".
This commit is contained in:
@@ -39,6 +39,8 @@ namespace GameRes.Formats.Unity
|
||||
IBinaryStream m_input;
|
||||
int m_format;
|
||||
|
||||
const int MaxStringLength = 0x100000;
|
||||
|
||||
public Stream Source { get { return m_input.AsStream; } }
|
||||
public int Format { get { return m_format; } }
|
||||
public long Position {
|
||||
@@ -144,6 +146,8 @@ namespace GameRes.Formats.Unity
|
||||
int length = ReadInt32();
|
||||
if (0 == length)
|
||||
return string.Empty;
|
||||
if (length < 0 || length > MaxStringLength)
|
||||
throw new InvalidFormatException();
|
||||
var bytes = ReadBytes (length);
|
||||
return Encoding.UTF8.GetString (bytes);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user