コード例 #1
0
 public void TestIndexationKeyTooLong()
 {
     {
         var request =
             new SendDataRequest(
                 "8374598275781252890532895328952893573289529875293523897561289561287561897456128743612879461897461289746125129875129571985712985719257219857125",
                 "");
         request.Validate();
     }
 }
コード例 #2
0
        public async Task <MessageResponse <IndexationPayload> > SendDataAsync(SendDataRequest request)
        {
            request.Validate();

            var message = new Message <IndexationPayload>
            {
                Payload = new IndexationPayload {
                    Index = request.IndexationKey.ToHex(), Data = request.Data.ToHex()
                }
            };

            var response = await this.Client.SendMessageAsync(message);

            return(new MessageResponse <IndexationPayload>(message, response.MessageId));
        }
        private void sendButton_Click(object sender, RoutedEventArgs e)
        {
            var message = messageTextBox.Text;

            int count = 0;

            if (!int.TryParse(countTextBox.Text, out count))
            {
                count = 1;
            }

            float delay = 0f;

            if (!float.TryParse(delayTextBox.Text, out delay))
            {
                delay = 0.1f;
            }

            SendDataRequest?.Invoke(message, count, delay);
        }
コード例 #4
0
        /// <summary>
        /// Encode slow path pdu to a byte list.
        /// </summary>
        /// <param name="sendBuffer">The buffer list to contain the PDU.
        /// This argument cannot be null. It may throw ArgumentNullException if it is null.</param>
        /// <param name="commonHeader">The common header of the PDU including tpktHeader, X224, security header,
        /// user channel Id and I/O channel Id.</param>
        /// <param name="dataBody">The data following the common header.
        /// This argument can be null. If it is null, the method will encode commonHeader only.</param>
        /// <param name="context">The context used to encrypt the data body.
        /// If the securityHeader is the type of TS_SECURITY_HEADER, then this argument can be null.
        /// Otherwise, this argument can not be null, the dataBody will not be encrypted.</param>
        public static void EncodeSlowPathPdu(List <byte> sendBuffer,
                                             SlowPathPduCommonHeader commonHeader,
                                             byte[] dataBody,
                                             RdpbcgrClientContext context)
        {
            EncodeStructure(sendBuffer, commonHeader.tpktHeader);
            EncodeStructure(sendBuffer, commonHeader.x224Data);

            List <byte> securityBuffer = new List <byte>();

            EncodeSecurityData(securityBuffer, commonHeader.securityHeader, dataBody, context);

            SendDataRequest securityExchange = new SendDataRequest(new UserId(commonHeader.initiator),
                                                                   new ChannelId(commonHeader.channelId),
                                                                   new DataPriority(ConstValue.SEND_DATA_REQUEST_PRIORITY),
                                                                   ConstValue.SEND_DATA_REQUEST_SEGMENTATION,
                                                                   new Asn1OctetString(securityBuffer.ToArray()));
            DomainMCSPDU mcsDomain = new DomainMCSPDU(DomainMCSPDU.sendDataRequest, securityExchange);

            EncodeDomainMcsPdu(sendBuffer, mcsDomain);
        }
コード例 #5
0
        public void TestIndexationKeyIsEmpty()
        {
            var request = new SendDataRequest(string.Empty, "");

            request.Validate();
        }