mirror of
https://bitbucket.org/Ioncannon/project-meteor-server.git
synced 2025-04-26 14:47:45 +00:00
Leftover
This commit is contained in:
parent
7c144bd05a
commit
2731124b44
1 changed files with 9 additions and 1 deletions
|
@ -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)
|
||||||
|
|
Loading…
Add table
Reference in a new issue