示例#1
0
 public FriendDataOpPacket(QQClient client)
     : base(QQCommand.Friend_Data_OP_05,true,client)
 {
     SubCommand = FriendOpSubCmd.UPLOAD_FRIEND_REMARK;
     Remark = new FriendRemark();
 }
        protected override void ParseBody(ByteBuffer buf)
        {
            //操作字节
            SubCommand = (FriendOpSubCmd)buf.Get();
            switch (SubCommand)
            {
                case FriendOpSubCmd.BATCH_DOWNLOAD_FRIEND_REMARK:
                    HasRemark = buf.Get() == 0x0;
                    Remarks = new Dictionary<uint, FriendRemark>();
                    while (buf.HasRemaining())
                    {
                        uint qq = buf.GetUInt();
                        // 跳过一个未知字节0x0
                        buf.Get();
                        // 创建备注对象
                        FriendRemark r = new FriendRemark();
                        // 读入备注对象
                        r.Read(buf);
                        // 加入到哈希表
                        Remarks.Add(qq, r);
                    }
                    break;
                case FriendOpSubCmd.UPLOAD_FRIEND_REMARK:
                    break;
                case FriendOpSubCmd.REMOVE_FRIEND_FROM_LIST:
                    ReplyCode = (ReplyCode)buf.Get();
                    break;
                case FriendOpSubCmd.DOWNLOAD_FRIEND_REMARK:
                    if (buf.HasRemaining())
                    {
                        // 读取操作对象的QQ号
                        QQ = buf.GetInt();
                        // 创建备注对象
                        Remark = new FriendRemark();
                        // 跳过一个未知字节0x0
                        buf.Get();
                        // 读入备注对象
                        Remark.Read(buf);

                        HasRemark = true;
                    }
                    else
                        HasRemark = false;
                    break;
                default:
                    break;
            }
        }