示例#1
0
        /// <summary>
        /// Loads data bytes into internal buffer.
        /// </summary>
        /// <param name="bytes">The bytes.</param>
        /// <param name="offset">The zero-based offset in <paramref name="bytes"/> at which to begin reading SSH data.</param>
        /// <param name="count">The number of bytes to load.</param>
        private void LoadBytes(byte[] bytes, int offset, int count)
        {
            _loadedData = bytes;
            _offset     = offset;
            _count      = count;

            _stream = new SshDataStream(bytes, _offset, count);
        }
示例#2
0
        /// <summary>
        /// Gets data bytes array
        /// </summary>
        /// <returns>Byte array representation of data structure.</returns>
        public byte[] GetBytes()
        {
            var messageLength = BufferCapacity;
            var capacity      = messageLength != -1 ? messageLength : DefaultCapacity;
            var dataStream    = new SshDataStream(capacity);

            WriteBytes(dataStream);
            return(dataStream.ToArray());
        }
示例#3
0
 /// <summary>
 /// Writes the current message to the specified <see cref="SshDataStream"/>.
 /// </summary>
 /// <param name="stream">The <see cref="SshDataStream"/> to write the message to.</param>
 protected virtual void WriteBytes(SshDataStream stream)
 {
     _stream = stream;
     SaveData();
 }