WriteBytes() public method

public WriteBytes ( byte bytes ) : void
bytes byte
return void
Exemplo n.º 1
0
        private static byte[] ConstructHandshakePacketContent(HandshakeInfo handshakeInfo)
        {
            using (var builder = new PacketBuilder())
            {
                builder.WriteInt16(handshakeInfo.Version);
                builder.WriteLengthString(handshakeInfo.Subversion);
                builder.WriteBytes(handshakeInfo.ServerIv);
                builder.WriteBytes(handshakeInfo.ClientIv);

                // Locale ID (used for localizations and test servers)
                builder.WriteByte(handshakeInfo.LocaleId);

                return builder.ToByteArray();
            }
        }
Exemplo n.º 2
0
        private static byte[] ConstructHandshakePacket(HandshakeInfo handshakeInfo)
        {
            var content = ConstructHandshakePacketContent(handshakeInfo);

            using (var builder = new PacketBuilder())
            {
                if (handshakeInfo.Header.HasValue)
                {
                    builder.WriteInt16(handshakeInfo.Header.Value);
                }
                else
                {
                    builder.WriteInt16((ushort)content.Length);
                }

                builder.WriteBytes(content);

                return builder.ToByteArray();
            }
        }