public static byte[] LeafJoin(LinkClient x, IClient client)
        {
            TCPPacketWriter packet = new TCPPacketWriter();

            packet.WriteString(x, client.OrgName);
            packet.WriteString(x, client.Name);
            packet.WriteString(x, client.Version);
            packet.WriteGuid(client.Guid);
            packet.WriteUInt16(client.FileCount);
            packet.WriteIP(Settings.HideIps ? IPAddress.Parse("0.0.0.0") : client.ExternalIP);
            packet.WriteIP(Settings.HideIps ? IPAddress.Parse("0.0.0.0") : client.LocalIP);
            packet.WriteUInt16(Settings.HideIps ? (ushort)0 : client.DataPort);
            packet.WriteString(x, client.DNS);
            packet.WriteByte((byte)(client.Browsable ? 1 : 0));
            packet.WriteByte(client.Age);
            packet.WriteByte(client.Sex);
            packet.WriteByte(client.Country);
            packet.WriteString(x, client.Region);
            packet.WriteByte((byte)client.Level);
            packet.WriteUInt16(client.Vroom);
            packet.WriteByte((byte)(client.CustomClient ? 1 : 0));
            packet.WriteByte((byte)(client.Muzzled ? 1 : 0));
            packet.WriteByte((byte)(client.WebClient ? 1 : 0));
            packet.WriteByte((byte)(client.Encryption.Mode == EncryptionMode.Encrypted ? 1 : 0));
            packet.WriteByte((byte)(client.Registered ? 1 : 0));
            packet.WriteByte((byte)(client.Idled ? 1 : 0));
            byte[] buf = packet.ToLinkPacket(LinkHub.LinkMsg.MSG_LINK_LEAF_JOIN);
            packet = new TCPPacketWriter();
            packet.WriteBytes(buf);
            return(packet.ToAresPacket(TCPMsg.MSG_LINK_PROTO));
        }
        public static byte[] HubUserlistItem(Leaf x, uint ident, LinkUser user)
        {
            TCPPacketWriter packet = new TCPPacketWriter();

            packet.WriteUInt32(ident);
            packet.WriteString(x, user.OrgName);
            packet.WriteString(x, user.Name);
            packet.WriteString(x, user.Version);
            packet.WriteGuid(user.Guid);
            packet.WriteUInt16(user.FileCount);
            packet.WriteIP(user.ExternalIP);
            packet.WriteIP(user.LocalIP);
            packet.WriteUInt16(user.Port);
            packet.WriteString(x, user.DNS);
            packet.WriteByte((byte)(user.Browsable ? 1 : 0));
            packet.WriteByte(user.Age);
            packet.WriteByte(user.Sex);
            packet.WriteByte(user.Country);
            packet.WriteString(x, user.Region);
            packet.WriteByte((byte)user.Level);
            packet.WriteUInt16(user.Vroom);
            packet.WriteByte((byte)(user.CustomClient ? 1 : 0));
            packet.WriteByte((byte)(user.Muzzled ? 1 : 0));
            packet.WriteByte((byte)(user.WebClient ? 1 : 0));
            packet.WriteByte((byte)(user.Encrypted ? 1 : 0));
            packet.WriteByte((byte)(user.Registered ? 1 : 0));
            packet.WriteByte((byte)(user.Idle ? 1 : 0));
            byte[] buf = packet.ToLinkPacket(LinkMsg.MSG_LINK_HUB_USERLIST_ITEM);
            packet = new TCPPacketWriter();
            packet.WriteBytes(buf);
            return(packet.ToAresPacket(TCPMsg.MSG_LINK_PROTO));
        }