本文整理汇总了C#中System.ByteBuffer.ToByteArray方法的典型用法代码示例。如果您正苦于以下问题:C# ByteBuffer.ToByteArray方法的具体用法?C# ByteBuffer.ToByteArray怎么用?C# ByteBuffer.ToByteArray使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.ByteBuffer
的用法示例。
在下文中一共展示了ByteBuffer.ToByteArray方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: PutBody
protected override void PutBody(ByteBuffer buf)
{
// 初始密钥
buf.PutChar((char)user.QQKey.LoginInfo_Magic_Token.Length);
buf.Put(user.QQKey.LoginInfo_Magic_Token);
ByteBuffer DecodedBuf = new ByteBuffer();
DecodedBuf.PutChar((char)0x010D);
DecodedBuf.Put(0x00);
DecodedBuf.Put(new byte[] { 0x01, 0x01 });
DecodedBuf.Put(VersionData.QQ09_LOCALE);
DecodedBuf.Put(VersionData.QQ09_VERSION_SPEC);
DecodedBuf.PutChar((char)Client.QQUser.QQKey.Answer_Token.Length);
DecodedBuf.Put(Client.QQUser.QQKey.Answer_Token);
DecodedBuf.PutChar((char)Client.QQUser.QQKey.LoginInfo_Token.Length);
DecodedBuf.Put(Client.QQUser.QQKey.LoginInfo_Token);
DecodedBuf.Put(Client.QQUser.QQKey.LoginInfo_UnknowData);
DecodedBuf.Put(Client.ServerTime);
DecodedBuf.PutChar((char)Client.QQUser.QQKey.LoginInfo_Data_Token.Length);
DecodedBuf.Put(Client.QQUser.QQKey.LoginInfo_Data_Token);
DecodedBuf.PutChar((char)0x0000);
DecodedBuf.PutInt(0x00000000);
//Client.QQUser.QQKey.Key = Client.QQUser.QQKey.LoginInfo_Key1;//可能要用到
byte[] EncodedBuf = crypter.Encrypt(DecodedBuf.ToByteArray(), user.QQKey.LoginInfo_Key1);
buf.Put(EncodedBuf);
#if DEBUG
Client.LogManager.Log(ToString() + " key:" + Utils.Util.ToHex(user.QQKey.InitKey));
Client.LogManager.Log(ToString() + " UnBody: " + Utils.Util.ToHex(DecodedBuf.ToByteArray()));
#endif
}
示例2: PutBody
protected override void PutBody(ByteBuffer buf)
{
// 初始密钥
//buf.Put(user.QQKey.InitKey);
buf.PutChar((char)user.QQKey.LoginInfo_Magic_Token.Length);
buf.Put(user.QQKey.LoginInfo_Magic_Token);
ByteBuffer DecodedBuf = new ByteBuffer();
DecodedBuf.PutChar((char)0x0101);
DecodedBuf.PutChar((char)0x0000);
DecodedBuf.Put((byte)Client.QQUser.QQKey.LoginInfo_Token.Length);
DecodedBuf.Put(Client.QQUser.QQKey.LoginInfo_Token);
DecodedBuf.Put(new byte[]{0x10,0x03,0xC8,0xEC,0xC8,0x96,
0x8B,0xF2,0xB3,0x6B,0x4D,0x0C,0x5C,0xE0,0x6A,0x51,0xCE});//unknown data
//Client.QQUser.QQKey.Key = Client.QQUser.QQKey.LoginInfo_Key1;//可能要用到
byte[] EncodedBuf = crypter.Encrypt(DecodedBuf.ToByteArray(), user.QQKey.LoginInfo_Key1);
#if DEBUG
Client.LogManager.Log(ToString() + " key:" + Utils.Util.ToHex(user.QQKey.LoginInfo_Key1));
Client.LogManager.Log(ToString() + " UnBody:" + Utils.Util.ToHex(DecodedBuf.ToByteArray()));
#endif
buf.Put(EncodedBuf);
#if DEBUG
Client.LogManager.Log(ToString() + " EnBody:" + Utils.Util.ToHex(buf.ToByteArray()));
#endif
}
示例3: 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;
}
}
}
示例4: ParseBody
protected override void ParseBody(ByteBuffer buf)
{
#if DEBUG
Client.LogManager.Log(ToString() + " Decoded Data:" + Utils.Util.ToHex(buf.ToByteArray()));
Client.LogManager.Log(ToString() + ":No use data until now!You can check this dat! It's said it has a key");
#endif
}
示例5: ParseBody
protected override void ParseBody(ByteBuffer buf)
{
#if DEBUG
Client.LogManager.Log(ToString() + " " + Utils.Util.ToHex(buf.ToByteArray()));
#endif
ReplyCode = (ReplyCode)buf.Get();
}
示例6: PutBody
protected override void PutBody(ByteBuffer buf)
{
buf.Put(Reply);
#if DEBUG
Client.LogManager.Log(ToString() + " " + Utils.Util.ToHex(buf.ToByteArray()));
#endif
}
示例7: PutBody
protected override void PutBody(ByteBuffer buf)
{
// 要加的QQ号的字符串形式
buf.PutInt(To);
#if DEBUG
Client.LogManager.Log(ToString() + " " + Utils.Util.ToHex(buf.ToByteArray()));
#endif
}
示例8: ParseBody
protected override void ParseBody(ByteBuffer buf)
{
byte[] b = buf.ToByteArray();
QQ = Utils.Util.GetInt(Utils.Util.GetString(b), 0);
if (QQ == user.QQ)
Success = true;
else
Success = false;
}
示例9: ParseBody
protected override void ParseBody(ByteBuffer buf)
{
#if DEBUG
Client.LogManager.Log(ToString() + " " + Utils.Util.ToHex(buf.ToByteArray()));
#endif
SubCommand =(AddFriendAuthSubCmd) buf.Get();
To = buf.GetInt();
ReplyCode = (ReplyCode)buf.Get();
}
示例10: PutBody
protected override void PutBody(ByteBuffer buf)
{
buf.Put(0x88);
buf.PutInt(Client.QQUser.QQ);
buf.Put(0x00);
#if DEBUG
Client.LogManager.Log(ToString() + " " + Utils.Util.ToHex(buf.ToByteArray()));
#endif
}
示例11: PutBody
/// <summary>
/// 初始化包体
/// </summary>
/// <param name="buf">The buf.</param>
protected override void PutBody(ByteBuffer buf)
{
buf.Put((byte)0x1F);
buf.Put((byte)0x01);
buf.PutInt(BeginFrom);
#if DEBUG
Client.LogManager.Log(ToString() + " " + Utils.Util.ToHex(buf.ToByteArray()));
#endif
}
示例12: PutBody
protected override void PutBody(ByteBuffer buf)
{
// 初始密钥
buf.Put(user.QQKey.InitKey);
ByteBuffer DecodedBuf = new ByteBuffer();
DecodedBuf.Put(new byte[] { 0x00, 0x01 });
DecodedBuf.Put(VersionData.QQ09_LOCALE);
DecodedBuf.Put(VersionData.QQ09_VERSION_SPEC);
DecodedBuf.Put((byte)0x00);
DecodedBuf.Put(Client.ServerInfo.GetBytes());
//DecodedBuf.Put(zeros);//15字节长度00
byte[] EncodedBuf = crypter.Encrypt(DecodedBuf.ToByteArray(), user.QQKey.InitKey);
buf.Put(EncodedBuf);
#if DEBUG
Client.LogManager.Log(ToString() + " key:" + Utils.Util.ToHex(user.QQKey.InitKey));
Client.LogManager.Log(ToString() + " Uncrypt Body:" + Utils.Util.ToHex(DecodedBuf.ToByteArray()));
#endif
}
示例13: PutBody
protected override void PutBody(ByteBuffer buf)
{
buf.Position += 15;//16个00
buf.Put(0x00);
//buf.Put(user.PasswordKey);
#if DEBUG
Client.LogManager.Log(ToString() + " " + Utils.Util.ToHex(buf.ToByteArray()));
#endif
}
示例14: PutBody
protected override void PutBody(ByteBuffer buf)
{
// 命令类型
buf.Put((byte)SubCommand);
// 内部ID
buf.PutInt(ClusterId);
#if DEBUG
Client.LogManager.Log(ToString() + " " + Utils.Util.ToHex(buf.ToByteArray()));
#endif
}
示例15: GetBytes
/// <summary>
/// 将serverInfo转成byte[]
/// </summary>
/// <returns></returns>
public byte[] GetBytes()
{
ByteBuffer buf = new ByteBuffer();
buf.Put(CSP_wRedirectCount);
buf.Put(CSP_cRedirectCount);
buf.Put(CSP_dwConnIspID);
buf.Put(CSP_dwServerReserve);
buf.Put(CSP_dwConnIP);
return buf.ToByteArray();
}