Пример #1
0
        /// <summary>
        /// Send a command packet to the VM
        /// </summary>
        /// <param name="command"></param>
        /// <returns></returns>
        public Task SendCommandAsync(JdwpCommand command)
        {
            var waitingOperation = new WaitingOperationDescriptor(command);

            lock (_waitingOperations)
            {
                _waitingOperations.Add(command.PacketId, waitingOperation);
            }

            SendToTransport(command);

            return waitingOperation.Task;
        }
Пример #2
0
        /// <summary>
        /// Construct a new ReplyPacketParser from the raw bytes of the reply packet. After the ReplyPacketParser is constrcuted, 
        /// the header has already been decoded, the position of the underlying byte stream is at the beginning of the payload.
        /// Use the methods on this class to read bytes from the payload as structured data.
        /// </summary>
        /// <param name="replyBytes"></param>
        public ReplyPacketParser(byte[] replyBytes, JdwpCommand.IDSizes idSizes)
        {
            _packetReader = new BinaryReader(new MemoryStream(replyBytes));
            _IDSizes = idSizes;

            Size = this.ReadUInt32();
            Id = this.ReadUInt32();
            this.ReadByte(); //flags byte
            ErrorCode = this.ReadUInt16();

            if (ErrorCode == 0)
            {
                Succeeded = true;
            }
            else
            {
                Succeeded = false;
            }
        }
Пример #3
0
 public void SetIDSizes(JdwpCommand.IDSizes idSizes)
 {
     _IDSizes = idSizes;
 }
Пример #4
0
 private void SendToTransport(JdwpCommand command)
 {
     _transport.Send(command.GetPacketBytes());
 }
Пример #5
0
 public WaitingOperationDescriptor(JdwpCommand command)
 {
     _command = command;
 }