private unsafe static String CheckAndGetTheString(ushort *pDataPool, uint offsetInPool, int poolSize)
{
if (offsetInPool + 2 > poolSize) // string offset + string length + null termination.
return null;
char* pCharValues = unchecked((char*)(pDataPool + offsetInPool));
int stringLength = (int) pCharValues[0];
if (offsetInPool + stringLength + 2 > poolSize) // string length + string + null termination
return null;
return new String(pCharValues + 1, 0, stringLength);
}