⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ucs4decoder.cs

📁 Freetextbox是优秀的在线编辑器
💻 CS
字号:
namespace FreeTextBoxControls.Support.Sgml
{
    using System;
    using System.Text;

    internal abstract class Ucs4Decoder : System.Text.Decoder
    {
        protected Ucs4Decoder()
        {
            this.temp = new byte[4];
            this.tempBytes = 0;
        }

        public override int GetCharCount(byte[] bytes, int index, int count)
        {
            return ((count + this.tempBytes) / 4);
        }

        public override int GetChars(byte[] bytes, int byteIndex, int byteCount, char[] chars, int charIndex)
        {
            int num1 = this.tempBytes;
            if (this.tempBytes > 0)
            {
                while (num1 < 4)
                {
                    this.temp[num1] = bytes[byteIndex];
                    byteIndex++;
                    byteCount--;
                    num1++;
                }
                num1 = 1;
                this.GetFullChars(this.temp, 0, 4, chars, charIndex);
                charIndex++;
            }
            else
            {
                num1 = 0;
            }
            num1 = this.GetFullChars(bytes, byteIndex, byteCount, chars, charIndex) + num1;
            int num2 = (this.tempBytes + byteCount) % 4;
            byteCount += byteIndex;
            byteIndex = byteCount - num2;
            this.tempBytes = 0;
            if (byteIndex >= 0)
            {
                while (byteIndex < byteCount)
                {
                    this.temp[this.tempBytes] = bytes[byteIndex];
                    this.tempBytes++;
                    byteIndex++;
                }
            }
            return num1;
        }

        internal abstract int GetFullChars(byte[] bytes, int byteIndex, int byteCount, char[] chars, int charIndex);
        internal char UnicodeToUTF16(uint code)
        {
            byte num1 = (byte) (0xd7c0 + (code >> 10));
            byte num2 = (byte) (0xdc00 | (code & 0x3ff));
            return (char) ((ushort) ((num2 << 8) | num1));
        }


        internal byte[] temp;
        internal int tempBytes;
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -