Exemplo n.º 1
0
        /// <summary>
        /// Toes the byte array.
        /// </summary>
        /// <returns>a <c>byte[]</c> representing this instance</returns>
        public byte[] ToByteArray()
        {
            ByteArrayToken lengthToken;

            var arrayBuilder =
                new ByteArrayBuilder().AddToken(1, out lengthToken).AddByte((byte)this.ConnectionType).AddByte(
                    (byte)this.NetIpLayer).AddByte(0x00);

            arrayBuilder.ReplaceToken(lengthToken, arrayBuilder.Length);

            return(arrayBuilder.ToByteArray());
        }
Exemplo n.º 2
0
        public byte[] ToByteArray()
        {
            ByteArrayToken lengthToken;

            var arrayBuilder =
                new ByteArrayBuilder()
                .AddToken(1, out lengthToken)
                .AddByte((byte)this.HostProtocolCode)
                .Add(this.IpAddress)
                .AddInt(this.Port);

            arrayBuilder.ReplaceToken(lengthToken, arrayBuilder.Length);

            return(arrayBuilder.ToByteArray());
        }