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

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

private GetChars ( byte bytes, int byteIndex, int byteCount, char chars, int charIndex, SuperDecoder decoder ) : int
bytes byte
byteIndex int
byteCount int
chars char
charIndex int
decoder SuperDecoder
Результат int
        private int GetChars(byte[] bytes, int byteIndex, int byteCount, char[] chars, int charIndex, SuperDecoder decoder)
        {
            int charCount = 0;
            ushort u;
            char c;

            for (int i = 0; i < byteCount; byteIndex++, charIndex++, charCount++, i++)
            {
                u = 0;
                if (decoder != null && decoder.pendingByte != 0)
                {
                    u = decoder.pendingByte;
                    decoder.pendingByte = 0;
                }

                u = (ushort)(u << 8 | bytes[byteIndex]);
                c = _dbcsToUnicode[u];
                if (c == LEAD_BYTE_CHAR)
                {
                    if (i < byteCount - 1)
                    {
                        byteIndex++;
                        i++;
                        u = (ushort)(u << 8 | bytes[byteIndex]);
                        c = _dbcsToUnicode[u];
                    }
                    else if (decoder == null)
                    {
                        c = '\0';
                    }
                    else
                    {
                        decoder.pendingByte = bytes[byteIndex];
                        return charCount;
                    }
                }
                if (c == 0 && u != 0)
                    chars[charIndex] = '?';
                else
                    chars[charIndex] = c;
            }

            return charCount;
        }

Same methods

SuperEncoding::GetChars ( byte bytes, int byteIndex, int byteCount, char chars, int charIndex ) : int

Usage Example

Пример #1
0
 public override int GetChars(byte[] bytes, int byteIndex, int byteCount, char[] chars, int charIndex)
 {
     return _encoding.GetChars(bytes, byteIndex, byteCount, chars, charIndex, this);
 }