public string[] GetGroupNames(int groupNumber)
{
ThrowIfDisposed();
int count = ToxFunctions.GroupNumberPeers(_tox, groupNumber);
//just return an empty string array before we get an overflow exception
if (count <= 0)
return new string[0];
ushort[] lengths = new ushort[count];
byte[,] matrix = new byte[count, ToxConstants.MaxNameLength];
int result = ToxFunctions.GroupGetNames(_tox, groupNumber, matrix, lengths, (ushort)count);
string[] names = new string[count];
for (int i = 0; i < count; i++)
{
byte[] name = new byte[lengths[i]];
for (int j = 0; j < name.Length; j++)
name[j] = matrix[i, j];
names[i] = Encoding.UTF8.GetString(name, 0, name.Length);
}
return names;
}