Exemplo n.º 1
0
 private void ParseVideoPackage()
 {
     while (this._buffRecvSize > 0u)
     {
         int   num   = 0;
         CSPkg cSPkg = CSPkg.New();
         if (cSPkg.unpack(ref this._recvBuff, (int)this._buffRecvSize, ref num, 0u) != null || num <= 0 || num > (int)this._buffRecvSize)
         {
             break;
         }
         if (cSPkg.stPkgHead.dwMsgID == 1035u)
         {
             SCPKG_FRAPBOOTINFO stFrapBootInfo = cSPkg.stPkgData.get_stFrapBootInfo();
             for (int i = 0; i < (int)stFrapBootInfo.bSpareNum; i++)
             {
                 SCPKG_FRAPBOOT_SINGLE sCPKG_FRAPBOOT_SINGLE = stFrapBootInfo.astSpareFrap[i];
                 CSDT_FRAPBOOT_INFO    cSDT_FRAPBOOT_INFO    = CSDT_FRAPBOOT_INFO.New();
                 int num2 = 0;
                 if (cSDT_FRAPBOOT_INFO.unpack(ref sCPKG_FRAPBOOT_SINGLE.szInfoBuff, (int)sCPKG_FRAPBOOT_SINGLE.wLen, ref num2, 0u) == null && num2 > 0)
                 {
                     this._maxFrameNo = cSDT_FRAPBOOT_INFO.dwKFrapsNo;
                     this._pkgQueue.Enqueue(cSDT_FRAPBOOT_INFO);
                 }
             }
         }
         else
         {
             this._pkgQueue.Enqueue(cSPkg);
         }
         this._buffRecvSize -= (uint)num;
         Buffer.BlockCopy(this._recvBuff, num, this._recvBuff, 0, (int)this._buffRecvSize);
     }
 }
        public CSPkg RecvPackage()
        {
            byte[] array;
            int    size;

            if (this.connected && this.connector != null && this.connector.ReadData(out array, out size) == ApolloResult.Success)
            {
                int   num   = 0;
                CSPkg cSPkg = CSPkg.New();
                TdrError.ErrorType errorType = cSPkg.unpack(ref array, size, ref num, 0u);
                if (errorType == TdrError.ErrorType.TDR_NO_ERROR && num > 0)
                {
                    if (cSPkg.stPkgHead.dwMsgID == 1014u)
                    {
                        this.curSvrPkgSeq = 0u;
                    }
                    if (cSPkg.stPkgHead.dwSvrPkgSeq > this.curSvrPkgSeq || cSPkg.stPkgHead.dwSvrPkgSeq == 0u)
                    {
                        if (cSPkg.stPkgHead.dwSvrPkgSeq > this.curSvrPkgSeq && cSPkg.stPkgHead.dwMsgID != 1040u)
                        {
                            this.curSvrPkgSeq = cSPkg.stPkgHead.dwSvrPkgSeq;
                        }
                        return(cSPkg);
                    }
                }
                else
                {
                    DebugHelper.Assert(false, "TDR Unpack lobbyMsg Error -- {0}", new object[]
                    {
                        errorType
                    });
                }
            }
            return(null);
        }
Exemplo n.º 3
0
        public CSPkg RecvPackage()
        {
            byte[] buffer;
            int    num;

            if ((base.connected && (base.connector != null)) && (base.connector.ReadData(out buffer, out num) == ApolloResult.Success))
            {
                int   usedSize          = 0;
                CSPkg pkg               = CSPkg.New();
                TdrError.ErrorType type = pkg.unpack(ref buffer, num, ref usedSize, 0);
                if ((type == TdrError.ErrorType.TDR_NO_ERROR) && (usedSize > 0))
                {
                    if (pkg.stPkgHead.dwMsgID == 0x3f6)
                    {
                        this.curSvrPkgSeq = 0;
                    }
                    if (pkg.stPkgHead.dwSvrPkgSeq > this.curSvrPkgSeq)
                    {
                        if (pkg.stPkgHead.dwMsgID != 0x410)
                        {
                            this.curSvrPkgSeq = pkg.stPkgHead.dwSvrPkgSeq;
                        }
                        return(pkg);
                    }
                }
                else
                {
                    object[] inParameters = new object[] { type };
                    DebugHelper.Assert(false, "TDR Unpack lobbyMsg Error -- {0}", inParameters);
                }
            }
            return(null);
        }
Exemplo n.º 4
0
 private void ParseVideoPackage()
 {
     while (this._buffRecvSize > 0)
     {
         int   usedSize = 0;
         CSPkg item     = CSPkg.New();
         if (((item.unpack(ref this._recvBuff, (int)this._buffRecvSize, ref usedSize, 0) != TdrError.ErrorType.TDR_NO_ERROR) || (usedSize <= 0)) || (usedSize > this._buffRecvSize))
         {
             break;
         }
         if (item.stPkgHead.dwMsgID == 0x40b)
         {
             SCPKG_FRAPBOOTINFO stFrapBootInfo = item.stPkgData.stFrapBootInfo;
             for (int i = 0; i < stFrapBootInfo.bSpareNum; i++)
             {
                 SCPKG_FRAPBOOT_SINGLE scpkg_frapboot_single = stFrapBootInfo.astSpareFrap[i];
                 CSDT_FRAPBOOT_INFO    csdt_frapboot_info    = CSDT_FRAPBOOT_INFO.New();
                 int num3 = 0;
                 if ((csdt_frapboot_info.unpack(ref scpkg_frapboot_single.szInfoBuff, scpkg_frapboot_single.wLen, ref num3, 0) == TdrError.ErrorType.TDR_NO_ERROR) && (num3 > 0))
                 {
                     this._maxFrameNo = csdt_frapboot_info.dwKFrapsNo;
                     this._pkgQueue.Enqueue(csdt_frapboot_info);
                 }
             }
         }
         else
         {
             this._pkgQueue.Enqueue(item);
         }
         this._buffRecvSize -= (uint)usedSize;
         Buffer.BlockCopy(this._recvBuff, usedSize, this._recvBuff, 0, (int)this._buffRecvSize);
     }
 }
Exemplo n.º 5
0
        public CSPkg RecvPackage()
        {
            byte[] array;
            int    num;

            if (this.connected && this.connector != null && this.connector.ReadData(ref array, ref num) == null)
            {
                int   num2  = 0;
                CSPkg cSPkg = CSPkg.New();
                TdrError.ErrorType errorType = cSPkg.unpack(ref array, num, ref num2, 0u);
                if (errorType == null && num2 > 0)
                {
                    if (cSPkg.stPkgHead.dwMsgID == 1014u)
                    {
                        this.curSvrPkgSeq = 0u;
                    }
                    if (cSPkg.stPkgHead.dwSvrPkgSeq > this.curSvrPkgSeq || cSPkg.stPkgHead.dwSvrPkgSeq == 0u)
                    {
                        if (cSPkg.stPkgHead.dwSvrPkgSeq > this.curSvrPkgSeq && cSPkg.stPkgHead.dwMsgID != 1040u)
                        {
                            this.curSvrPkgSeq = cSPkg.stPkgHead.dwSvrPkgSeq;
                        }
                        return(cSPkg);
                    }
                }
                else
                {
                    DebugHelper.Assert(false, "TDR Unpack lobbyMsg Error -- {0}", new object[]
                    {
                        errorType
                    });
                }
            }
            return(null);
        }
Exemplo n.º 6
0
        public static CSPkg CreateDefaultCSPKG(uint msgID)
        {
            CSPkg pkg = CSPkg.New();

            pkg.stPkgHead.dwMsgID  = msgID;
            pkg.stPkgHead.iVersion = MetaLib.getVersion();
            pkg.stPkgData.construct((long)msgID);
            return(pkg);
        }
Exemplo n.º 7
0
 public CSPkg RecvPackage()
 {
     if (base.connected && (base.connector != null))
     {
         byte[] buffer;
         int    num;
         if (base.connector.ReadUdpData(out buffer, out num) == ApolloResult.Success)
         {
             int   usedSize          = 0;
             CSPkg pkg               = CSPkg.New();
             TdrError.ErrorType type = pkg.unpack(ref buffer, num, ref usedSize, 0);
             if ((type == TdrError.ErrorType.TDR_NO_ERROR) && (usedSize > 0))
             {
                 return(pkg);
             }
             object[] objArray1 = new object[] { "UnpackUdpError: BufLen:", num, " TdrError:", type, " nParseSize:", usedSize };
             this.ReportException(new UnpackError(string.Concat(objArray1)));
         }
         if (base.connector.ReadData(out buffer, out num) == ApolloResult.Success)
         {
             int   num3 = 0;
             CSPkg pkg2 = CSPkg.New();
             TdrError.ErrorType type2 = pkg2.unpack(ref buffer, num, ref num3, 0);
             if ((type2 == TdrError.ErrorType.TDR_NO_ERROR) && (num3 > 0))
             {
                 int index = 0;
                 while (index < this.confirmSendQueue.Count)
                 {
                     CSPkg pkg3 = this.confirmSendQueue[index];
                     if ((pkg3.stPkgHead.dwReserve > 0) && (pkg3.stPkgHead.dwReserve == pkg2.stPkgHead.dwMsgID))
                     {
                         pkg3.Release();
                         this.confirmSendQueue.RemoveAt(index);
                     }
                     else
                     {
                         index++;
                     }
                 }
                 return(pkg2);
             }
             object[] objArray2 = new object[] { "UnpackError: BufLen:", num, " TdrError:", type2, " nParseSize:", num3 };
             this.ReportException(new UnpackError(string.Concat(objArray2)));
         }
     }
     return(null);
 }
Exemplo n.º 8
0
 public CSPkg RecvPackage()
 {
     if (this.connected && this.connector != null)
     {
         byte[] array;
         int    num;
         if (this.connector.ReadUdpData(ref array, ref num) == null)
         {
             int   num2  = 0;
             CSPkg cSPkg = CSPkg.New();
             if (cSPkg.unpack(ref array, num, ref num2, 0u) == null && num2 > 0)
             {
                 return(cSPkg);
             }
         }
         if (this.connector.ReadData(ref array, ref num) == null)
         {
             int   num3   = 0;
             CSPkg cSPkg2 = CSPkg.New();
             if (cSPkg2.unpack(ref array, num, ref num3, 0u) == null && num3 > 0)
             {
                 int i = 0;
                 while (i < this.confirmSendQueue.get_Count())
                 {
                     CSPkg cSPkg3 = this.confirmSendQueue.get_Item(i);
                     if (cSPkg3.stPkgHead.dwReserve > 0u && cSPkg3.stPkgHead.dwReserve == cSPkg2.stPkgHead.dwMsgID)
                     {
                         cSPkg3.Release();
                         this.confirmSendQueue.RemoveAt(i);
                     }
                     else
                     {
                         i++;
                     }
                 }
                 return(cSPkg2);
             }
         }
     }
     return(null);
 }
 public CSPkg RecvPackage()
 {
     if (this.connected && this.connector != null)
     {
         byte[] array;
         int    size;
         if (this.connector.ReadUdpData(out array, out size) == ApolloResult.Success)
         {
             int   num   = 0;
             CSPkg cSPkg = CSPkg.New();
             if (cSPkg.unpack(ref array, size, ref num, 0u) == TdrError.ErrorType.TDR_NO_ERROR && num > 0)
             {
                 return(cSPkg);
             }
         }
         if (this.connector.ReadData(out array, out size) == ApolloResult.Success)
         {
             int   num2   = 0;
             CSPkg cSPkg2 = CSPkg.New();
             if (cSPkg2.unpack(ref array, size, ref num2, 0u) == TdrError.ErrorType.TDR_NO_ERROR && num2 > 0)
             {
                 int i = 0;
                 while (i < this.confirmSendQueue.get_Count())
                 {
                     CSPkg cSPkg3 = this.confirmSendQueue.get_Item(i);
                     if (cSPkg3.stPkgHead.dwReserve > 0u && cSPkg3.stPkgHead.dwReserve == cSPkg2.stPkgHead.dwMsgID)
                     {
                         cSPkg3.Release();
                         this.confirmSendQueue.RemoveAt(i);
                     }
                     else
                     {
                         i++;
                     }
                 }
                 return(cSPkg2);
             }
         }
     }
     return(null);
 }
Exemplo n.º 10
0
 public CSPkg RecvPackage()
 {
     if (base.connected && (base.connector != null))
     {
         byte[] buffer;
         int    num;
         if (base.connector.ReadUdpData(out buffer, out num) == ApolloResult.Success)
         {
             int   usedSize = 0;
             CSPkg pkg      = CSPkg.New();
             if ((pkg.unpack(ref buffer, num, ref usedSize, 0) == TdrError.ErrorType.TDR_NO_ERROR) && (usedSize > 0))
             {
                 return(pkg);
             }
         }
         if (base.connector.ReadData(out buffer, out num) == ApolloResult.Success)
         {
             int   num3 = 0;
             CSPkg pkg2 = CSPkg.New();
             if ((pkg2.unpack(ref buffer, num, ref num3, 0) == TdrError.ErrorType.TDR_NO_ERROR) && (num3 > 0))
             {
                 int index = 0;
                 while (index < this.confirmSendQueue.Count)
                 {
                     CSPkg pkg3 = this.confirmSendQueue[index];
                     if ((pkg3.stPkgHead.dwReserve > 0) && (pkg3.stPkgHead.dwReserve == pkg2.stPkgHead.dwMsgID))
                     {
                         pkg3.Release();
                         this.confirmSendQueue.RemoveAt(index);
                     }
                     else
                     {
                         index++;
                     }
                 }
                 return(pkg2);
             }
         }
     }
     return(null);
 }
Exemplo n.º 11
0
 private void ParseFramesData()
 {
     try
     {
         while (this.nRecvByteSize > 0)
         {
             int   usedSize = 0;
             CSPkg msg      = CSPkg.New();
             if ((msg.unpack(ref this.szRecvBuffer, this.nRecvByteSize, ref usedSize, 0) != TdrError.ErrorType.TDR_NO_ERROR) || (usedSize <= 0))
             {
                 return;
             }
             Buffer.BlockCopy(this.szRecvBuffer, usedSize, this.szRecvBuffer, 0, this.nRecvByteSize - usedSize);
             this.nRecvByteSize -= usedSize;
             this.AddCachePkg(msg);
         }
     }
     catch (Exception exception)
     {
         BugLocateLogSys.Log("ParseFramesCacheData " + exception.Message);
     }
 }
Exemplo n.º 12
0
 private bool LoadMsg(out CSPkg replayMsg, out CSDT_FRAPBOOT_INFO fraqBoot)
 {
     replayMsg = null;
     fraqBoot  = null;
     try
     {
         if (this.isReplayAbc)
         {
             if ((this.replayStream == null) || (this.replayStream.Position >= this.replayStream.Length))
             {
                 return(false);
             }
             short num  = this.replayReader.ReadInt16();
             bool  flag = num > 0;
             num = Math.Abs(num);
             if ((this.replayStream.Position + num) > this.replayStream.Length)
             {
                 return(false);
             }
             if (this.replayReader.Read(this.streamBuffer, 0, num) != num)
             {
                 return(false);
             }
             int usedSize = 0;
             if (flag)
             {
                 fraqBoot = CSDT_FRAPBOOT_INFO.New();
                 if (fraqBoot.unpack(ref this.streamBuffer, num, ref usedSize, 0) != TdrError.ErrorType.TDR_NO_ERROR)
                 {
                     return(false);
                 }
             }
             else
             {
                 replayMsg = CSPkg.New();
                 if (replayMsg.unpack(ref this.streamBuffer, num, ref usedSize, 0) != TdrError.ErrorType.TDR_NO_ERROR)
                 {
                     return(false);
                 }
             }
         }
         else
         {
             if ((this.bufferUsedSize > 0) || ((this.replayStream != null) && (this.replayStream.Position < this.replayStream.Length)))
             {
                 if ((this.replayStream != null) && (this.replayStream.Position < this.replayStream.Length))
                 {
                     this.bufferUsedSize += this.replayReader.Read(this.streamBuffer, this.bufferUsedSize, this.streamBuffer.Length - this.bufferUsedSize);
                 }
                 replayMsg = CSPkg.New();
                 int num4 = 0;
                 if (((replayMsg.unpack(ref this.streamBuffer, this.bufferUsedSize, ref num4, 0) == TdrError.ErrorType.TDR_NO_ERROR) && (0 < num4)) && (num4 <= this.bufferUsedSize))
                 {
                     this.bufferUsedSize -= num4;
                     Buffer.BlockCopy(this.streamBuffer, num4, this.streamBuffer, 0, this.bufferUsedSize);
                     return(true);
                 }
             }
             return(false);
         }
     }
     catch
     {
         return(false);
     }
     if (this.replayStream.Position >= this.replayStream.Length)
     {
         this.ClearReplay();
     }
     return(true);
 }
        private bool LoadMsg(out CSPkg replayMsg, out CSDT_FRAPBOOT_INFO fraqBoot)
        {
            replayMsg = null;
            fraqBoot  = null;
            try
            {
                if (this.isReplayAbc)
                {
                    if (this.replayStream == null || this.replayStream.get_Position() >= this.replayStream.get_Length())
                    {
                        bool flag   = false;
                        bool result = flag;
                        return(result);
                    }
                    short num   = this.replayReader.ReadInt16();
                    bool  flag2 = num > 0;
                    num = Math.Abs(num);
                    if (this.replayStream.get_Position() + (long)num > this.replayStream.get_Length())
                    {
                        bool flag3  = false;
                        bool result = flag3;
                        return(result);
                    }
                    int num2 = this.replayReader.Read(this.streamBuffer, 0, (int)num);
                    if (num2 != (int)num)
                    {
                        bool flag4  = false;
                        bool result = flag4;
                        return(result);
                    }
                    int num3 = 0;
                    if (flag2)
                    {
                        fraqBoot = CSDT_FRAPBOOT_INFO.New();
                        if (fraqBoot.unpack(ref this.streamBuffer, (int)num, ref num3, 0u) != TdrError.ErrorType.TDR_NO_ERROR)
                        {
                            bool flag5  = false;
                            bool result = flag5;
                            return(result);
                        }
                    }
                    else
                    {
                        replayMsg = CSPkg.New();
                        if (replayMsg.unpack(ref this.streamBuffer, (int)num, ref num3, 0u) != TdrError.ErrorType.TDR_NO_ERROR)
                        {
                            bool flag6  = false;
                            bool result = flag6;
                            return(result);
                        }
                    }
                }
                else
                {
                    bool result;
                    bool flag7;
                    if (this.bufferUsedSize <= 0 && (this.replayStream == null || this.replayStream.get_Position() >= this.replayStream.get_Length()))
                    {
                        flag7  = false;
                        result = flag7;
                        return(result);
                    }
                    if (this.replayStream != null && this.replayStream.get_Position() < this.replayStream.get_Length())
                    {
                        this.bufferUsedSize += this.replayReader.Read(this.streamBuffer, this.bufferUsedSize, this.streamBuffer.Length - this.bufferUsedSize);
                    }
                    replayMsg = CSPkg.New();
                    int num4 = 0;
                    if (replayMsg.unpack(ref this.streamBuffer, this.bufferUsedSize, ref num4, 0u) == TdrError.ErrorType.TDR_NO_ERROR && 0 < num4 && num4 <= this.bufferUsedSize)
                    {
                        this.bufferUsedSize -= num4;
                        Buffer.BlockCopy(this.streamBuffer, num4, this.streamBuffer, 0, this.bufferUsedSize);
                        flag7  = true;
                        result = flag7;
                        return(result);
                    }
                    Singleton <CUIManager> .GetInstance().OpenTips(Singleton <CTextManager> .GetInstance().GetText("Download_VersionNotMatch"), false, 1.5f, null, new object[0]);

                    flag7  = false;
                    result = flag7;
                    return(result);
                }
            }
            catch
            {
                Singleton <CUIManager> .GetInstance().OpenTips(Singleton <CTextManager> .GetInstance().GetText("Download_VersionNotMatch"), false, 1.5f, null, new object[0]);

                bool flag8  = false;
                bool result = flag8;
                return(result);
            }
            if (this.replayStream.get_Position() >= this.replayStream.get_Length())
            {
                this.ClearReplay();
            }
            return(true);
        }
Exemplo n.º 14
0
 private bool LoadMsg(out CSPkg replayMsg, out CSDT_FRAPBOOT_INFO fraqBoot)
 {
     replayMsg = null;
     fraqBoot  = null;
     try
     {
         if (this.isReplayAbc)
         {
             if (this.replayStream == null || this.replayStream.get_Position() >= this.replayStream.get_Length())
             {
                 bool result = false;
                 return(result);
             }
             short num  = this.replayReader.ReadInt16();
             bool  flag = num > 0;
             num = Math.Abs(num);
             if (this.replayStream.get_Position() + (long)num > this.replayStream.get_Length())
             {
                 bool result = false;
                 return(result);
             }
             int num2 = this.replayReader.Read(this.streamBuffer, 0, (int)num);
             if (num2 != (int)num)
             {
                 bool result = false;
                 return(result);
             }
             int num3 = 0;
             if (flag)
             {
                 fraqBoot = CSDT_FRAPBOOT_INFO.New();
                 if (fraqBoot.unpack(ref this.streamBuffer, (int)num, ref num3, 0u) != null)
                 {
                     bool result = false;
                     return(result);
                 }
             }
             else
             {
                 replayMsg = CSPkg.New();
                 if (replayMsg.unpack(ref this.streamBuffer, (int)num, ref num3, 0u) != null)
                 {
                     bool result = false;
                     return(result);
                 }
             }
         }
         else
         {
             bool result;
             if (this.bufferUsedSize <= 0 && (this.replayStream == null || this.replayStream.get_Position() >= this.replayStream.get_Length()))
             {
                 result = false;
                 return(result);
             }
             if (this.replayStream != null && this.replayStream.get_Position() < this.replayStream.get_Length())
             {
                 this.bufferUsedSize += this.replayReader.Read(this.streamBuffer, this.bufferUsedSize, this.streamBuffer.Length - this.bufferUsedSize);
             }
             replayMsg = CSPkg.New();
             int num4 = 0;
             if (replayMsg.unpack(ref this.streamBuffer, this.bufferUsedSize, ref num4, 0u) == null && 0 < num4 && num4 <= this.bufferUsedSize)
             {
                 this.bufferUsedSize -= num4;
                 Buffer.BlockCopy(this.streamBuffer, num4, this.streamBuffer, 0, this.bufferUsedSize);
                 result = true;
                 return(result);
             }
             result = false;
             return(result);
         }
     }
     catch
     {
         bool result = false;
         return(result);
     }
     if (this.replayStream.get_Position() >= this.replayStream.get_Length())
     {
         this.ClearReplay();
     }
     return(true);
 }