本文整理汇总了C#中System.ByteBuffer.Get方法的典型用法代码示例。如果您正苦于以下问题:C# ByteBuffer.Get方法的具体用法?C# ByteBuffer.Get怎么用?C# ByteBuffer.Get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.ByteBuffer
的用法示例。
在下文中一共展示了ByteBuffer.Get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Read
public void Read(ByteBuffer buf)
{
Id = (uint)buf.Get();
Path = buf.GetUInt();
int len = (int)buf.Get();
Name = Utils.Util.GetString(buf.GetByteArray(len));
}
示例2: Read
/// <summary>
/// </summary>
/// <param name="buf">The buf.</param>
public void Read(ByteBuffer buf)
{
// 发送者
Sender = buf.GetInt();
// 未知的4字节
buf.GetInt();
// 昵称
int len = buf.Get() & 0xFF;
Nick = Utils.Util.GetString(buf, len);
// 群名称
len = buf.Get() & 0xFF;
Site = Utils.Util.GetString(buf, len);
// 未知的1字节
buf.Get();
// 时间
Time = (long)buf.GetInt() * 1000L;
// 后面的内容长度
len = buf.GetUShort();
// 得到字体属性长度,然后得到消息内容
int fontStyleLength = buf.Get(buf.Position + len - 1) & 0xFF;
Message = Utils.Util.GetString(buf, len - fontStyleLength);
// 字体属性
FontStyle = new FontStyle();
FontStyle.Read(buf);
}
示例3: 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));
}
}
示例4: 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());
}
示例5: ParseBody
protected override void ParseBody(ByteBuffer buf)
{
ReplyCode = (ReplyCode)buf.Get();
if (ReplyCode == ReplyCode.OK)
{
int len = buf.Get() & 0xFF;
LoginToken = buf.GetByteArray(len);
}
}
示例6: ParseBody
protected override void ParseBody(ByteBuffer buf)
{
#if DEBUG
Client.LogManager.Log(ToString() + " " + Utils.Util.ToHex(buf.ToByteArray()));
#endif
ReplyCode = (ReplyCode)buf.Get();
}
示例7: Read
public void Read(ByteBuffer buf)
{
QQ = buf.GetInt();
ModifiedTime = buf.GetInt();
int len = buf.Get() & 0xFF;
Sig = Utils.Util.GetString(buf, len);
}
示例8: Read
/// <summary>
/// </summary>
/// <param name="buf">The buf.</param>
public void Read(ByteBuffer buf)
{
ByteBuffer temp = new ByteBuffer();
int i = 0;
while (true)
{
byte b = buf.Get();
if (b != 0x1F)
{
if (b != 0x1E)
{
temp.Put(b);
}
else
{
if (i == 0)
{
QQ = Utils.Util.GetInt(Utils.Util.GetString(temp.ToByteArray()), 0000);
}
else if (i == 1)
Nick = Utils.Util.GetString(temp.ToByteArray());
else if (i == 2)
Province = Utils.Util.GetString(temp.ToByteArray());
i++;
temp.Initialize();
}
}
else
{
Face = Utils.Util.GetInt(Utils.Util.GetString(temp.ToByteArray()), 0);
break;
}
}
}
示例9: ByteBuffer_GetByteReturnsCorrectData
public void ByteBuffer_GetByteReturnsCorrectData()
{
var buffer = new byte[1];
buffer[0] = 99;
var uut = new ByteBuffer(buffer);
Assert.AreEqual((byte)99, uut.Get(0));
}
示例10: 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;
}
}
示例11: ReadBindUserSMS
/// <summary>给定一个输入流,解析SMS结构
/// </summary>
/// <param name="buf">The buf.</param>
public void ReadBindUserSMS(ByteBuffer buf)
{
// 未知1字节,0x0
buf.Get();
// 发送者QQ号,4字节
Sender = buf.GetInt();
// 发送者头像
Header = (int)buf.GetUShort();
// 发送者名称,最多13字节,不足后面补0
SenderName = Utils.Util.GetString(buf, (byte)0, QQGlobal.QQ_MAX_SMS_SENDER_NAME);
// 未知的1字节,0x4D
buf.Get();
// 消息内容
Message = Utils.Util.GetString(buf, (byte)0);
Time = DateTime.Now.Millisecond;
}
示例12: absGet
private static void absGet(ByteBuffer b)
{
int n = b.Capacity;
byte v;
for (int i = 0; i < n; i++)
ck(b, (long)b.Get(), (long)((byte)Ic(i)));
b.Rewind();
}
示例13: relGet
private static void relGet(ByteBuffer b, int start)
{
int n = b.Remaining;
byte v;
for (int i = start; i < n; i++)
ck(b, (long)b.Get(), (long)((byte)Ic(i)));
b.Rewind();
}
示例14: bulkGet
private static void bulkGet(ByteBuffer b)
{
int n = b.Capacity;
byte[] a = new byte[n + 7];
b.Get(a, 7, n);
for (int i = 0; i < n; i++)
ck(b, (long)a[i + 7], (long)((byte)Ic(i)));
}
示例15: ParseBody
protected override void ParseBody(ByteBuffer buf)
{
#if DEBUG
Client.LogManager.Log(ToString() + " Decoded Data:" + Utils.Util.ToHex(buf.ToByteArray()));
#endif
buf.GetChar();//length or sth..
ReplyCode = buf.Get();
int len = 0;
switch (ReplyCode)
{
case 0x00://success!
Client.LogManager.Log(ToString() + ":0x" + ReplyCode.ToString("X2") + " Login Success!");
len = buf.GetChar();//0x0020
Client.QQUser.QQKey.LoginInfo_Token = buf.GetByteArray(len);
Client.QQUser.QQKey.LoginInfo_UnknowData = buf.GetByteArray(4); //buf.GetInt()
Client.ServerTime = buf.GetByteArray(4);
len = buf.GetChar();
Client.QQUser.QQKey.LoginInfo_Data_Token = buf.GetByteArray(len);
len = buf.GetChar();
Client.QQUser.QQKey.LoginInfo_Magic_Token = buf.GetByteArray(len);
Client.QQUser.QQKey.LoginInfo_Key1 = buf.GetByteArray(16);
buf.GetChar();//0x00 00
if (buf.Position + 3 < buf.Length)//判断来的包是否包含LoginInfo_Key3 因为有的版本没这个key 应该说本人用的正式版本没这个
{
Client.QQUser.QQKey.LoginInfo_Key3 = buf.GetByteArray(16);
#if DEBUG
Client.LogManager.Log(ToString() + "Client.QQUser.QQKey.LoginInfo_Key3:" + Utils.Util.ToHex(Client.QQUser.QQKey.LoginInfo_Key3));
#endif
}
buf.GetChar();//0x00 00
return;
case 0x33:
case 0x51://denied!
Client.LogManager.Log(ToString() + ":0x" + ReplyCode.ToString("X2") + " Denied!");
break;
case 0xBF:
Client.LogManager.Log(ToString() + ":0x" + ReplyCode.ToString("X2") + " No this QQ number!");
break;
case 0x34:
Client.LogManager.Log(ToString() + ":0x" + ReplyCode.ToString("X2") + " Wrong password!");
break;
default:
Client.LogManager.Log(ToString() + ":0x" + ReplyCode.ToString("X2") + " Unknow ReplyCode!");
break;
}
buf.Position = 11;
len =(int) buf.GetChar();
byte[] data = buf.GetByteArray(len);
ReplyMessage = Utils.Util.GetString(data);
Client.LogManager.Log(ToString() + ":0x" + ReplyCode.ToString("X2") + " Message Data(UTF-8): "+Utils.Util.ToHex(data)+"-->" + ReplyMessage);
}