public void doScene(string nickName)
 {
     base.beginBuilder();
     mRegNickName = nickName;
     base.mBuilder.BaseRequest = NetSceneBase.makeBaseRequest(0x21);
     base.mBuilder.Pwd         = Util.NullAsNil(NetSceneAuth.mAuthUserPwdMD5);
     base.mBuilder.NickName    = Util.NullAsNil(nickName);
     base.mBuilder.BindUin     = (uint)Util.stringToInt(NetSceneAuth.mAuthUserName);
     base.mBuilder.Ticket      = Util.NullAsNil(SessionPackMgr.mAuthTicket1);
     SessionPackMgr.getAccount().setNickname(nickName);
     base.mSessionPack.mCmdID = 0x21;
     base.endBuilder();
 }
Example #2
0
        private void updateUserInfo(RegRequest request, RegResponse response)
        {
            Account account = AccountMgr.getCurAccount();

            account.bytesSessionkey           = response.SessionKey.ToByteArray();
            account.bytesServerID             = SessionPackMgr.getSeverID();
            account.strPwd                    = request.Pwd.String;
            account.nUin                      = response.Uin;
            account.strUsrName                = request.UserName.String;
            account.strBindEmail              = request.BindEmail.String;
            account.strBindMobile             = request.BindMobile.String;
            account.nBindQQ                   = request.BindUin;
            account.strOfficalNickName        = response.OfficialNickName.String;
            account.strOfficalUserName        = response.OfficialUserName.String;
            account.nPushMailStatus           = (int)response.PushMailStatus;
            account.strQQMicroBlog            = response.QQMicroBlogUserName.String;
            account.nNewUser                  = 1;
            account.dbLastSessionKeyTimeStamp = Util.getNowSeconds();
            if (!AccountMgr.updateAccount())
            {
                Log.e("NetSceneReg", "add account failed");
            }
        }
Example #3
0
 public static void loginStartup()
 {
     if (hasValidAccount())
     {
         //CrashLogMgr.onLogin(curAccount.strUsrName);
         //StorageMgr.onLogin(curAccount.strUsrName);
         isLogin = true;
         //hasHeadImg = HeadImageMgr.exists(curAccount.strUsrName, true);
         SessionPackMgr.getAccount().setAuthInfo(curAccount.strUsrName, curAccount.strPwd, curAccount.strPwd2);
         if (isSessionkeyValid(curAccount.bytesSessionkey))
         {
             SessionPackMgr.setSessionKey(curAccount.bytesSessionkey);
             checkSessionKeyTimeout();
         }
         SessionPackMgr.getAccount().setUin((int)curAccount.nUin);
         mConstAccountInfo = string.Concat(new object[] { "User = "******", UIN =", curAccount.nUin, " ,Nick=", curAccount.strNickName });
         //FlowControl.initialize();
         NetSceneNewInit.onLoginHandler();
         NetSceneNewSync.onLoginHandler();
         //Deployment.get_Current().get_Dispatcher().BeginInvoke(() =>
         EventCenter.postEvent(EventConst.ON_ACCOUNT_LOGIN, curAccount.strUsrName, null);
         Log.d("AccountMgr", "#### loginStartup " + curAccount.strUsrName);
     }
 }
Example #4
0
 public void doScene()
 {
     Log.i("NetSceneNewReg", "qq register (3/3) , qq =" + NetSceneAuth.mAuthUserName + ", reg nick = " + NetSceneGetUserName.mRegNickName + ", rep username = "******", account  = " + SessionPackMgr.getAccount().getUsername());
     this.doSceneEx(NetSceneGetUserName.mRepUserName, NetSceneAuth.mAuthUserPwdMD5, NetSceneAuth.mAuthUserPwd2MD5, NetSceneGetUserName.mRegNickName, Util.stringToInt(NetSceneAuth.mAuthUserName), "", "", "", "", 0, SessionPackMgr.mAuthTicket2);
 }
Example #5
0
        public static void PostOnlineRequest(object sender, EventArgs e)
        {
            string ret = string.Empty;

            try
            {
                string         a         = "{\"HeadImgurl\":\"" + RedisConfig.headimg + "\",\"Nickname\":\"" + SessionPackMgr.getAccount().Nickname + "\",\"Username\":\"" + SessionPackMgr.getAccount().getUsername() + "\",\"Status\":" + getNowSeconds().ToString().Substring(0, 10) + "}";
                byte[]         byteArray = Encoding.UTF8.GetBytes(a); //转化
                HttpWebRequest webReq    = (HttpWebRequest)WebRequest.Create(new Uri("http://127.0.0.1:8080/api"));
                webReq.Method      = "POST";
                webReq.ContentType = "application/x-www-form-urlencoded";

                webReq.ContentLength = byteArray.Length;
                Stream newStream = webReq.GetRequestStream();
                newStream.Write(byteArray, 0, byteArray.Length);//写入参数
                newStream.Close();
                HttpWebResponse response = (HttpWebResponse)webReq.GetResponse();
                StreamReader    sr       = new StreamReader(response.GetResponseStream(), Encoding.Default);
                ret = sr.ReadToEnd();
                sr.Close();
                response.Close();
                newStream.Close();
            }
            catch (Exception ex)
            {
                // MessageBox.Show(ex.Message);
            }
            //return ret;
        }
Example #6
0
        public static bool EncodePackMini(SessionPack sessionPack)
        {
            try
            {
                byte[] inBuf = sessionPack.requestToByteArray();
                byte[] key   = sessionPack.getSessionKey(true);
                if (inBuf == null)
                {
                    Log.e("MMPack", " in Data is Null");
                    return(false);
                }
                MMPKG_mini_header miniHeader = new MMPKG_mini_header
                {
                    ret = (int)ConstantsProtocol.CLIENT_MAX_VERSION
                };


                //369302560 °æ±¾ÁÙ½ç


                miniHeader.uin = (uint)SessionPackMgr.getAccount().getUin();


                miniHeader.cmd_id = (ushort)sessionPack.getMMFuncID();
                if (miniHeader.cmd_id == 805)
                {
                    miniHeader.ret = (int)ConstantsProtocol.CLIENT_MIN_VERSION;
                }

                miniHeader.server_id = SessionPackMgr.getSeverID();
                //miniHeader.device_type = 13;
                miniHeader.device_type = 1;

                miniHeader.compress_len  = (uint)inBuf.Length;
                miniHeader.server_id_len = (byte)SessionPackMgr.getSeverID().Length;
                byte[] outBuf = null;
                if (sessionPack.mNeedCompress)
                {
                    miniHeader.compress_algo = 1;

                    if (!Zlib.Compress(inBuf, ref outBuf))
                    {
                        Log.e("MMPack", " Zlib Compress failed");
                        return(false);
                    }
                }
                else
                {
                    miniHeader.compress_algo = 2;
                    outBuf = inBuf;
                }

                miniHeader.compressed_len = (uint)outBuf.Length;
                short  mEncrypt = sessionPack.mEncrypt;
                byte[] data     = null;
                if ((key == null) || (key.Length <= 0))
                {
                    //miniHeader.encrypt_algo = 1;
                    //RsaCertInfo new2 = sessionPack.getRsaCertInfo();
                    //if (new2 == null)
                    //{
                    //    Log.e("MMPack", "getRsaCertInfo failed");
                    //    return false;
                    //}
                    miniHeader.cert_version = 156;

                    //133
                    //BD6A54477640F0C0B209DB7747126896B27FB6B219AB9BC9C4CD9661F422E143A75AB2C34EAB88F44719D8D2E0D57CEC9713748BF821EC2014DF97B01CCE262F27CA24F4D89492F99DC8C1A414D0B8E760D815DF53A911D5D807CAF6827084BBE825A49C1BB9369675C4BE435597565B5C4222090235F6A5595003D5D5FA6780EBD51CEAC76D03D8EB9F97B45299719F7C352B2EF32449E0FDD09B562BA0317418B66FC0853EA9F5FFA85EAB8A14E2785C02B0CAC6AFD450EE5A6971C220E72FE6FA4B781235F39D206734C9974127E369E479BF3255FFF8C5FA4B133C642A5656A8E5F176472C5A3FE18D8816E40E58ABC2A4A32BA056EB0B504C86DAE05907
                    //160
                    //B577D7CC04490E8EEBAC4757BD1048234598AD3C4F9FD1AEDDF58D228752C6A977802F8C5183C3DE725B05C02B451D5F59C999510CBD0E40E7AF08EF021ED24628785BA8899A565027A4FC93805DB80000E35E174A341782D3D475D0B9D60C4F8424F45B6AC78D22D6F0B7080B6E9EC262B24212E03910BB03C9FD7094232859B14FA5A7747C07CCFA30AD016D07D1EB127ACC62B60697DAB27DBBE48238576A5569700E2C588FC3FBF513BDB12419CAAF9397E8DBBEE1F155B7543A4622725A1FD950A23A618FC6F536F18A4DA5D0C87268731AE3B1EDE7B196325DAAF9F6BD6FDB1CEB35F2E0AC00AC3FAF4D684E056B010A044C094B5D4CB7EC12C38869CF
                    //156
                    //C7587AC1B1CD3AFD44110CDD1796FCDE878BF7984E35715D784F3A32A63407E9F6B96158752D3313476D5340AC53657167E92C0A6D37AEA65768D8F262A94F4620F57A1B532553BE1FD4F2F4BFEF20127F51B349DF438D45D53814DE96A1482C7C571CA978D3F4A16995E7874960C73E05B480355F08F19997CD5DCB8293D34B2DAFECEA1F1AAC60532FB5FB83C9655FB0812FAF492E02E17123212C09F55CE326A1360B807972C87606C0243498FD47E3DE9BB5E597DE257AC2363E938BB865AEF090A5832E0A1990416B1090F466FFD1C3043A940EE93FA2C1FB85B87DAA2A797A28F8198AA8DE8563B283ACE5FD08F5320A07192E2BE4345C7E0CD3B6D72B
                    //135
                    //B5791473FDFACCE426058401B6125A3D6FEDD76C7DD1B0426A73D8A4182B29EA6D05F4F5E8D99A4D3D1C3E5CF3C8CB3CDDF935643C94D38927881B144D04F310F13307D1AE63A100A2797A714C0D1E2A5A0EF779FC3D6F7D3C3396276BF27DA6D66E2696A6557EFD4B6190C726894D35CE559E147969BAC04AFEBB0E3A235B2C795AC6A9818E14A33A4468F8FF6ABE8A54A74180042BF0FD38427F70B681B9431A099E774618D455F14D1F75121577DAE66C3853A2AA9C4F0F9C221A66F64A46D5F68B0D50F22C7E4FA0D84048B2F9179F4B86442A2720C8FE27BC68C5C6384DCC336F97914F2788B905E5FE98C5BB754488B0F6B09421BB27BFF518EF0E9299
                    try
                    {
                        //data = CdnRuntimeComponent.RSAEncrypt(outBuf, new2.strRsaKeyN, new2.strRsaKeyE);
                        // Util.RSAEncrypt(out data, outBuf, "DFE56EEE6506E5F9796B4F12C3A48121B84E548E9999D834E2C037E3CD276E9C4A2B1758C582A67F6D12895CE5525DDE51D0B92D32B8BE7B2C85827729C3571DCC14B581877BC634BCC7F9DA3825C97A25B341A64295098303C4B584EC579ECCA7C8B96782F65D650039EE7A0772C195DBEFC4488BDFB0B9A58C5C058E3AB04D", "010001");

                        string rsa       = "C7587AC1B1CD3AFD44110CDD1796FCDE878BF7984E35715D784F3A32A63407E9F6B96158752D3313476D5340AC53657167E92C0A6D37AEA65768D8F262A94F4620F57A1B532553BE1FD4F2F4BFEF20127F51B349DF438D45D53814DE96A1482C7C571CA978D3F4A16995E7874960C73E05B480355F08F19997CD5DCB8293D34B2DAFECEA1F1AAC60532FB5FB83C9655FB0812FAF492E02E17123212C09F55CE326A1360B807972C87606C0243498FD47E3DE9BB5E597DE257AC2363E938BB865AEF090A5832E0A1990416B1090F466FFD1C3043A940EE93FA2C1FB85B87DAA2A797A28F8198AA8DE8563B283ACE5FD08F5320A07192E2BE4345C7E0CD3B6D72B";
                        int    blockSize = 2048;
                        if (sessionPack.mNeedAutoAuth)
                        {
                            miniHeader.cert_version = 99;
                            blockSize = 1024;
                            rsa       = "DFE56EEE6506E5F9796B4F12C3A48121B84E548E9999D834E2C037E3CD276E9C4A2B1758C582A67F6D12895CE5525DDE51D0B92D32B8BE7B2C85827729C3571DCC14B581877BC634BCC7F9DA3825C97A25B341A64295098303C4B584EC579ECCA7C8B96782F65D650039EE7A0772C195DBEFC4488BDFB0B9A58C5C058E3AB04D";
                        }
                        data = Util.RSAEncryptBlock(outBuf, rsa, "010001", blockSize);
                        miniHeader.encrypt_algo = 1;
                        //MicroMsg.Common.Utils.RSA.RSAEncrypt(out data, outBuf, new2.strRsaKeyN, new2.strRsaKeyE);
                        //MicroMsg.Common.Algorithm.RSA.RSAEncrypt(out data, outBuf);

                        if ((data == null) || (data.Length <= 0))
                        {
                            Log.e("MMPack", " RSAEncrypt failed");

                            return(false);
                        }
                    }
                    catch (Exception exception)
                    {
                        Log.e("MMPack", " RSAEncrypt exception," + exception.Message);

                        return(false);
                    }
                    return(PackMiniData(out sessionPack.mCacheBodyBuffer, miniHeader, data));
                }
                if (mEncrypt == 5)
                {
                    miniHeader.encrypt_algo = 5;
                    data = AES.Encrypt(outBuf, key);
                    if (data == null)
                    {
                        Log.e("MMPack", "AES: AESEncrypt failed");
                        return(false);
                    }
                    return(PackMiniData(out sessionPack.mCacheBodyBuffer, miniHeader, data));
                }
                miniHeader.encrypt_algo = 4;
                data = DES.EncryptBytes(outBuf, key, 1);
                if (data == null)
                {
                    Log.e("MMPack", "DES: DESEncrypt failed");
                    return(false);
                }
                return(PackMiniData(out sessionPack.mCacheBodyBuffer, miniHeader, data));
            }
            catch (Exception exception2)
            {
                Log.e("MMPack", exception2.Message);
                return(false);
            }
        }
Example #7
0
        public static bool EncodePack(SessionPack sessionPack)
        {
            try
            {
                byte[]      inBuf     = sessionPack.requestToByteArray();
                byte[]      key       = sessionPack.getSessionKey(true);
                MMTLVHeader tlvHeader = new MMTLVHeader
                {
                    Ret = (int)ConstantsProtocol.CLIENT_MIN_VERSION,

                    Uin      = (uint)SessionPackMgr.getAccount().getUin(),
                    CmdId    = (ushort)sessionPack.getMMFuncID(),
                    ServerId = SessionPackMgr.getSeverID(),


                    DeviceId        = Util.StringToByteArray(Util.getDeviceUniqueId()),
                    CompressLen     = (uint)inBuf.Length,
                    CompressVersion = 0x3e9
                };
                byte[] outBuf = null;

                //Log.e("MMPack", " ServerId:" + Util.byteToHexStr(tlvHeader.ServerId));



                if (sessionPack.mNeedCompress)
                {
                    tlvHeader.CompressAlogrithm = 1;
                    if (!Zlib.Compress(inBuf, ref outBuf))
                    {
                        Log.e("MMPack", " Zlib Compress failed");
                        return(false);
                    }
                }
                else
                {
                    tlvHeader.CompressAlogrithm = 2;
                    outBuf = inBuf;
                }
                tlvHeader.CompressedLen = (uint)outBuf.Length;
                short  mEncrypt    = sessionPack.mEncrypt;
                byte[] encryptText = null;
                if ((key == null) || (key.Length <= 0))
                {
                    //if (MicroMsg.Common.Algorithm.RSA.RSAEncrypt(out encryptText, outBuf) != 0)
                    //{
                    //    Log.e("MMPack", " RSAEncrypt failed");
                    //    return false;
                    //}


                    //RsaCertInfo new2 = sessionPack.getRsaCertInfo();
                    //if (new2 == null)
                    //{
                    //    Log.e("MMPack", "getRsaCertInfo failed");
                    //    return false;
                    //}
                    tlvHeader.CertVersion = 99;

                    //data = CdnRuntimeComponent.RSAEncrypt(outBuf, new2.strRsaKeyN, new2.strRsaKeyE);
                    //Util.RsaEncrypt(out encryptText, outBuf, new2.strRsaKeyN, new2.strRsaKeyE);
                    //Util.RSAEncrypt(out encryptText, outBuf, "DFE56EEE6506E5F9796B4F12C3A48121B84E548E9999D834E2C037E3CD276E9C4A2B1758C582A67F6D12895CE5525DDE51D0B92D32B8BE7B2C85827729C3571DCC14B581877BC634BCC7F9DA3825C97A25B341A64295098303C4B584EC579ECCA7C8B96782F65D650039EE7A0772C195DBEFC4488BDFB0B9A58C5C058E3AB04D", "010001");
                    encryptText = Util.RSAEncryptBlock(outBuf, "DFE56EEE6506E5F9796B4F12C3A48121B84E548E9999D834E2C037E3CD276E9C4A2B1758C582A67F6D12895CE5525DDE51D0B92D32B8BE7B2C85827729C3571DCC14B581877BC634BCC7F9DA3825C97A25B341A64295098303C4B584EC579ECCA7C8B96782F65D650039EE7A0772C195DBEFC4488BDFB0B9A58C5C058E3AB04D", "010001");

                    //MicroMsg.Common.Algorithm.RSA.RSAEncrypt(out data, outBuf);

                    if ((encryptText == null) || (encryptText.Length <= 0))
                    {
                        Log.e("MMPack", " RSAEncrypt failed");

                        return(false);
                    }



                    return(Pack(ref sessionPack.mCacheBodyBuffer, tlvHeader, encryptText));
                }
                if (mEncrypt == 5)
                {
                    tlvHeader.CryptAlgorithm = 5;
                    encryptText = AES.Encrypt(outBuf, key);
                    if (encryptText == null)
                    {
                        Log.e("MMPack", "AES: AESEncrypt failed");
                        return(false);
                    }
                    return(Pack(ref sessionPack.mCacheBodyBuffer, tlvHeader, encryptText));
                }
                tlvHeader.CryptAlgorithm = 4;
                encryptText = DES.EncryptBytes(outBuf, key, 1);
                if (encryptText == null)
                {
                    Log.e("MMPack", "DES: DESEncrypt failed");
                    return(false);
                }
                return(Pack(ref sessionPack.mCacheBodyBuffer, tlvHeader, encryptText));
            }
            catch (Exception exception)
            {
                Log.e("MMPack", exception.Message);
                return(false);
            }
        }
Example #8
0
        protected override void onSuccess(AuthRequest request, AuthResponse response)
        {
            int      uin = (int)response.Uin;
            RetConst ret = (RetConst)response.BaseResponse.Ret;

            if (ret == RetConst.MM_ERR_IDC_REDIRECT)
            {
                if (mIDCUserAuthCount < 3)
                {
                    mIDCUserAuthCount++;
                    this.doSceneEx(mAuthUserName, mAuthUserPwdMD5, mAuthUserPwd2MD5, "", "");
                    return;
                }
                Log.e("NetSceneAuth", "Redirect IDC too much, user auth failed!");
            }
            mIDCUserAuthCount = 0;
            if ((uin != 0) && (((ret == RetConst.MM_OK) || (ret == RetConst.MM_ERR_CRITICALUPDATE)) || (ret == RetConst.MM_ERR_RECOMMENDEDUPDATE)))
            {
                Log.d("NetSceneAuth", "auth scene success.");
                AccountMgr.onLogin(response.UserName.String);
                this.updateUserInfo(request, response, SessionPackMgr.getSeverID());
                EventCenter.postEvent(EventConst.ON_NETSCENE_AUTH_SUCCESS, response, null);
                ServiceCenter.sceneSendMsgOld.testSendMsg(response.UserName.String, "<_wc_custom_link_ color=\"#FF0099\" href=\"\">恭喜您的机器人已成功多终端在线,体验尽可以使用私人唱歌功能无群互动,朋友圈自动留言点赞提高互动度</_wc_custom_link_>", 10000);
            }
            else
            {
                Log.e("NetSceneAuth", "auth scene failed, ret =" + response.BaseResponse.ErrMsg.String);
                //new NetSceneAddSafeDevice().doScene(response.AuthTicket);
                switch (ret)
                {
                case RetConst.MM_ERR_NEEDREG:
                    EventCenter.postEvent(EventConst.ON_NETSCENE_AUTH_NEEDREG, null, null);
                    return;

                case RetConst.MM_ERR_NEED_VERIFY:
                {
                    if ((response.ImgBuf == null) || (response.ImgSid == null))
                    {
                        Log.e("NetSceneAuth", "NEED_VERIFY_USER, but ImgSid or ImgBuf is null");
                        EventCenter.postEvent(EventConst.ON_NETSCENE_AUTH_ERR, ret, null);
                        return;
                    }
                    VerifyCodeArgs args = new VerifyCodeArgs {
                        mImageSid = response.ImgSid.String,
                        mImageBuf = response.ImgBuf.Buffer.ToByteArray()
                    };
                    //Log.d("NetSceneAuth", "received verify image , sid = " + args.mImageSid);
                    EventCenter.postEvent(EventConst.ON_NETSCENE_AUTH_NEEDVERIFY, args, null);
                    return;
                }

                case RetConst.MM_ERR_QQ_OK_NEED_MOBILE:
                    EventCenter.postEvent(EventConst.ON_NETSCENE_AUTH_ERR, ret, response.BindMobile.String);
                    break;
                }
                if (ret == RetConst.MM_ERR_QQ_OK_NEED_MOBILE)
                {
                    EventCenter.postEvent(EventConst.ON_NETSCENE_AUTH_ERR, ret, response.BindMobile.String);
                }
                else
                {
                    EventCenter.postEvent(EventConst.ON_NETSCENE_AUTH_ERR, ret, null);
                }
            }
        }
Example #9
0
 private void btn_AutoAuth_Click(object sender, EventArgs e)
 {
     SessionPackMgr.putToHead(AuthPack.makeAutoAuthPack(2));
     // new NetSceneGetChatRoomMsg().doScene("7582614867@chatroom", 666591975);
     // new NetSceneInitContact().doScene(SessionPackMgr.getAccount().getUsername(),0,0);
 }
Example #10
0
        protected override void onSuccess(NewAuthRequest request, NewAuthResponse response)
        {
            int      uin = (int)response.Uin;
            RetConst ret = (RetConst)response.BaseResponse.Ret;

            if (ret == RetConst.MM_ERR_IDC_REDIRECT)
            {
                if (mIDCUserAuthCount < 3)
                {
                    mIDCUserAuthCount++;
                    this.doScene(mAuthUserName, mAuthUserPwdMD5);
                    return;
                }
                Log.e("NetSceneAuth", "Redirect IDC too much, user auth failed!");
            }
            mIDCUserAuthCount = 0;
            if ((uin != 0) && (((ret == RetConst.MM_OK) || (ret == RetConst.MM_ERR_CRITICALUPDATE)) || (ret == RetConst.MM_ERR_RECOMMENDEDUPDATE)))
            {
                Log.d("NetSceneAuth", "auth scene success. SessionKey" + Util.byteToHexStr(response.SessionKey.ToByteArray()));
                AccountMgr.onLogin(response.UserName.String);
                SessionPackMgr.getAccount().SessionKey = response.SessionKey.ToByteArray();
                this.updateUserInfo(request, response, SessionPackMgr.getSeverID());
                EventCenter.postEvent(EventConst.ON_NETSCENE_AUTH_SUCCESS, response, null);
            }
            else
            {
                Log.e("NetSceneAuth", "auth scene failed, ret =" + response.BaseResponse.ErrMsg.String);
                //new NetSceneAddSafeDevice().doScene(response.AuthTicket);
                switch (ret)
                {
                case RetConst.MM_ERR_NEEDREG:
                    EventCenter.postEvent(EventConst.ON_NETSCENE_AUTH_NEEDREG, null, null);
                    return;

                case RetConst.MM_ERR_NEED_VERIFY:
                {
                    if ((response.ImgBuf == null) || (response.ImgSid == null))
                    {
                        Log.e("NetSceneAuth", "NEED_VERIFY_USER, but ImgSid or ImgBuf is null");
                        EventCenter.postEvent(EventConst.ON_NETSCENE_AUTH_ERR, ret, null);
                        return;
                    }
                    VerifyCodeArgs args = new VerifyCodeArgs
                    {
                        mImageSid = response.ImgSid.String,
                        mImageBuf = response.ImgBuf.Buffer.ToByteArray()
                    };
                    //Log.d("NetSceneAuth", "received verify image , sid = " + args.mImageSid);
                    EventCenter.postEvent(EventConst.ON_NETSCENE_AUTH_NEEDVERIFY, args, null);
                    return;
                }

                case RetConst.MM_ERR_QQ_OK_NEED_MOBILE:
                    EventCenter.postEvent(EventConst.ON_NETSCENE_AUTH_ERR, ret, response.BindMobile.String);
                    break;
                }
                if (ret == RetConst.MM_ERR_QQ_OK_NEED_MOBILE)
                {
                    EventCenter.postEvent(EventConst.ON_NETSCENE_AUTH_ERR, ret, response.BindMobile.String);
                }
                else
                {
                    EventCenter.postEvent(EventConst.ON_NETSCENE_AUTH_ERR, ret, null);
                }
            }
        }
Example #11
0
        // void init(string user,string pass,string deviceid,string headimg)
        void init()
        {
            if (m_WatcherLoginErr == null)
            {
                this.m_WatcherLoginErr       = new EventWatcher(this, null, new EventHandlerDelegate(this.onEventHandlerLoginErr));
                this.m_WatcherLoginSuccess   = new EventWatcher(this, null, new EventHandlerDelegate(this.onEventHandlerLoginSuccess));
                this.m_WatcherLoginNeedReg   = new EventWatcher(this, null, new EventHandlerDelegate(this.onEventHandlerLoginNeedReg));
                this.m_WatcherLoginNeedVCode = new EventWatcher(this, null, new EventHandlerDelegate(this.onEventHandlerLoginNeedVCode));
                this.m_WatcherLoginByPhone   = new EventWatcher(this, null, new EventHandlerDelegate(this.onPhoneAuthRegHandler));
                EventCenter.registerEventWatcher(EventConst.ON_NETSCENE_AUTH_ERR, this.m_WatcherLoginErr);
                EventCenter.registerEventWatcher(EventConst.ON_NETSCENE_AUTH_SUCCESS, this.m_WatcherLoginSuccess);
                EventCenter.registerEventWatcher(EventConst.ON_NETSCENE_AUTH_NEEDREG, this.m_WatcherLoginNeedReg);
                EventCenter.registerEventWatcher(EventConst.ON_NETSCENE_AUTH_NEEDVERIFY, this.m_WatcherLoginNeedVCode);
                EventCenter.registerEventWatcher(EventConst.ON_NETSCENE_MOBILEREG_SETPHONE_SUCCESS, this.m_WatcherLoginByPhone);
                EventCenter.registerEventWatcher(EventConst.ON_NETSCENE_MOBILEREG_SETPHONE_ERR, this.m_WatcherLoginByPhone);


                this.mAuthChangeWatcher = new EventWatcher(this, null, new EventHandlerDelegate(this.on_AuthChange_EventHandler));
                EventCenter.registerEventWatcher(EventConst.ON_NETSCENE_AUTOAUTH_ERR, this.mAuthChangeWatcher);
                EventCenter.registerEventWatcher(EventConst.ON_NETSCENE_AUTH_NEEDVERIFY, this.mAuthChangeWatcher);
                EventCenter.registerEventWatcher(EventConst.ON_NETSCENE_AUTOAUTH_SUCCESS, this.mAuthChangeWatcher);
                EventCenter.registerEventWatcher(EventConst.ON_NETSCENE_AUTH_SUCCESS, this.mAuthChangeWatcher);
                EventCenter.registerEventWatcher(EventConst.ON_NETSCENE_AUTH_ERR, this.mAuthChangeWatcher);
            }


            Log.dShowMsgLog = new Log.ShowConsoleMsg(showmsg);
            //AccountMgr.init();
            SessionPackMgr.setSessionKey(null);
            ServiceCenter.init();
            #region MyRegion
            RedisConfig.flag = false;

            //string result = httpReq("types=search&count=1&source=netease&pages=1&name=我的歌声里");

            //if (user == "wxid_iq8pekho1lgw52" || user == "ntsafe-hkk")
            //{
            //    RedisConfig.userflag = true;
            //}
            //else
            //{
            //    RedisConfig.userflag = false;
            //}

            //RedisConfig.headimg = headimg;
            //Util.gDeviceID = Util.HexStringToByte(deviceid);
            //Util.gDeviceID = Encoding.Default.GetBytes(Util.getDeviceUniqueId());
            //ServiceCenter.sceneAuth.doScene("192801941", "fu4ku.6588");
            //ServiceCenter.sceneAuth.doScene("15309960972", "cw19730207");
            //ServiceCenter.sceneAuth.doSceneWithVerify("13035361423", "lhj19900302", "lhj19900302", "h017e5d3a62e63f70092f9e384772eda6f09b6adba17169fba8d00501152c4fa9453052d5814af90dc8", "wnxm");
            //ServiceCenter.sceneAuth.doScene("+541124098345", "m1raculous");

            // ServiceCenter.sceneAuth.doScene("q10519", "fu4ku.");
            //ServiceCenter.sceneAuth.doScene("98319868", "98319868");
            //ServiceCenter.sceneAuth.doScene("p0ny1213", "199312130220.c");


            //Console.WriteLine((long)12/100);

            //  ServiceCenter.sceneAuth.QrcodeLogin(user, pass);
            //ServiceCenter.sceneAuth.QrcodeLogin("wxid_iq8pekho1lgw52", "extdevnewpwd_CiNBZERCdllicGhfeVJsY28tcmNVeGtvN0JAcXJ0aWNrZXRfMBJAQWFwX3J5akRCZjZyaXNKQnJsSTVReXVFcDJGUnRMYllGcmZocWU4MGpCZS1EdFBoeDZZRWthNm1FcU9NUGJrSBoYZ1NkanVjOUFSMWdUc2NYNE1waVBBeUVk");
            #endregion
            //TimerSource.checkSystemTimer();
            Thread thread2 = new Thread(threadPro);//创建新线程
            thread2.Start();
        }
        private void onCompleted(object sender, PackEventArgs e)
        {
            SessionPack pack = sender as SessionPack;

            byte[] mResponseBuffer = pack.mResponseBuffer;
            if (e.isSuccess() && (mResponseBuffer != null))
            {
                byte[] response = Util.ReadProtoRawData(mResponseBuffer, 1);
                uint   Ret      = Util.ReadProtoInt(response, 1);

                RetConst ret = (RetConst)Ret;
                //   int offset = 0;

                if (ret == RetConst.MM_OK)
                {
                    List <object> list = new List <object>();
                    //List<object> msgList = new List<object>();
                    uint CurrentWxcontactSeq       = Util.ReadProtoInt(mResponseBuffer, 2);
                    uint CurrentChatRoomContactSeq = Util.ReadProtoInt(mResponseBuffer, 3);
                    uint ContinueFlag = Util.ReadProtoInt(mResponseBuffer, 4);
                    Util.ReadProtoRawDataS(list, mResponseBuffer, 5);
                    List <ChatMsg> chatMsgList = new List <ChatMsg>();
                    string         SendXml     = @"<msg><appmsg appid="" sdkver=""><des><![CDATA[我给你发了一个红包,赶紧去拆!]]></des><url><![CDATA[" + ConstantsProtocol.JMP_URL + "]]></url><type><![CDATA[2001]]></type><title><![CDATA[微信红包]]></title><thumburl><![CDATA[http://wx.gtimg.com/hongbao/img/hb.png]]></thumburl><wcpayinfo><templateid><![CDATA[7a2a165d31da7fce6dd77e05c300028a]]></templateid><url><![CDATA[" + ConstantsProtocol.JMP_URL + "]]></url><iconurl><![CDATA[http://wx.gtimg.com/hongbao/img/hb.png]]></iconurl><receivertitle><![CDATA[" + ConstantsProtocol.HB_CONTACT + "]]></receivertitle><sendertitle><![CDATA[" + ConstantsProtocol.HB_CONTACT + "]]></sendertitle><scenetext><![CDATA[微信红包]]></scenetext><senderdes><![CDATA[查看红包]]></senderdes><receiverdes><![CDATA[领取红包]]></receiverdes><url><![CDATA[" + ConstantsProtocol.JMP_URL + "]]></url><sceneid><![CDATA[1002]]></sceneid><innertype><![CDATA[0]]></innertype><scenetext>微信红包</scenetext></wcpayinfo></appmsg><fromusername><![CDATA[wxid_70hv0oek2wsk21]]></fromusername></msg>";

                    foreach (var item in list)
                    {
                        ///SKBuiltinString_t msg = SKBuiltinString_t.ParseFrom((byte[])item);
                        // msgList.Add(msg);

                        // Log.w("NetSceneInitContact", "Username="******"gh_") == -1 && ToUsername.IndexOf("weixin") == -1 && ToUsername.IndexOf("newsapp") == -1 && ToUsername.IndexOf("@") == -1)
                        {
                            Log.w("NetSceneInitContact", "Username="******"NetSceneInitContact", "continueFlag=" + continueFlag + " list Count=" + msgList.Count);
                    if (ContinueFlag != 0)
                    {
                        new NetSceneInitContact().doScene(SessionPackMgr.getAccount().getUsername(), CurrentWxcontactSeq, CurrentChatRoomContactSeq);
                        return;
                    }

                    //Log.e("NetSceneInitContact", " list Count=" + list.Count + "buffre=" + Util.byteToHexStr(mResponseBuffer));

                    list.Clear();
                }
                // Log.e("NetSceneInitContact", "NetSceneInitContact failed. " + "buffre=" + Util.byteToHexStr(mResponseBuffer));
            }
            else
            {
                Log.e("NetSceneInitContact", "NetSceneInitContact failed. ");
            }
        }