示例#1
0
        public static byte[] Login()
        {
            String          str;
            TCPPacketWriter packet = new TCPPacketWriter();

            packet.WriteGuid(Settings.Guid);
            packet.WriteUInt16(0);
            packet.WriteByte((byte)Settings.GetReg <int>("crypto", 250));
            packet.WriteUInt16(Settings.Port);
            packet.WriteIP("0.0.0.0");
            packet.WriteUInt16(65535);
            packet.WriteUInt32(0);
            packet.WriteString(Settings.GetReg <String>("username", String.Empty), true);
            packet.WriteString(Settings.APP_NAME + " " + Settings.APP_VERSION, true);
            packet.WriteIP(Settings.LocalIP);
            packet.WriteIP(Settings.LocalIP);
            packet.WriteByte(7);
            packet.WriteBytes(new byte[] { 0, 0, 0 });
            packet.WriteByte((byte)Settings.GetReg <int>("user_age", 0));
            packet.WriteByte((byte)Settings.GetReg <int>("user_gender", 0));
            packet.WriteByte((byte)Settings.GetReg <int>("user_country", 0));
            str = Settings.GetReg <String>("user_region", String.Empty);

            if (str.Length > 30)
            {
                str = str.Substring(0, 30);
            }

            packet.WriteString(str);
            ClientFeatures features = (ClientFeatures)0;

            if (Settings.GetReg <bool>("vc_public", true))
            {
                features |= ClientFeatures.CLIENT_SUPPORTS_OPUS_VC;
                features |= ClientFeatures.CLIENT_SUPPORTS_VC;
            }

            if (Settings.GetReg <bool>("vc_private", true))
            {
                features |= ClientFeatures.CLIENT_SUPPORTS_OPUS_PM_VC;
                features |= ClientFeatures.CLIENT_SUPPORTS_PM_VC;
            }

            if (Settings.CanHTML)
            {
                features |= ClientFeatures.CLIENT_SUPPORTS_HTML;
            }

            packet.WriteByte((byte)features);
            return(packet.ToAresPacket(TCPMsg.MSG_CHAT_CLIENT_LOGIN));
        }
示例#2
0
        public static byte[] Update(CryptoService c)
        {
            String          str;
            TCPPacketWriter packet = new TCPPacketWriter();

            packet.WriteUInt16(0);
            packet.WriteByte(7);
            packet.WriteIP("0.0.0.0");
            packet.WriteUInt16(65535);
            packet.WriteIP(Settings.LocalIP);
            packet.WriteByte((byte)Settings.GetReg <int>("user_age", 0));
            packet.WriteByte((byte)Settings.GetReg <int>("user_gender", 0));
            packet.WriteByte((byte)Settings.GetReg <int>("user_country", 0));
            str = Settings.GetReg <String>("user_region", String.Empty);

            if (str.Length > 30)
            {
                str = str.Substring(0, 30);
            }

            packet.WriteString(str, c);
            return(packet.ToAresPacket(TCPMsg.MSG_CHAT_CLIENT_UPDATE_STATUS));
        }