private int GetCharCount(byte[] bytes, int index, int count, SuperDecoder decoder)
{
int charCount = 0;
ushort u;
char c;
for (int i = 0; i < count; index++, charCount++, i++)
{
u = 0;
if (decoder != null && decoder.pendingByte != 0)
{
u = decoder.pendingByte;
decoder.pendingByte = 0;
}
u = (ushort)(u << 8 | bytes[index]);
c = _dbcsToUnicode[u];
if (c == LEAD_BYTE_CHAR)
{
if (i < count - 1)
{
index++;
i++;
}
else if (decoder != null)
{
decoder.pendingByte = bytes[index];
return charCount;
}
}
}
return charCount;
}