Esempio n. 1
0
 /// <summary>
 /// Create a chunk.
 /// </summary>
 public static Chunk CreateChunk(IJdwpServerInfo serverInfo, int type, int dataLength, Action<Chunk> initialize = null)
 {
     var data = new byte[HeaderLength + ChunkHeaderLength + dataLength];
     var packet = new Chunk(serverInfo, data, 0) { Type = type, Length = dataLength };
     if (initialize != null)
     {
         initialize(packet);
     }
     return packet;
 }
Esempio n. 2
0
        /// <summary>
        /// Try to find a packet in the given buffer.
        /// </summary>
        /// <returns>Null if not found</returns>
        private static JdwpPacket FindPacket(IJdwpServerInfo serverInfo, byte[] buffer, int length)
        {
            if (length < JdwpPacket.HeaderLength)
            {
                return(null);
            }
            var pkt = new JdwpPacket(serverInfo, buffer, 0);

            if (pkt.Length > length)
            {
                return(null);
            }
            return(new JdwpPacket(serverInfo, buffer, 0, true));
        }
Esempio n. 3
0
        /// <summary>
        /// Create a chunk.
        /// </summary>
        public static Chunk CreateChunk(IJdwpServerInfo serverInfo, int type, int dataLength, Action <Chunk> initialize = null)
        {
            var data   = new byte[HeaderLength + ChunkHeaderLength + dataLength];
            var packet = new Chunk(serverInfo, data, 0)
            {
                Type = type, Length = dataLength
            };

            if (initialize != null)
            {
                initialize(packet);
            }
            return(packet);
        }
Esempio n. 4
0
        /// <summary>
        /// Create a command packet.
        /// </summary>
        public static JdwpPacket CreateCommand(IJdwpServerInfo serverInfo, int commandSet, int command, int dataLength, Action <JdwpPacket> initialize = null)
        {
            var data   = new byte[HeaderLength + dataLength];
            var packet = new JdwpPacket(serverInfo, data, 0)
            {
                CommandSet = commandSet, Command = command, Length = data.Length
            };

            if (initialize != null)
            {
                initialize(packet);
            }
            return(packet);
        }
Esempio n. 5
0
        /// <summary>
        /// Default ctor
        /// </summary>
        public JdwpPacket(IJdwpServerInfo serverInfo, byte[] data, int dataOffset, bool cloneBuffer)
        {
            this.serverInfo = serverInfo;
            this.data = data;
            this.dataOffset = dataOffset;

            if (cloneBuffer)
            {
                var len = Length;
                var clone = new byte[len];
                Array.Copy(data, dataOffset, clone, 0, len);
                this.data = clone;
                this.dataOffset = 0;
            }
        }
Esempio n. 6
0
        /// <summary>
        /// Default ctor
        /// </summary>
        public JdwpPacket(IJdwpServerInfo serverInfo, byte[] data, int dataOffset, bool cloneBuffer)
        {
            this.serverInfo = serverInfo;
            this.data       = data;
            this.dataOffset = dataOffset;

            if (cloneBuffer)
            {
                var len   = Length;
                var clone = new byte[len];
                Array.Copy(data, dataOffset, clone, 0, len);
                this.data       = clone;
                this.dataOffset = 0;
            }
        }
Esempio n. 7
0
 /// <summary>
 /// Default ctor
 /// </summary>
 public Chunk(IJdwpServerInfo serverInfo, byte[] data, int dataOffset)
     : base(serverInfo, data, dataOffset)
 {
     CommandSet = DdmsCommandSet;
     Command = DdmsCommand;
 }
Esempio n. 8
0
 /// <summary>
 /// Default ctor
 /// </summary>
 public JdwpPacket(IJdwpServerInfo serverInfo, byte[] data, int dataOffset)
     : this(serverInfo, data, dataOffset, false)
 {
 }
Esempio n. 9
0
 /// <summary>
 /// Create a command packet.
 /// </summary>
 public static JdwpPacket CreateCommand(IJdwpServerInfo serverInfo, int commandSet, int command, int dataLength, Action<JdwpPacket> initialize = null)
 {
     var data = new byte[HeaderLength + dataLength];
     var packet = new JdwpPacket(serverInfo, data, 0) { CommandSet = commandSet, Command = command, Length = data.Length };
     if (initialize != null)
     {
         initialize(packet);
     }
     return packet;
 }
Esempio n. 10
0
 /// <summary>
 /// Default ctor
 /// </summary>
 public JdwpPacket(IJdwpServerInfo serverInfo, byte[] data, int dataOffset)
     : this(serverInfo, data, dataOffset, false)
 {
 }
Esempio n. 11
0
 /// <summary>
 /// Default ctor
 /// </summary>
 public Chunk(IJdwpServerInfo serverInfo, byte[] data, int dataOffset)
     : base(serverInfo, data, dataOffset)
 {
     CommandSet = DdmsCommandSet;
     Command    = DdmsCommand;
 }