Fixed Sprite read

improved script dump
This commit is contained in:
Perfare
2018-12-11 04:50:38 +08:00
parent eb170d4f34
commit 356d5fa8a4
9 changed files with 161 additions and 59 deletions

View File

@ -36,12 +36,20 @@ namespace AssetStudio
return "";
}
public static string ReadStringToNull(this BinaryReader reader)
public static string ReadStringToNull(this BinaryReader reader, int maxLength = 32767)
{
var bytes = new List<byte>();
byte b;
while (reader.BaseStream.Position != reader.BaseStream.Length && (b = reader.ReadByte()) != 0)
int count = 0;
while (reader.BaseStream.Position != reader.BaseStream.Length && count < maxLength)
{
var b = reader.ReadByte();
if (b == 0)
{
break;
}
bytes.Add(b);
count++;
}
return Encoding.UTF8.GetString(bytes.ToArray());
}