// Token: 0x06000331 RID: 817 RVA: 0x0000F698 File Offset: 0x0000D898
        private static void ClearKeyboardBuffer(int vk, int sc, IntPtr hkl)
        {
            StringBuilder stringBuilder = new StringBuilder(10);
            int           num;

            do
            {
                byte[] lpKeyState = new byte[255];
                num = KeyboardNativeMethods.ToUnicodeEx(vk, sc, lpKeyState, stringBuilder, stringBuilder.Capacity, 0, hkl);
            }while (num < 0);
        }
        // Token: 0x06000330 RID: 816 RVA: 0x0000F534 File Offset: 0x0000D734
        internal static void TryGetCharFromKeyboardState(int virtualKeyCode, int scanCode, int fuState, IntPtr dwhkl, out char[] chars)
        {
            StringBuilder stringBuilder = new StringBuilder(64);
            KeyboardState current       = KeyboardState.GetCurrent();

            byte[] nativeState = current.GetNativeState();
            bool   flag        = false;

            if (current.IsDown(Keys.ShiftKey))
            {
                nativeState[16] = 128;
            }
            if (current.IsToggled(Keys.Capital))
            {
                nativeState[20] = 1;
            }
            switch (KeyboardNativeMethods.ToUnicodeEx(virtualKeyCode, scanCode, nativeState, stringBuilder, stringBuilder.Capacity, fuState, dwhkl))
            {
            case -1:
                flag = true;
                KeyboardNativeMethods.ClearKeyboardBuffer(virtualKeyCode, scanCode, dwhkl);
                chars = null;
                break;

            case 0:
                chars = null;
                break;

            case 1:
                if (stringBuilder.Length > 0)
                {
                    chars = new char[]
                    {
                        stringBuilder[0]
                    };
                }
                else
                {
                    chars = null;
                }
                break;

            default:
                if (stringBuilder.Length > 1)
                {
                    chars = new char[]
                    {
                        stringBuilder[0],
                        stringBuilder[1]
                    };
                }
                else
                {
                    chars = new char[]
                    {
                        stringBuilder[0]
                    };
                }
                break;
            }
            if (KeyboardNativeMethods.lastVirtualKeyCode != 0 && KeyboardNativeMethods.lastIsDead)
            {
                if (chars != null)
                {
                    StringBuilder stringBuilder2 = new StringBuilder(5);
                    KeyboardNativeMethods.ToUnicodeEx(KeyboardNativeMethods.lastVirtualKeyCode, KeyboardNativeMethods.lastScanCode, KeyboardNativeMethods.lastKeyState, stringBuilder2, stringBuilder2.Capacity, 0, dwhkl);
                    KeyboardNativeMethods.lastIsDead         = false;
                    KeyboardNativeMethods.lastVirtualKeyCode = 0;
                }
                return;
            }
            KeyboardNativeMethods.lastScanCode       = scanCode;
            KeyboardNativeMethods.lastVirtualKeyCode = virtualKeyCode;
            KeyboardNativeMethods.lastIsDead         = flag;
            KeyboardNativeMethods.lastKeyState       = (byte[])nativeState.Clone();
        }