Exemplo n.º 1
0
        public T GetPacket <T>()
        {
            int num    = 0;
            T   result = (T)((object)ReceivePakcet.DeserializePacket(this.m_btBuffer, this.m_nStartIndex + this.m_nTotalReadByte, out num, typeof(T)));

            this.m_nTotalReadByte += num;
            return(result);
        }
Exemplo n.º 2
0
        protected override int ReceiveBuffer(byte[] btBuffer, int index, int totalSize)
        {
            int          num = 0;
            PacketHeader packetHeader;
            int          num2;
            int          num3;

            while (true)
            {
                packetHeader = (PacketHeader)ReceivePakcet.DeserializePacket(btBuffer, index, out num, typeof(PacketHeader));
                if (index + (int)packetHeader.size + num > totalSize)
                {
                    break;
                }
                index += num;
                num2   = BaseNet_Login.Receive_GamePacket(btBuffer, index, packetHeader);
                if ((int)packetHeader.size != num2)
                {
                    goto Block_2;
                }
                num3 = totalSize - (num2 + index);
                if (num2 + index >= totalSize)
                {
                    goto Block_3;
                }
                index += num2;
            }
            return(index);

Block_2:
            Debug.LogWarning(string.Concat(new object[]
            {
                "Err :Receive_GamePacket Not Match  : ",
                packetHeader.type,
                "Detail-SizeInfo:",
                packetHeader.size,
                " != ",
                num2
            }));
            num2 = (int)packetHeader.size;
            return(index);

Block_3:
            if (num3 != 0)
            {
                Debug.Log("Packet End Remain:" + num3);
            }
            index += num2;
            return(index);
        }
Exemplo n.º 3
0
        protected override int ReceiveBuffer(byte[] btBuffer, int index, int totalSize)
        {
            int num  = 0;
            int num2 = 0;
            int num3;
            int num4;

            while (true)
            {
                num2++;
                PacketHeader packetHeader = (PacketHeader)ReceivePakcet.DeserializePacket(btBuffer, index, out num, typeof(PacketHeader));
                if (index + (int)packetHeader.size + num > totalSize)
                {
                    break;
                }
                int index2 = index;
                index += num;
                num3   = NrReceiveGame.Receive_GamePacket(btBuffer, index, packetHeader);
                if (this.m_bSavePacket && packetHeader.type >= 200 && packetHeader.type <= 267)
                {
                    NrTSingleton <NkBattleReplayManager> .Instance.SavePacket(btBuffer, packetHeader.type, index2, num3 + num);
                }
                if (packetHeader.type == 203 && this.m_bSavePacket)
                {
                    this.m_bSavePacket = false;
                    NrTSingleton <NkBattleReplayManager> .Instance.Savefile();
                }
                if ((int)packetHeader.size != num3)
                {
                    Debug.LogException(new Exception(string.Concat(new object[]
                    {
                        "Err: PrevePackType: Watch Out Protocol ID:",
                        ((eGAME_PACKET_ID)this.mPrevPackType).ToString(),
                        ":Total:",
                        totalSize
                    })));
                    Debug.LogException(new Exception(string.Concat(new object[]
                    {
                        "Err :Receive_GamePacket Not Match=(Type:",
                        ((eGAME_PACKET_ID)packetHeader.type).ToString(),
                        ",Size:",
                        packetHeader.size,
                        " != ",
                        num3,
                        ")I:",
                        index
                    })));
                    num3 = (int)packetHeader.size;
                    if (0 > packetHeader.size)
                    {
                        goto Block_8;
                    }
                }
                this.mPrevPackType = packetHeader.type;
                num4 = totalSize - (num3 + index);
                if (num3 + index >= totalSize)
                {
                    goto Block_9;
                }
                index += num3;
            }
            return(index);

Block_8:
            Debug.LogWarning("Packet:ErrorSkip");
            return(index);

Block_9:
            if (num4 != 0)
            {
                Debug.Log("Packet End Remain:" + num4);
            }
            index += num3;
            return(index);
        }