Exemplo n.º 1
0
 public void Read(ByteBuffer buf)
 {
     //振动 00 00 00 01 00 09 41 A1 34 00 00 00 00
        //输入 00 00 00 01
        buf.GetInt();// 00 00 00 01
        if (buf.HasRemaining())
        {
        //long l=buf.GetLong();
        buf.Get();//0
      int qq=  buf.GetInt(); //QQ号码
        buf.GetByteArray(3);//未知 00 00 00
      //byte[] data=  buf.GetByteArray(8);
      //byte[] comparedata = new byte[] { 0x00, 0x09, 0x41, 0xA1, 0x34, 0x00, 0x00, 0x00 };
      //long l = BitConverter.ToInt64(data, 0);
      //long l2 = BitConverter.ToInt64(comparedata, 0);
      //  if (l == l2)
      //  {
            IsShake = true;
        //}
        }
        else
        {
        IsInputState = true;
        }
 }
Exemplo n.º 2
0
        public void Read( ByteBuffer buf)
        {
            while (buf.HasRemaining())
               {
               byte type = buf.Get();
               int len = buf.GetUShort();
               switch (type)
               {
                   case 0x01:
                       FaceId = buf.Get();
                       break;
                   case 0xff:
                       FFData = buf.GetByteArray(len);
                       break;
                   default:
                       QQClient.LogManager.Log(base.ToString()+" Parse Error,Unknown Type=" + type.ToString("X") + ": Data=" + Utils.Util.ToHex(buf.GetByteArray(len)));
                       break;

               }
               }
               if (buf.HasRemaining())
               {
               RemainBytes = buf.GetByteArray(buf.Remaining());
               QQClient.LogManager.Log(base.ToString() + " Class Parse Buf Remaining Data:" + Utils.Util.ToHex(RemainBytes));
               }
        }
 protected override void ParseBody(ByteBuffer buf)
 {
     buf.Get();
     ReplyCode = (ReplyCode)buf.Get();
     buf.Get();
     Onlines = new List<uint>();
     while (buf.HasRemaining())
         Onlines.Add(buf.GetUInt());
 }
 protected override void ParseBody(ByteBuffer buf)
 {
     SubCommand = buf.Get();
     FriendLevels = new List<FriendLevel>();
     while (buf.HasRemaining())
     {
         FriendLevel friendLevel = new FriendLevel();
         friendLevel.Read(buf);
         FriendLevels.Add(friendLevel);
     }
 }
Exemplo n.º 5
0
 public void Read(ByteBuffer buf)
 {
     buf.Get();//0x01
        int len=buf.GetUShort();
        Text = Utils.Util.GetString(buf.GetByteArray(len));
        if (buf.HasRemaining())
        {
        RemainBytes = buf.GetByteArray(buf.Remaining());
        QQClient.LogManager.Log("NormalIMText Class Parse Buf Remaining Data:" + Utils.Util.ToHex(RemainBytes));
        }
 }
Exemplo n.º 6
0
        protected override void ParseBody(ByteBuffer buf)
        {
            // 判断搜索是否已经结束
            if (!buf.HasRemaining() || buf.Get() == 0x2D && buf.Get() == 0x31)
            {
                Finished = true;
                return;
            }
            buf.Rewind();
            // 只要还有数据就继续读取下一个friend结构
            Users = new List<UserInfo>();
            while (buf.HasRemaining())
            {
                UserInfo ui = new UserInfo();
                ui.Read(buf);

                // 添加到list
                Users.Add(ui);
            }
        }
 /// <summary>
 /// 解析更新组织架构回复包
 /// 	<remark>abu 2008-02-22 </remark>
 /// </summary>
 /// <param name="buf">The buf.</param>
 private void ParseUpdateOrganization(ByteBuffer buf)
 {
     if (ReplyCode == ReplyCode.OK)
     {
         Organizations = new List<QQOrganization>();
         ClusterId = buf.GetUInt();
         buf.Get();
         OrganizationVersionId = buf.GetUInt();
         if (OrganizationVersionId != 0)
         {
             OrganizationCount = (uint)buf.Get();
             while (buf.HasRemaining())
             {
                 QQOrganization org = new QQOrganization();
                 org.Read(buf);
                 Organizations.Add(org);
             }
         }
     }
 }
 /// <summary>
 /// 解析子群操作回复包
 /// 	<remark>abu 2008-02-22 </remark>
 /// </summary>
 /// <param name="buf">The buf.</param>
 private void ParseSubClusterOp(ByteBuffer buf)
 {
     if (ReplyCode == ReplyCode.OK)
     {
         SubClusterOpByte = buf.Get();
         ClusterId = buf.GetUInt();
         ExternalId = buf.GetUInt();
         SubClusters = new List<SimpleClusterInfo>();
         while (buf.HasRemaining())
         {
             SimpleClusterInfo s = new SimpleClusterInfo();
             s.Read(buf);
             SubClusters.Add(s);
         }
     }
 }
 /// <summary>处理搜索群的回复包
 /// 	<remark>abu 2008-02-22 </remark>
 /// </summary>
 /// <param name="buf">The buf.</param>
 private void ParseSearchReply(ByteBuffer buf)
 {
     if (ReplyCode == ReplyCode.OK)
     {
         SearchType = buf.Get();
         Clusters = new List<ClusterInfo>();
         while (buf.HasRemaining())
         {
             ClusterInfo ci = new ClusterInfo();
             ci.ReadClusterInfoFromSearchReply(buf);
             Clusters.Add(ci);
         }
     }
 }
 /// <summary>
 /// 处理得到在线成员的回复包
 /// 	<remark>abu 2008-02-22 </remark>
 /// </summary>
 /// <param name="buf">The buf.</param>
 private void ParseGetOnlineMemberReply(ByteBuffer buf)
 {
     if (ReplyCode == ReplyCode.OK)
     {
         // 内部ID
         ClusterId = buf.GetUInt();
         // 未知字节,0x3C
         buf.Get();
         // 成员信息
         OnlineMembers = new List<uint>();
         while (buf.HasRemaining())
             OnlineMembers.Add(buf.GetUInt());
     }
 }
Exemplo n.º 11
0
        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;
            }
        }
Exemplo n.º 12
0
        public string AnalyseMessage09(byte[] buffer)
        {
            ByteBuffer buf = new ByteBuffer(buffer);
            string Msg = "";
            while (buf.HasRemaining())
            {
                byte type = buf.Get();
                int len = buf.GetUShort();
                switch (type)
                {
                    case 0x01://pure text
                        //len_str = buf.GetUShort();
                        Msg += new NormalIMText(QQClient, buf.GetByteArray(len)).ToString();
                        break;
                    case 0x02://face
                        Msg += new NormalIMFace(QQClient, buf.GetByteArray(len)).ToString();
                        break;
                    case 0x06://image
                        Msg += new NormalIMImage(QQClient, buf.GetByteArray(len)).ToString();
                        break;
                    default:
                        QQClient.LogManager.Log(ToString() + " Class Parse Unknown Type=0x" + type.ToString("X") + " Data=" + Utils.Util.ToHex(buf.GetByteArray(len)));
                        break;

                }

            }
            return Msg;
        }
 /// <summary>
 /// 处理得到群信息的回复包
 /// 	<remark>abu 2008-02-22 </remark>
 /// </summary>
 /// <param name="buf">The buf.</param>
 private void ParseGetInfoReply(ByteBuffer buf)
 {
     if (ReplyCode == ReplyCode.OK)
     {
         // 群信息
         Info = new ClusterInfo();
         Info.ReadClusterInfo(buf);
         ClusterId = Info.ClusterId;
         ExternalId = Info.ExternalId;
         // 读取成员列表
         Members = new List<Member>();
         while (buf.HasRemaining())
         {
             Member member = new Member();
             member.Read(buf);
             Members.Add(member);
         }
     }
 }
Exemplo n.º 14
0
 protected override void ParseBody(ByteBuffer buf)
 {
     // 得到操作类型
     SubCommand = (GroupSubCmd)buf.Get();
     // 回复码
     ReplyCode = (ReplyCode)buf.Get();
     if (ReplyCode == ReplyCode.OK)
     {
         // 如果是下载包,继续解析内容
         if (SubCommand == GroupSubCmd.DOWNLOAD)
         {
             // 创建list
             GroupNames = new List<String>();
             // 未知4个字节
             buf.GetUInt();
             // 读取每个组名
             while (buf.HasRemaining())
             {
                 buf.Get();
                 GroupNames.Add(Utils.Util.GetString(buf, (byte)0x00, 16));
             }
         }
     }
 }
Exemplo n.º 15
0
 protected override void ParseBody(ByteBuffer buf)
 {
     #if DEBUG
     Client.LogManager.Log(ToString() + " " + Utils.Util.ToHex(buf.ToByteArray()));
     #endif
     // 当前好友列表位置
     Finished = buf.Get() == QQGlobal.QQ_POSITION_ONLINE_LIST_END;
     Position = 0;
     //只要还有数据就继续读取下一个friend结构
     OnlineFriends = new List<FriendStatus>();
     while (buf.HasRemaining())
     {
         //int QQ = buf.GetInt();
         FriendStatus entry =new FriendStatus();
         //if(Client.QQUser.Friends.Get(QQ)!=null)
         //    entry = Client.QQUser.Friends.Get(QQ).FriendStatus;//new FriendStatus();
         entry.Read(buf);
         // 添加到List
         OnlineFriends.Add(entry);
         // 如果还有更多好友,计算position
         if (!Finished)
             Position = Math.Max(Position, entry.QQ);
     }
     Position++;
 }
Exemplo n.º 16
0
 protected override void ParseBody(ByteBuffer buf)
 {
     SubCommand = (SignatureSubCmd)buf.Get();
     ReplyCode = (ReplyCode)buf.Get();
     if (SubCommand == SignatureSubCmd.GET)
     {
         NextQQ = buf.GetInt();
         Signatures = new List<Signature>();
         while (buf.HasRemaining())
         {
             Signature sig = new Signature();
             sig.Read(buf);
             Signatures.Add(sig);
         }
     }
 }
Exemplo n.º 17
0
 /// <summary>
 /// 从buf的当前位置解析出一个字符串,直到碰到一个分隔符为止,或者到了buf的结尾
 /// 此方法不负责调整buf位置,调用之前务必使buf当前位置处于字符串开头。在读取完成
 /// * 后,buf当前位置将位于分隔符之后
 /// </summary>
 /// <param name="buf">The buf.</param>
 /// <param name="delimit">The delimit.</param>
 /// <returns></returns>
 public static string GetString(ByteBuffer buf, byte delimit)
 {
     ByteBuffer temp = new ByteBuffer();
     while (buf.HasRemaining())
     {
         byte b = buf.Get();
         if (b == delimit)
             return GetString(temp.ToByteArray());
         else
             buf.Put(b);
     }
     return GetString(temp.ToByteArray());
 }
Exemplo n.º 18
0
 /// <summary>
 /// * 从buf的当前位置解析出一个字符串,直到碰到了delimit或者读取了maxLen个byte或者
 /// * 碰到结尾之后停止
 /// *此方法不负责调整buf位置,调用之前务必使buf当前位置处于字符串开头。在读取完成
 /// *后,buf当前位置将位于maxLen之后
 /// </summary>
 /// <param name="buf">The buf.</param>
 /// <param name="delimit">The delimit.</param>
 /// <param name="maxLen">The max len.</param>
 /// <returns></returns>
 public static String GetString(ByteBuffer buf, byte delimit, int maxLen)
 {
     ByteBuffer temp = new ByteBuffer();
     while (buf.HasRemaining() && maxLen-- > 0)
     {
         byte b = buf.Get();
         if (b == delimit)
             break;
         else
             temp.Put(b);
     }
     while (buf.HasRemaining() && maxLen-- > 0)
         buf.Get();
     return GetString(temp.ToByteArray());
 }
Exemplo n.º 19
0
 /// <summary>从buf的当前位置解析出一个字符串,直到碰到了buf的结尾或者读取了len个byte之后停止
 /// 此方法不负责调整buf位置,调用之前务必使buf当前位置处于字符串开头。在读取完成
 /// * 后,buf当前位置将位于len字节之后或者最后之后
 /// </summary>
 /// <param name="b">The b.</param>
 /// <returns></returns>
 public static string GetString(ByteBuffer buf, int len)
 {
     ByteBuffer temp = new ByteBuffer();
     while (buf.HasRemaining() && len-- > 0)
     {
         temp.Put(buf.Get());
     }
     return GetString(temp.ToByteArray());
 }
 /// <summary>
 /// 处理激活临时群回复包
 /// 	<remark>abu 2008-02-22 </remark>
 /// </summary>
 /// <param name="buf">The buf.</param>
 private void ParseActivateTempCluster(ByteBuffer buf)
 {
     if (ReplyCode == ReplyCode.OK)
     {
         // 临时群类型
         Type = (ClusterType)buf.Get();
         // 父群内部ID
         ParentClusterId = buf.GetUInt();
         // 临时群内部ID
         ClusterId = buf.GetUInt();
         // 成员信息
         Members = new List<Member>();
         while (buf.HasRemaining())
         {
             Member member = new Member();
             member.QQ = buf.GetUInt();
             Members.Add(member);
         }
     }
 }
 /// <summary>处理批量得到群名片真实姓名回复包
 /// 	<remark>abu 2008-02-22 </remark>
 /// </summary>
 /// <param name="buf">The buf.</param>
 private void ParseGetCardBatch(ByteBuffer buf)
 {
     if (ReplyCode == ReplyCode.OK)
     {
         ClusterId = buf.GetUInt();
         CardVersionId = buf.GetUInt();
         CardStubs = new List<CardStub>();
         NextStart = buf.GetUInt();
         while (buf.HasRemaining())
         {
             CardStub stub = new CardStub();
             stub.Read(buf);
             CardStubs.Add(stub);
         }
     }
 }
Exemplo n.º 22
0
		// end switch
		// end encode3to4
		/// <summary>
		/// Performs Base64 encoding on the <code>raw</code> ByteBuffer,
		/// writing it to the <code>encoded</code> ByteBuffer.
		/// </summary>
		/// <remarks>
		/// Performs Base64 encoding on the <code>raw</code> ByteBuffer,
		/// writing it to the <code>encoded</code> ByteBuffer.
		/// This is an experimental feature. Currently it does not
		/// pass along any options (such as
		/// <see cref="DoBreakLines">DoBreakLines</see>
		/// or
		/// <see cref="Gzip">Gzip</see>
		/// .
		/// </remarks>
		/// <param name="raw">input buffer</param>
		/// <param name="encoded">output buffer</param>
		/// <since>2.3</since>
		public static void Encode(ByteBuffer raw, ByteBuffer encoded)
		{
			byte[] raw3 = new byte[3];
			byte[] enc4 = new byte[4];
			while (raw.HasRemaining())
			{
				int rem = Math.Min(3, raw.Remaining());
				raw.Get(raw3, 0, rem);
				Couchbase.Lite.Support.Base64.Encode3to4(enc4, raw3, rem, Couchbase.Lite.Support.Base64
					.NoOptions);
				encoded.Put(enc4);
			}
		}
 /// <summary>
 /// 处理得到群成员信息的回复包
 /// 2010/2/22 Veonax 修改
 /// 	<remark>abu 2008-02-22 </remark>
 /// </summary>
 /// <param name="buf">The buf.</param>
 private void ParseGetMemberInfoReply(ByteBuffer buf)
 {
     if (ReplyCode == ReplyCode.OK)
     {
         ClusterId = buf.GetUInt();
         // 成员信息
         MemberInfos = new List<QQFriend>();
         while (buf.HasRemaining())
         {
             QQFriend friend = new QQFriend();
             friend.ReadFromCluster(buf); // 从群成员信息GetClusterMemberInfo包中读取相关信息
             MemberInfos.Add(friend);
         }
     }
 }
        /// <summary>
        /// 解析包体,从buf的开头位置解析起
        /// <remark>abu 2008-02-18 </remark>
        /// </summary>
        /// <param name="buf">The buf.</param>
        protected override void ParseBody(ByteBuffer buf)
        {
            #if DEBUG
            Client.LogManager.Log(ToString() + " " + Utils.Util.ToHex(buf.ToByteArray()));
            #endif
            // 操作字节,下载为0x1F
            SubCommand = buf.Get();
            if (SubCommand == 0x1F)
            {
                // 起始好友号
                BeginFrom = buf.GetUInt();
                if (BeginFrom == 0x1000000) //no group labels info ??
                {
                    return;

                }
                if (BeginFrom != 0x00)
                {
                    Client.LogManager.Log("BeginFrom==0x"+BeginFrom.ToString("X"));
                }
                buf.Get();//0x17
                buf.GetChar();

                // 循环读取各好友信息,加入到list中
                Groups = new List<Group>();
                while (buf.HasRemaining())
                {
                    Group g = new Group(buf);
                    Groups.Add(g);
                }

            }
        }
Exemplo n.º 25
0
 /// <summary>给定一个输入流,解析NormalIM结构
 /// </summary>
 /// <param name="buf">The buf.</param>
 public void Read(ByteBuffer buf)
 {
     FontStyle = new FontStyle();
     // 是否有字体属性
     HasFontAttribute = buf.GetInt() != 0;
     // 分片数
     TotalFragments = (int)buf.Get();
     // 分片序号
     FragmentSequence = (int)buf.Get();
     // 消息id 两个字节
     MessageId = (int)buf.GetUShort();
     // 消息类型,这里的类型表示是正常回复还是自动回复之类的信息
     ReplyType = (ReplyType)buf.Get();
     // 消息正文,长度=剩余字节数 - 包尾字体属性长度
     int remain = buf.Remaining();
     int fontAttributeLength = HasFontAttribute ? (buf.Get(buf.Position + remain - 1) & 0xFF) : 0;
     MessageBytes = buf.GetByteArray(remain - fontAttributeLength);
     // 这后面都是字体属性,这个和SendIMPacket里面的是一样的
     if (HasFontAttribute)
     {
         if (buf.HasRemaining())
             FontStyle.Read(buf);
         else
             HasFontAttribute = false;
     }
 }
Exemplo n.º 26
0
        public void Read(ByteBuffer buf)
        {
            while (buf.HasRemaining())
               {
               byte type = buf.Get();
               int len = buf.GetUShort();
               switch (type)
               {
                   case 0x02:
                       FileName = Utils.Util.GetString(buf.GetByteArray(len));
                       break;
                   case 0x03://filesize
                       FileSize =(int) Utils.Util.GetUInt(buf.GetByteArray(len), 0, 4); //buf.GetInt();
                       break;
                   case 0x04://guid
                       FGuid = Utils.Util.GetString(buf.GetByteArray(len));
                       break;
                   case 0xff:
                       FFData = buf.GetByteArray(len);
                       break;
                   default:
                       QQClient.LogManager.Log(base.ToString()+" Parse Error,Unknown Type=" + type.ToString("X") + ": Data=" + Utils.Util.ToHex(buf.GetByteArray(len)));
                       break;

               }
               }
               if (buf.HasRemaining())
               {
               RemainBytes = buf.GetByteArray(buf.Remaining());
               QQClient.LogManager.Log(base.ToString() + " Class Parse Buf Remaining Data:" + Utils.Util.ToHex(RemainBytes));
               }
        }
Exemplo n.º 27
0
        /// <summary>
        /// 解析包体,从buf的开头位置解析起
        /// <remark>abu 2008-02-18 </remark>
        /// </summary>
        /// <param name="buf">The buf.</param>
        protected override void ParseBody(ByteBuffer buf)
        {
            #if DEBUG
            Client.LogManager.Log(ToString() + " " + Utils.Util.ToHex(buf.ToByteArray()));
            #endif
            Empty = false;
            // 检查消息长度,至少要有16字节,因为我们需要前16字节做为确认发回
            if (buf.Remaining() < 16)
            {
                throw new PacketParseException("收到的消息太短,抛弃该消息");
            }
            // 得到前16个字节用作回复
            Reply = buf.GetByteArray(16);
            // 读取消息头
            buf.Position = 0;
            Header = new ReceiveIMHeader();
            Header.Read(buf);
            // 检查输入流可用字节
            if (!buf.HasRemaining())
            {
                Empty = true;
                return;
            }
            // 判断消息类型
            int len = 0;
            switch (Header.Type)
            {
                case RecvSource.FRIEND_0801: //手机消息
                    buf.Position += 10;//buf.GetInt();
                    ParseNormalIM(buf);
                    break;
                case RecvSource.FRIEND_0802:
                    ParseNormalIM(buf);
                    break;
                case RecvSource.FRIEND_09:
                    buf.Position += 11;
                    ParseNormalIM(buf);
                    break;
                case RecvSource.FRIEND_09SP1:
                    buf.Position += 2;
                    int len1 = buf.GetUShort();
                    buf.Position += len1;
                    ParseNormalIM(buf);
                    break;
                case RecvSource.STRANGER:
                    /* 是从好友或者陌生人处发来的消息 */
                    ParseNormalIM(buf);
                    break;

                case RecvSource.TEMP_SESSION:
                    TempSessionIM = new TempSessionIM();
                    TempSessionIM.Read(buf);
                    break;
                case RecvSource.SYS_MESSAGE:
                    /* 是系统消息 */
                    buf.GetInt();//00 00 00 00
                    ParseSystemMessage(buf);
                    break;
                case RecvSource.CLUSTER_09:
                    /* 群消息09 */
                    ParseClusterIM09(buf);
                    break;
                case RecvSource.CLUSTER:

                    /* 群消息 */
                    ParseClusterIM(buf);
                    break;
                case RecvSource.TEMP_CLUSTER:
                    /* 临时群消息 */
                    ParseTempClusterIM(buf);
                    break;
                case RecvSource.UNKNOWN_CLUSTER:
                    ParseUnknownClusterIM(buf);
                    break;
                case RecvSource.BIND_USER:
                    SMS = new SMS();
                    SMS.ReadBindUserSMS(buf);
                    break;
                case RecvSource.MOBILE_QQ:
                    SMS = new SMS();
                    SMS.ReadMobileQQSMS(buf);
                    break;
                case RecvSource.MOBILE_QQ_2 :
                    SMS = new SMS();
                    SMS.ReadMobileQQ2SMS(buf);
                    break;
                case RecvSource.MOBILE:
                    SMS = new SMS();
                    SMS.ReadMobileSMS(buf);
                    break;
                case RecvSource.CREATE_CLUSTER:
                case RecvSource.ADDED_TO_CLUSTER:
                case RecvSource.DELETED_FROM_CLUSTER:
                    ExternalId = buf.GetInt();
                    ClusterType = (ClusterType)buf.Get();
                    Sender = buf.GetInt();
                    break;
                case RecvSource.APPROVE_JOIN_CLUSTER:
                case RecvSource.REJECT_JOIN_CLUSTER:
                case RecvSource.REQUEST_JOIN_CLUSTER:
                    ExternalId = buf.GetInt();
                    ClusterType = (ClusterType)buf.Get();
                    Sender = buf.GetInt();
                    len = buf.Get() & 0xFF;
                    byte[] b = buf.GetByteArray(len);
                    Message = Utils.Util.GetString(b);
                    break;
                case RecvSource.CLUSTER_NOTIFICATION:
                    ExternalId = buf.GetInt();
                    ClusterType = (ClusterType)buf.Get();
                    OpCode = buf.Get();
                    MemberQQ = buf.GetInt();
                    Role = buf.Get();
                    Sender = ExternalId;
                    break;
                case RecvSource.SIGNATURE_CHANGE:
                    SignatureOwner = buf.GetInt();
                    ModifiedTime = buf.GetInt();
                    len = buf.Get() & 0xFF;
                    Signature = Utils.Util.GetString(buf, len);
                    break;
                case RecvSource.QQLIVE:
                    QQLive = new QQLive();
                    QQLive.Read(buf);
                    break;
                case RecvSource.MEMBER_LOGIN_HINT:
                    buf.Get();
                    break;
                case RecvSource.CUSTOM_HEAD_CHANGE:
                    int count = buf.Get() & 0xFF;
                    if (count > 0)
                    {
                        HeadChanges = new List<CustomHead>();
                        while (buf.HasRemaining())
                        {
                            CustomHead change = new CustomHead();
                            change.Read(buf);
                            HeadChanges.Add(change);
                        }
                    }
                    break;
                case RecvSource.PROPERTY_CHANGE :
                    PropertyChange = new UserPropertyChange();
                    PropertyChange.Read(buf);
                    break;
                case RecvSource.INPUT_STATE_CHANGE: //输入状态
                    buf.GetInt();//00 00 00 00
                    Sender = buf.GetInt();//09 58 8C 87
                    buf.Get();//00
                    break;
                default:
                    // 其他类型的消息我们现在没有办法处理,忽略
                    Client.LogManager.Log(ToString() + " Unknown RecvSource=0x" + Header.Type.ToString("X"));
                    break;
            }
        }
 protected override void ParseBody(ByteBuffer buf)
 {
     SubCommand = (UserPropertySubCmd)buf.Get();
     switch (SubCommand)
     {
         case UserPropertySubCmd.GET:
             StartPosition = buf.GetUShort();
             Finished = StartPosition == QQGlobal.QQ_POSITION_USER_PROPERTY_END;
             int pLen = buf.Get() & 0xFF;
             Properties = new List<UserProperty>();
             while (buf.HasRemaining())
             {
                 UserProperty p = new UserProperty(pLen);
                 p.Read(buf);
                 Properties.Add(p);
             }
             break;
     }
 }
Exemplo n.º 29
0
		// end input remaining
		/// <summary>
		/// Performs Base64 encoding on the <code>raw</code> ByteBuffer,
		/// writing it to the <code>encoded</code> CharBuffer.
		/// </summary>
		/// <remarks>
		/// Performs Base64 encoding on the <code>raw</code> ByteBuffer,
		/// writing it to the <code>encoded</code> CharBuffer.
		/// This is an experimental feature. Currently it does not
		/// pass along any options (such as
		/// <see cref="DoBreakLines">DoBreakLines</see>
		/// or
		/// <see cref="Gzip">Gzip</see>
		/// .
		/// </remarks>
		/// <param name="raw">input buffer</param>
		/// <param name="encoded">output buffer</param>
		/// <since>2.3</since>
		public static void Encode(ByteBuffer raw, CharBuffer encoded)
		{
			byte[] raw3 = new byte[3];
			byte[] enc4 = new byte[4];
			while (raw.HasRemaining())
			{
				int rem = Math.Min(3, raw.Remaining());
				raw.Get(raw3, 0, rem);
				Couchbase.Lite.Support.Base64.Encode3to4(enc4, raw3, rem, Couchbase.Lite.Support.Base64
					.NoOptions);
				for (int i = 0; i < 4; i++)
				{
					encoded.Put((char)(enc4[i] & unchecked((int)(0xFF))));
				}
			}
		}
 /// <summary>
 /// 解析包体,从buf的开头位置解析起
 /// <remark>abu 2008-02-18 </remark>
 /// </summary>
 /// <param name="buf">The buf.</param>
 protected override void ParseBody(ByteBuffer buf)
 {
     ReplyCode = (ReplyCode)buf.Get();
     if (ReplyCode == ReplyCode.OK)
     {
         Page = buf.GetUInt();
         Users = new List<AdvancedUserInfo>();
         while (buf.HasRemaining())
         {
             AdvancedUserInfo aui = new AdvancedUserInfo();
             aui.ReadBean(buf);
             Users.Add(aui);
         }
         Finished = Users.Count == 0;
     }
     else
         Finished = true;
 }