1
Fork 0
mirror of https://bitbucket.org/Ioncannon/project-meteor-server.git synced 2025-04-26 06:37:45 +00:00
This commit is contained in:
Filip Maj 2021-02-26 21:09:21 -05:00
parent 7c144bd05a
commit 2731124b44

View file

@ -267,7 +267,15 @@ namespace Meteor.Common
public static string ReadNullTermString(BinaryReader reader, int maxSize = 0x20) public static string ReadNullTermString(BinaryReader reader, int maxSize = 0x20)
{ {
return Encoding.ASCII.GetString(reader.ReadBytes(maxSize)).Trim(new[] { '\0' }); byte[] str = reader.ReadBytes(maxSize);
int i;
for (i = 0; i <= str.Length; i++)
{
if (str[i] == 0)
break;
}
return Encoding.ASCII.GetString(str, 0, i);
} }
public static void WriteNullTermString(BinaryWriter writer, string value, int maxSize = 0x20) public static void WriteNullTermString(BinaryWriter writer, string value, int maxSize = 0x20)