System.Text.SuperEncoding.GetCharCount C# (CSharp) Метод

GetCharCount() приватный Метод

private GetCharCount ( byte bytes, int index, int count, SuperDecoder decoder ) : int
bytes byte
index int
count int
decoder SuperDecoder
Результат int
        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;
        }

Same methods

SuperEncoding::GetCharCount ( byte bytes, int index, int count ) : int

Usage Example

Пример #1
0
 public override int GetCharCount(byte[] bytes, int index, int count)
 {
     return _encoding.GetCharCount(bytes, index, count, this);
 }