(Binary.GetCString): new static method.

This commit is contained in:
morkt 2015-04-16 22:39:57 +04:00
parent 0aaf977c8a
commit f5d2cac377

View File

@ -24,6 +24,7 @@
//
using System.IO;
using System.Text;
namespace GameRes.Utility
{
@ -83,6 +84,19 @@ namespace GameRes.Utility
count -= preceding;
}
}
public static string GetCString (byte[] data, int index, int length_limit, Encoding enc)
{
int name_length = 0;
while (name_length < length_limit && 0 != data[index+name_length])
name_length++;
return enc.GetString (data, index, name_length);
}
public static string GetCString (byte[] data, int index, int length_limit)
{
return GetCString (data, index, length_limit, Encodings.cp932);
}
}
public static class BigEndian