本文整理匯總了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;
}
}
示例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));
}
}
示例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());
}
示例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);
}
}
示例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));
}
}
示例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);
}
}
示例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);
}
}
}
}
示例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);
}
}
}
示例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);
}
}
}
示例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());
}
}
示例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;
}
}
示例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;
}
示例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);
}
}
}
示例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));
}
}
}
}
示例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++;
}