Ejemplo n.º 1
0
 /// <summary>解析普通消息
 ///     <remark>abu 2008-02-26 </remark>
 /// </summary>
 /// <param name="buf">The buf.</param>
 private void ParseNormalIM(ByteBuffer buf)
 {
     // 读入普通消息头
     NormalHeader = new NormalIMHeader();
     NormalHeader.Read(buf);
     // 判断普通消息类型
     if (NormalHeader.Type == NormalIMType.TEXT)
     {
         NormalIM = new NormalIM();
         NormalIM.Read(buf);
     }
     else
     {
         if (NormalHeader.Type == NormalIMType.UDP_REQUEST || NormalHeader.Type == NormalIMType.TCP_REQUEST)
         {
             FileArgs = new FileTransferArgs();
             FileArgs.Read(buf);
             FileInfo = new FileInfo();
             FileInfo.Read(buf);
         }
         else
         {
             if (NormalHeader.Type == NormalIMType.ACCEPT_UDP_REQUEST || NormalHeader.Type == NormalIMType.NOTIFY_IP)
             {
                 FileArgs = new FileTransferArgs();
                 FileArgs.Read(buf);
             }
         }
     }
 }
Ejemplo n.º 2
0
        /// <summary>解析普通消息
        ///     <remark>abu 2008-02-26 </remark>
        /// </summary>
        /// <param name="buf">The buf.</param>
        private void ParseNormalIM(ByteBuffer buf)
        {
            // 读入普通消息头
            NormalHeader = new NormalIMHeader();
            NormalHeader.Read(buf);
            // 判断普通消息类型
            switch (NormalHeader.Type)
            {
            case NormalIMType.TEXT:
                NormalIM = new NormalIM(Client);
                if (Header.Type == RecvSource.FRIEND_09 || Header.Type == RecvSource.FRIEND_09SP1)
                {
                    NormalIM.Read09(buf);
                }
                else
                {
                    NormalIM.Read(buf);
                }
                break;

            case NormalIMType.UDP_REQUEST:
            case NormalIMType.TCP_REQUEST:
                FileArgs = new FileTransferArgs();
                FileArgs.Read(buf);
                FileInfo = new FileInfo();
                FileInfo.Read(buf);
                break;

            case NormalIMType.ACCEPT_UDP_REQUEST:
            case NormalIMType.NOTIFY_IP:
                FileArgs = new FileTransferArgs();
                FileArgs.Read(buf);
                break;

            case NormalIMType.Vibration:

                Vibration = new Vibration();
                Vibration.Read(buf);
                break;

            default:
                Client.LogManager.Log(ToString() + " UnKnow NormalIMType:" + NormalHeader.Type.ToString() + "=0x" + NormalHeader.Type.ToString("X"));
                break;
            }
        }