Пример #1
0
        private void onCompleted(object sender, PackEventArgs e)
        {
            SessionPack pack = sender as SessionPack;

            byte[] mResponseBuffer = pack.mResponseBuffer;
            if (e.isSuccess() && (mResponseBuffer != null))
            {
                int offset = 0;
                int num2   = Util.readInt(mResponseBuffer, ref offset);
                Log.d("NetSceneSyncCheck", "new sync check success, continueFlag =  " + num2);
                if ((num2 & 7) != 0)
                {
                    //
                    EventCenter.postEvent(EventConst.ON_NETSCENE_NOTIFY_SYNC_REQ, num2 & 7, null);
                }
                else
                {
                    ServiceCenter.sceneNewSync.doScene(num2 & 7, syncScene.MM_NEWSYNC_SCENE_TIMER);
                }
                //EventCenter.postEvent(EventConst.ON_NETSCENE_NOTIFY_SYNC_REQ, null, null);
            }
            else
            {
                Log.e("NetSceneSyncCheck", "new sync check failed. ");
            }
        }
Пример #2
0
        private void onCompleted(object sender, PackEventArgs e)
        {
            SessionPack pack            = sender as SessionPack;
            TResponse   mResponseObject = (TResponse)pack.mResponseObject;
            TRequest    mRequestObject  = (TRequest)pack.mRequestObject;

            if (e.isSuccess())
            {
                if (base.mSessionPack == null)
                {
                    Log.e("NetSceneBaseEx", "response on success, but cancelled, seq = " + pack.mSeqID);
                    this.mErrorCode = PackResult.BEEN_CANCELLED;
                    this.onFailed(mRequestObject, mResponseObject);
                }
                else
                {
                    this.onSampleSpeed((int)(base.mSessionPack.timeInRecvEnd - base.mSessionPack.timeInSent));
                    base.mSessionPack = null;
                    this.onSuccess(mRequestObject, mResponseObject);
                }
            }
            else
            {
                Log.e("NetSceneBaseEx", "send pack error, result = " + e.result);
                this.mErrorCode   = e.result;
                base.mSessionPack = null;
                this.onFailed(mRequestObject, mResponseObject);
            }
        }
Пример #3
0
        private void NewPack(object sender, PackEventArgs e)
        {
            DateTime           Time  = DateTime.Now;
            List <Entity.Card> Cards = new List <Entity.Card>();

            foreach (var Card in e.Cards)
            {
                HDTCard cardFromId = Database.GetCardFromId(Card.Id);
                Cards.Add(new Entity.Card(cardFromId, 1 == Card.PremiumType));
            }

            OnPackOpened(new Pack(e.PackId, Time, Cards));
        }
Пример #4
0
        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)
                {
                    uint          continueFlag = Util.ReadProtoInt(mResponseBuffer, 2);
                    List <object> list         = new List <object>();
                    List <object> msgList      = new List <object>();
                    Util.ReadProtoRawDataS(list, mResponseBuffer, 3);
                    foreach (var item in list)
                    {
                        AddMsg msg = AddMsg.ParseFrom((byte[])item);
                        msgList.Add(msg);
                    }

                    NetSceneNewSync.processAddMsgList(msgList);
                    Log.e("NetSceneGetChatRoomMsg", "continueFlag=" + continueFlag + " list Count=" + msgList.Count);

                    if (continueFlag != 0)
                    {
                        Log.e("NetSceneGetChatRoomMsg", "continueFlag=" + continueFlag + " list Count=" + msgList.Count + "buffre=" + Util.byteToHexStr(mResponseBuffer));
                    }

                    list.Clear();
                    msgList.Clear();
                }
            }
            else
            {
                Log.e("NetSceneGetChatRoomMsg", "NetSceneGetChatRoomMsg failed. ");
            }
        }
Пример #5
0
        private void NewPack(object sender, PackEventArgs e)
        {
            var Time  = DateTime.Now;
            var Cards = new List <Entity.Card>();

            foreach (var Card in e.Cards)
            {
                var  cardFromId = Database.GetCardFromId(Card.Id);
                bool isPremium;
                try
                {
                    isPremium = ((dynamic)Card).Premium;
                }
                catch
                {
                    isPremium = ((dynamic)Card).PremiumType == 1;
                }
                Cards.Add(new Entity.Card(cardFromId, isPremium));
            }

            this.OnPackOpened(new Pack(e.PackId, Time, Cards));
        }
Пример #6
0
        private void onCompleted(object sender, PackEventArgs e)
        {
            SessionPack pack = sender as SessionPack;

            byte[] mResponseBuffer = pack.mResponseBuffer;
            if (e.isSuccess() && (mResponseBuffer != null))
            {
                //
                //  int num2 = Util.readInt(mResponseBuffer, ref offset);
                //Log.d("GetLoginQRCode", "mResponseBuffer" + Util.byteToHexStr(mResponseBuffer));


                byte[] response = Util.ReadProtoRawData(mResponseBuffer, 1);
                uint   Ret      = Util.ReadProtoInt(response, 1);

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

                if (ret == RetConst.MM_OK)
                {
                    GetLoginQrcode qrcode = new GetLoginQrcode();
                    response         = Util.ReadProtoRawData(mResponseBuffer, 2);
                    qrcode.ImgBuf    = Util.ReadProtoRawData(response, 2);
                    qrcode.Uuid      = Encoding.UTF8.GetString(Util.ReadProtoRawData(mResponseBuffer, 3));
                    qrcode.CheckTime = Util.ReadProtoInt(mResponseBuffer, 4);

                    response           = Util.ReadProtoRawData(mResponseBuffer, 5);
                    qrcode.NotifyKey   = Util.ReadProtoRawData(response, 2);
                    qrcode.ExpiredTime = Util.ReadProtoInt(mResponseBuffer, 6);
                    //  Log.d("GetLoginQRCode", " thread id " + Thread.CurrentThread.ManagedThreadId.ToString());
                    EventCenter.postEvent(EventConst.ON_LOGIN_GETQRCODE, qrcode, null);
                }
            }
            else
            {
                Log.e("GetLoginQRCode", "GetLoginQRCode failed. ");
            }
        }
Пример #7
0
        private void onCompleted(object sender, PackEventArgs e)
        {
            SessionPack pack = sender as SessionPack;

            byte[] mResponseBuffer = pack.mResponseBuffer;
            if (e.isSuccess() && (mResponseBuffer != null))
            {
                //
                //  int num2 = Util.readInt(mResponseBuffer, ref offset);
                //Log.d("GetLoginQRCode", "mResponseBuffer" + Util.byteToHexStr(mResponseBuffer));


                byte[] response = Util.ReadProtoRawData(mResponseBuffer, 1);
                uint   Ret      = Util.ReadProtoInt(response, 1);

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

                if (ret == RetConst.MM_OK)
                {
                    response = Util.ReadProtoRawData(mResponseBuffer, 3);
                    response = Util.ReadProtoRawData(response, 1);
                    byte[] decryptedData = AES.Decrypt(Util.ReadProtoRawData(response, 2), pack.NotifyKey);

                    //Log.d("NetSceneCheckLoginQRCode", " thread id " + Thread.CurrentThread.ManagedThreadId.ToString());
                    //Log.d("NetSceneCheckLoginQRCode", " decryptedData " + Util.byteToHexStr(decryptedData));


                    CheckQrcode qrcode = new CheckQrcode();

                    qrcode.Uuid   = Encoding.UTF8.GetString(Util.ReadProtoRawData(decryptedData, 1));
                    qrcode.Status = Util.ReadProtoInt(decryptedData, 2);
                    byte[] headUrl = Util.ReadProtoRawData(decryptedData, 5);

                    if (headUrl != null)
                    {
                        qrcode.HeadImgUrl = Encoding.UTF8.GetString(headUrl);

                        qrcode.Nickname = Encoding.UTF8.GetString(Util.ReadProtoRawData(decryptedData, 7));
                    }
                    qrcode.ExpiredTime = Util.ReadProtoInt(decryptedData, 8);
                    if (qrcode.Status == 2)
                    {
                        qrcode.Username = Encoding.UTF8.GetString(Util.ReadProtoRawData(decryptedData, 3));
                        qrcode.Password = Encoding.UTF8.GetString(Util.ReadProtoRawData(decryptedData, 4));
                        EventCenter.postEvent(EventConst.ON_LOGIN_CHECKQRCODE, qrcode, null);
                        return;
                    }



                    EventCenter.postEvent(EventConst.ON_LOGIN_CHECKQRCODE, qrcode, null);
                    Thread.Sleep(1500);

                    new NetSceneCheckLoginQRCode().doScene(Encoding.UTF8.GetString(Util.ReadProtoRawData(decryptedData, 1)), pack.NotifyKey);
                }
            }
            else
            {
                Log.e("NetSceneCheckLoginQRCode", "NetSceneCheckLoginQRCode failed. ");
            }
        }
Пример #8
0
        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. ");
            }
        }