protected static bool ParseString(byte[] input, ref int pos, out string str)
{
int index = pos;
str = null;
if (input.Length == pos)
return false;
while ((input[index] != (byte)'\n') && (input[index] != (byte)0))
{
if (index < input.Length) {
index++;
} else {
return false;
}
}
int length = index - pos;
if (length == 0)
{
return false;
}
str = Encoding.UTF8.GetString (input, pos, length);
pos = index;
return true;
}