Fix string properties
This commit is contained in:
parent
5d23f87359
commit
047c2a1305
|
@ -96,11 +96,18 @@ public class PropRenderType : Property
|
||||||
|
|
||||||
public class PropString : Property
|
public class PropString : Property
|
||||||
{
|
{
|
||||||
|
public int stringLength;
|
||||||
public string value;
|
public string value;
|
||||||
|
|
||||||
public override void Read(BinaryReader reader)
|
public override void Read(BinaryReader reader)
|
||||||
{
|
{
|
||||||
base.Read(reader);
|
base.Read(reader);
|
||||||
value = Encoding.UTF8.GetString(reader.ReadBytes(length)).Replace("\0", string.Empty);
|
stringLength = reader.ReadInt32();
|
||||||
|
var tmpName = Encoding.UTF8.GetString(reader.ReadBytes(stringLength));
|
||||||
|
var idx = tmpName.IndexOf('\0');
|
||||||
|
if (idx >= 0) tmpName = tmpName[..idx];
|
||||||
|
value = tmpName;
|
||||||
|
// var tmpName = Encoding.UTF8.GetString(reader.ReadBytes(length)).Replace("\0", string.Empty);
|
||||||
|
// value = tmpName[..Math.Min(length - 1, tmpName.Length)];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue