Exemplo n.º 1
0
        public async Task ParseMessage(byte[] message)
        {
            try
            {
                var baseDto = MessagePackSerializer.Deserialize <BinaryDtoBase>(message);

                switch (baseDto.DtoType)
                {
                case BinaryDtoType.MouseMove:
                case BinaryDtoType.MouseDown:
                case BinaryDtoType.MouseUp:
                case BinaryDtoType.Tap:
                case BinaryDtoType.MouseWheel:
                case BinaryDtoType.KeyDown:
                case BinaryDtoType.KeyUp:
                case BinaryDtoType.CtrlAltDel:
                case BinaryDtoType.ToggleBlockInput:
                case BinaryDtoType.ClipboardTransfer:
                case BinaryDtoType.KeyPress:
                case BinaryDtoType.SetKeyStatesUp:
                {
                    if (!Viewer.HasControl)
                    {
                        return;
                    }
                }
                break;

                default:
                    break;
                }

                switch (baseDto.DtoType)
                {
                case BinaryDtoType.SelectScreen:
                    SelectScreen(message);
                    break;

                case BinaryDtoType.MouseMove:
                    MouseMove(message);
                    break;

                case BinaryDtoType.MouseDown:
                    MouseDown(message);
                    break;

                case BinaryDtoType.MouseUp:
                    MouseUp(message);
                    break;

                case BinaryDtoType.Tap:
                    Tap(message);
                    break;

                case BinaryDtoType.MouseWheel:
                    MouseWheel(message);
                    break;

                case BinaryDtoType.KeyDown:
                    KeyDown(message);
                    break;

                case BinaryDtoType.KeyUp:
                    KeyUp(message);
                    break;

                case BinaryDtoType.CtrlAltDel:
                    await CasterSocket.SendCtrlAltDel();

                    break;

                case BinaryDtoType.AutoQualityAdjust:
                    SetAutoQualityAdjust(message);
                    break;

                case BinaryDtoType.ToggleAudio:
                    ToggleAudio(message);
                    break;

                case BinaryDtoType.ToggleBlockInput:
                    ToggleBlockInput(message);
                    break;

                case BinaryDtoType.ToggleWebRtcVideo:
                    ToggleWebRtcVideo(message);
                    break;

                case BinaryDtoType.ClipboardTransfer:
                    ClipboardTransfer(message);
                    break;

                case BinaryDtoType.KeyPress:
                    await KeyPress(message);

                    break;

                case BinaryDtoType.QualityChange:
                    QualityChange(message);
                    break;

                case BinaryDtoType.File:
                    await DownloadFile(message);

                    break;

                case BinaryDtoType.WindowsSessions:
                    await GetWindowsSessions();

                    break;

                case BinaryDtoType.SetKeyStatesUp:
                    SetKeyStatesUp();
                    break;

                case BinaryDtoType.FrameReceived:
                    HandleFrameReceived();
                    break;

                default:
                    break;
                }
            }
            catch (Exception ex)
            {
                Logger.Write(ex);
            }
        }
Exemplo n.º 2
0
 public async Task SendCtrlAltDel()
 {
     await CasterSocket.SendCtrlAltDel();
 }