GetBody() public method

获取消息包体内容 - 包身
public GetBody ( int &nBodySize ) : Byte[]
nBodySize int
return Byte[]
        //-------------------------------------------------------------------------
        /// <summary>
        /// 解包处理
        /// </summary>
        /// <param name="client"></param>
        /// <param name="packet"></param>
        public void OnRecvMessage(SocketNetPacket packet)
        {
            if (m_MessageHandlers.ContainsKey((int)packet.GetMessageID()))
            {
                if (m_OnRecvMsgCallBack != null)
                {
                    m_OnRecvMsgCallBack(packet);
                }

                List <NetOnRecvMessageDelegate> handlerList = null;
                m_MessageHandlers.TryGetValue((int)packet.GetMessageID(), out handlerList);

                if (handlerList != null)
                {
                    List <NetOnRecvMessageDelegate> deletes = new List <NetOnRecvMessageDelegate>();
                    List <NetOnRecvMessageDelegate> exeList = new List <NetOnRecvMessageDelegate>(handlerList);
                    foreach (NetOnRecvMessageDelegate del in exeList)
                    {
                        if (del != null)
                        {
                            if (del.Target != null && del.Target.ToString() != SNetCommon.NULL)
                            {
                                int    nSize      = 0;
                                Byte[] pBuffer    = packet.GetBody(out nSize);
                                int    nMessageID = packet.GetMessageID();
                                del(nMessageID, pBuffer, nSize);
                            }
                            else
                            {
                                deletes.Add(del);
                            }
                        }
                    }

                    foreach (NetOnRecvMessageDelegate i in deletes)
                    {
                        handlerList.Remove(i);
                    }
                }
            }
        }
        //-------------------------------------------------------------------------
        /// <summary>
        /// 解包处理
        /// </summary>
        /// <param name="client"></param>
        /// <param name="packet"></param>
        public void OnRecvMessage(SocketNetPacket packet)
        {
            if (m_MessageHandlers.ContainsKey((int)packet.GetMessageID()))
            {
                if (m_OnRecvMsgCallBack != null)
                {
                    m_OnRecvMsgCallBack(packet);
                }

                List<NetOnRecvMessageDelegate> handlerList = null;
                m_MessageHandlers.TryGetValue((int)packet.GetMessageID(), out handlerList);

                if (handlerList != null)
                {
                    List<NetOnRecvMessageDelegate> deletes = new List<NetOnRecvMessageDelegate>();
                    List<NetOnRecvMessageDelegate> exeList = new List<NetOnRecvMessageDelegate>(handlerList);
                    foreach (NetOnRecvMessageDelegate del in exeList)
                    {
                        if (del != null)
                        {
                            if (del.Target != null && del.Target.ToString() != SNetCommon.NULL)
                            {
                                int nSize = 0;
                                Byte[] pBuffer = packet.GetBody(out nSize);
                                int nMessageID = packet.GetMessageID();
                                del(nMessageID, pBuffer, nSize);
                            }
                            else
                            {
                                deletes.Add(del);
                            }
                        }
                    }

                    foreach (NetOnRecvMessageDelegate i in deletes)
                    {
                        handlerList.Remove(i);
                    }
                }
            }
        }