当前位置: 首页>>代码示例>>C#>>正文


C# ByteBuffer.HasRemaining方法代码示例

本文整理汇总了C#中System.ByteBuffer.HasRemaining方法的典型用法代码示例。如果您正苦于以下问题:C# ByteBuffer.HasRemaining方法的具体用法?C# ByteBuffer.HasRemaining怎么用?C# ByteBuffer.HasRemaining使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.ByteBuffer的用法示例。


在下文中一共展示了ByteBuffer.HasRemaining方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Read

 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;
        }
 }
开发者ID:leaker,项目名称:fuhj-widgets,代码行数:25,代码来源:Vibration.cs

示例2: Read

        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));
               }
        }
开发者ID:leaker,项目名称:fuhj-widgets,代码行数:26,代码来源:NormalIMFace.cs

示例3: ParseBody

 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());
 }
开发者ID:leaker,项目名称:fuhj-widgets,代码行数:9,代码来源:GetTempClusterOnlineMemberReplyPacket.cs

示例4: ParseBody

 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);
     }
 }
开发者ID:leaker,项目名称:fuhj-widgets,代码行数:11,代码来源:FriendLevelOpReplyPacket.cs

示例5: Read

 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));
        }
 }
开发者ID:leaker,项目名称:fuhj-widgets,代码行数:11,代码来源:NormalIMText.cs

示例6: ParseBody

        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);
            }
        }
开发者ID:leaker,项目名称:fuhj-widgets,代码行数:20,代码来源:SearchUserReplyPacket.cs

示例7: ParseUpdateOrganization

 /// <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);
             }
         }
     }
 }
开发者ID:leaker,项目名称:fuhj-widgets,代码行数:25,代码来源:ClusterCommandReplyPacket.cs

示例8: ParseSubClusterOp

 /// <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);
         }
     }
 }
开发者ID:leaker,项目名称:fuhj-widgets,代码行数:21,代码来源:ClusterCommandReplyPacket.cs

示例9: ParseSearchReply

 /// <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);
         }
     }
 }
开发者ID:leaker,项目名称:fuhj-widgets,代码行数:18,代码来源:ClusterCommandReplyPacket.cs

示例10: ParseGetOnlineMemberReply

 /// <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());
     }
 }
开发者ID:leaker,项目名称:fuhj-widgets,代码行数:19,代码来源:ClusterCommandReplyPacket.cs

示例11: ParseBody

        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;
            }
        }
开发者ID:leaker,项目名称:fuhj-widgets,代码行数:48,代码来源:FriendDataOpReplyPacket.cs

示例12: AnalyseMessage09

        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;
        }
开发者ID:leaker,项目名称:fuhj-widgets,代码行数:29,代码来源:NormalIM.cs

示例13: ParseGetInfoReply

 /// <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);
         }
     }
 }
开发者ID:leaker,项目名称:fuhj-widgets,代码行数:24,代码来源:ClusterCommandReplyPacket.cs

示例14: ParseBody

 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));
             }
         }
     }
 }
开发者ID:leaker,项目名称:fuhj-widgets,代码行数:24,代码来源:GroupDataOpReplyPacket.cs

示例15: ParseBody

 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++;
 }
开发者ID:leaker,项目名称:fuhj-widgets,代码行数:25,代码来源:GetOnlineOpReplyPacket.cs


注:本文中的System.ByteBuffer.HasRemaining方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。