Fix null-terminated string writing (BinaryWriter prefixed it with a length byte which is unneeded).

lua-bytecode
Icedream 2014-10-22 19:55:45 +02:00
parent f9b647c38d
commit 9917ac4f9f
1 changed files with 4 additions and 3 deletions

View File

@ -32,12 +32,13 @@ namespace GarrysMod.AddonCreator
public static void Write(this BinaryWriter bw, string value, bool nullTerminated) public static void Write(this BinaryWriter bw, string value, bool nullTerminated)
{ {
if (nullTerminated) if (!nullTerminated)
{ {
value += "\0"; bw.Write(value);
} }
bw.Write(value); value += "\0";
bw.Write(Encoding.GetEncoding("windows-1252").GetBytes(value));
} }
} }
} }