示例#1
0
        public async Task SendGamepadStateAsync(GamepadState state)
        {
            var message = new GamepadMessage();

            message.State = state;

            await _transport.SendAsync(message);
        }
示例#2
0
        /// <summary>
        /// Overrides the text on screen with this input
        /// </summary>
        /// <param name="text">String to override with</param>
        public async Task OverrideText(String text)
        {
            var new_version = current_text_version + 1;
            var msg         = new SystemTextInputMessage()
            {
                TextSessionId       = (uint)session_config.TextSessionId,
                BaseVersion         = current_text_version,
                SubmittedVersion    = new_version,
                TotalTextBytelength = (uint)text.Length,
                SelectionStart      = -1,
                SelectionLength     = -1,
                TextChunk           = text,
            };
            await _transport.SendAsync(msg);

            current_session_input = msg;
        }
        /// <summary>
        /// Sends a media command message.
        /// </summary>
        /// <returns>Send message task.</returns>
        /// <param name="state">State message to send.</param>
        public async Task SendMediaCommandStateAsync(MediaCommandState state)
        {
            var message = new MediaCommandMessage();

            message.State = state;

            await _transport.SendAsync(message);
        }
        public async Task <AuxiliaryStreamClient> OpenAuxiliaryStreamAsync()
        {
            var auxiliaryStreamMessage = await _transport.WaitForMessageAsync <AuxiliaryStreamMessage>(
                TimeSpan.FromSeconds(1),
                () => _transport.SendAsync(new AuxiliaryStreamMessage()).GetAwaiter().GetResult(),
                m => m.ConnectionInfo != null);

            var cryptoContext = new AuxiliaryStreamCryptoContext(
                auxiliaryStreamMessage.ConnectionInfo.CryptoKey,
                auxiliaryStreamMessage.ConnectionInfo.ServerInitVector,
                auxiliaryStreamMessage.ConnectionInfo.ClientInitVector,
                auxiliaryStreamMessage.ConnectionInfo.SignHash);

            var client = new AuxiliaryStreamClient(
                auxiliaryStreamMessage.ConnectionInfo.Endpoints[0].Host,
                int.Parse(auxiliaryStreamMessage.ConnectionInfo.Endpoints[0].Service),
                cryptoContext);

            await client.ConnectAsync();

            return(client);
        }