protected byte[] GenerateBody() { //http://www.mongodb.org/display/DOCS/Mongo+Wire+Protocol#MongoWireProtocol-OPDELETE //int32 ZERO; // 0 - reserved for future use //cstring fullCollectionName; // "dbname.collectionname" //int32 ZERO; // 0 - reserved for future use //BSON selector; // BSON document that represent the query used // to select the documents to be removed. The // selector will contain one or more elements, // all of which must match for a document to be //removed from the collection using (var stream = new MemoryStream()) { using (var writer = new BodyWriter(stream)) { writer.Write(0); writer.Write(FullCollectionName); writer.Write(0); writer.WriteTerminator(); writer.WriteSelector(Selector ?? new object()); return(stream.ToArray()); } } }
protected byte[] GenerateBody() { //http://www.mongodb.org/display/DOCS/Mongo+Wire+Protocol#MongoWireProtocol-OPQUERY //int32 opts; // query options. //cstring fullCollectionName; // "dbname.collectionname" //int32 numberToSkip; // number of documents to skip when returning results //int32 numberToReturn; // number of documents to return in the first OP_REPLY //BSON query; // query object. See below for details. //BSON returnFieldSelector; // OPTIONAL : selector indicating the fields to return. See below for details. using (var stream = new MemoryStream()) { using (var writer = new BodyWriter(stream)) { writer.Write((int)QueryCommandOptions.None); writer.Write(NodeName + ".$cmd"); writer.WriteTerminator(); writer.Write(0); writer.Write(-1); writer.WriteSelector(Command); return(stream.ToArray()); } } }
public PacketOutboundReferral(ulong worldConnectionKey, string[] sessionIPAddress, byte[] host, ushort port, bool sendInternalHostOnLocalNetwork, byte[] internalHost) : base() { Header.Flags = PacketHeaderFlags.EncryptedChecksum | PacketHeaderFlags.Referral; BodyWriter.Write(worldConnectionKey); BodyWriter.Write((ushort)2); BodyWriter.WriteUInt16BE(port); if (sendInternalHostOnLocalNetwork && (sessionIPAddress[0] == "10" || (sessionIPAddress[0] == "172" && System.Convert.ToInt16(sessionIPAddress[1]) >= 16 && System.Convert.ToInt16(sessionIPAddress[1]) <= 31) || (sessionIPAddress[0] == "192" && sessionIPAddress[1] == "168"))) { BodyWriter.Write(internalHost); } else { BodyWriter.Write(host); } BodyWriter.Write(0ul); BodyWriter.Write((ushort)0x18); // This value is currently the hard coded Server ID. It can be something different... BodyWriter.Write((ushort)0); BodyWriter.Write(0u); }
/// <summary> /// 初始化包体 /// </summary> protected override void PutBody() { BodyWriter.Write(new TLV0018().Get_Tlv(User)); BodyWriter.Write(new TLV0309().Get_Tlv(User)); BodyWriter.Write(new TLV0036().Get_Tlv(User)); BodyWriter.Write(new TLV0114().Get_Tlv(User)); }
/// <summary> /// 初始化包体 /// </summary> protected override void PutBody() { BodyWriter.Write(new byte[] { 0x00, 0x00, 0x00, 0x07 }); var data = new BinaryWriter(new MemoryStream()); var data_0A = new BinaryWriter(new MemoryStream()); data_0A.Write((byte)0x08); data_0A.Write(Util.HexStringToByteArray(Util.PB_toLength(User.QQ))); data_0A.Write((byte)0x10); data_0A.Write(Util.HexStringToByteArray(Util.PB_toLength(_recvQQ))); data_0A.Write((byte)0x18); data_0A.Write(Util.HexStringToByteArray(Util.PB_toLength(_msgSequence))); //消息包序 data_0A.Write((byte)0x28); data_0A.Write( Util.HexStringToByteArray( Util.PB_toLength(Convert.ToInt64(Util.ToHex(MessageTime).Replace(" ", ""), 16)))); data_0A.Write(new byte[] { 0x30 }); data_0A.Write( Util.HexStringToByteArray( Util.PB_toLength(Convert.ToInt64(Util.ToHex(MessageId).Replace(" ", ""), 16)))); //消息Id data_0A.Write(new byte[] { 0x38, 0x01, 0x40, 0x00, 0x48, 0x00 }); data.Write((byte)0x0A); data.Write((byte)data_0A.BaseStream.Length); //length data.Write(data_0A.BaseStream.ToBytesArray()); data.Write(new byte[] { 0x10, 0x01, 0x18, 0x01, 0x20, 0x00, 0x2a, 0x04, 0x08, 0x00, 0x10, 0x00 }); //数据长度 BodyWriter.BeWrite(data.BaseStream.Length); BodyWriter.Write(new byte[] { 0x08, 0x01, 0x12, 0x03, 0x98, 0x01, 0x00 }); //数据 BodyWriter.Write(data.BaseStream.ToBytesArray()); }
public PacketOutboundReferral(ulong worldConnectionKey, string[] sessionIPAddress) : base() { this.Header.Flags = PacketHeaderFlags.EncryptedChecksum | PacketHeaderFlags.Referral; this.worldConnectionKey = worldConnectionKey; this.sessionIPAddress = sessionIPAddress; BodyWriter.Write(worldConnectionKey); BodyWriter.Write((ushort)2); BodyWriter.WriteUInt16BE((ushort)ConfigManager.Config.Server.Network.WorldPort); if (ConfigManager.Config.Server.Network.SendInternalHostOnLocalNetwork && (sessionIPAddress[0] == "10" || (sessionIPAddress[0] == "172" && System.Convert.ToInt16(sessionIPAddress[1]) >= 16 && System.Convert.ToInt16(sessionIPAddress[1]) <= 31) || (sessionIPAddress[0] == "192" && sessionIPAddress[1] == "168"))) { BodyWriter.Write(ConfigManager.InternalHost); } else { BodyWriter.Write(ConfigManager.Host); } BodyWriter.Write(0ul); BodyWriter.Write((ushort)0x18); BodyWriter.Write((ushort)0); BodyWriter.Write(0u); }
/// <summary> /// 初始化包体 /// </summary> protected override void PutBody() { BodyWriter.Write(new byte[] { 0x00, 0x02, 0x00, 0x00, 0x08, 0x04, 0x01, 0xE0 }); BodyWriter.BeWrite(User.TXProtocol.DwSsoVersion); BodyWriter.BeWrite(User.TXProtocol.DwServiceId); BodyWriter.BeWrite(User.TXProtocol.DwClientVer); BodyWriter.Write((byte)0x00); BodyWriter.WriteKey(User.TXProtocol.BufSigClientAddr); BodyWriter.Write(new byte[] { 0x01, 0x02 }); BodyWriter.WriteKey(User.TXProtocol.BufDhPublicKey); if (string.IsNullOrEmpty(VerifyCode)) { BodyWriter.Write(new byte[] { 0x13, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00 }); BodyWriter.Write(User.QQPacket00BaSequence); if (User.TXProtocol.PngToken == null || User.TXProtocol.PngToken?.Length == 0) { BodyWriter.Write((byte)0x00); } else { BodyWriter.WriteKey(User.TXProtocol.PngToken); } } else { var verifyCodeBytes = Util.HexStringToByteArray(Util.ConvertStringToHex(VerifyCode)); BodyWriter.Write(new byte[] { 0x14, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00 }); BodyWriter.BeWrite((ushort)verifyCodeBytes.Length); BodyWriter.Write(verifyCodeBytes); BodyWriter.WriteKey(User.TXProtocol.BufSigPic); //输入验证码后清空图片流 User.QQPacket00BaVerifyCode = new byte[] { }; } BodyWriter.WriteKey(User.QQPacket00BaFixKey); }
/// <summary> /// 初始化包体 /// </summary> protected override void PutBody() { BodyWriter.Write(new byte[] { 0x00, 0x00, 0x00, 0x0D }); var data = new BinaryWriter(new MemoryStream()); data.Write(new byte[] { 0x0A, 0x12, 0x08 }); data.Write(Util.HexStringToByteArray(Util.PB_toLength(GroupQQ))); data.Write(new byte[] { 0x12, 0x0a, 0x38, 0x00, 0x40, 0x00, 0x4a, 0x04, 0x08, 0x00, 0x10, 0x00 }); //数据长度 BodyWriter.BeWrite(data.BaseStream.Length); BodyWriter.Write(new byte[] { 0x08, 0x01, 0x12, 0x09 }); var data12 = new BinaryWriter(new MemoryStream()); data12.Write( Util.HexStringToByteArray( Util.PB_toLength(Convert.ToInt64(Util.ToHex(MessageIndex).Replace(" ", ""), 16)))); data12.Write(new byte[] { 0x88, 0x01, 0x04, 0x98, 0x01, 0x00 }); BodyWriter.Write((byte)data12.BaseStream.Length); BodyWriter.Write(data12.BaseStream.ToBytesArray()); //数据 BodyWriter.Write(data.BaseStream.ToBytesArray()); }
/// <summary> /// 初始化包体 /// </summary> protected override void PutBody() { BodyWriter.Write(new byte[] { 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00 }); string data = "{\"t1\":" + Util.GetTimeSeconds(DateTime.Now).ToString() + "}"; BodyWriter.WriteKey(Util.GetBytes(data)); }
/// <summary> /// 初始化包体 /// </summary> protected override void PutBody() { BodyWriter.Write(new byte[] { 0x03 }); BodyWriter.BeWrite(AddQQ); }
public PacketOutboundServerSwitch() { Header.Flags = PacketHeaderFlags.EncryptedChecksum | PacketHeaderFlags.ServerSwitch; InitializeBodyWriter(); BodyWriter.Write((uint)0x18); // This value is currently the hard coded Server ID. It can be something different... BodyWriter.Write((uint)0x00); }
/// <summary> /// 初始化包体 /// </summary> protected override void PutBody() { BodyWriter.Write(new byte[] { 0x01, 0x00 }); BodyWriter.Write((byte)AddType); BodyWriter.BeWrite(AddQQ); }
public PacketOutboundConnectRequest(double serverTime, ulong cookie, uint clientId, byte[] isaacServerSeed, byte[] isaacClientSeed) : base() { this.Header.Flags = PacketHeaderFlags.ConnectRequest; BodyWriter.Write(serverTime); // CConnectHeader.ServerTime BodyWriter.Write(cookie); // CConnectHeader.Cookie BodyWriter.Write(clientId); // CConnectHeader.NetID BodyWriter.Write(isaacServerSeed); // CConnectHeader.OutgoingSeed BodyWriter.Write(isaacClientSeed); // CConnectHeader.IncomingSeed BodyWriter.Write(0u); // Padding for alignment? }
protected byte[] GenerateBody() { //http://www.mongodb.org/display/DOCS/Mongo+Wire+Protocol#MongoWireProtocol-OPQUERY //int32 opts; // query options //cstring fullCollectionName; // "dbname.collectionname" //int32 numberToSkip; // number of documents to skip when returning results //int32 numberToReturn; // number of documents to return in the first OP_REPLY //BSON query; // query object. See below for details. //BSON returnFieldSelector; // OPTIONAL : selector indicating the fields to return. See below for details. using (var stream = new MemoryStream()) { using (var writer = new BodyWriter(stream)) { //Number of docs to return: // 0 => the server will use the default return size; // -x => If the number is negative, then the database will return that number and close the cursor. // 1 => the server will treat it as -1 (closing the cursor automatically) var numOfDocsToReturn = NumberOfDocumentsToReturn ?? 0; if (numOfDocsToReturn > 0) { numOfDocsToReturn = numOfDocsToReturn * -1; } writer.Write((int)Options); writer.Write(FullCollectionName); writer.WriteTerminator(); writer.Write(NumberOfDocumentsToSkip ?? 0); writer.Write(numOfDocsToReturn); writer.WriteSelector(QuerySelector ?? new object()); if (DocumentSchema != null) { writer.WriteDocument(DocumentSchema); } return(stream.ToArray()); } } }
public PacketOutboundConnectRequest(byte[] isaacServerSeed, byte[] isaacClientSeed) : base() { this.Header.Flags = PacketHeaderFlags.ConnectRequest; BodyWriter.Write(0u); BodyWriter.Write(0u); BodyWriter.Write(13626398284849559039ul); // some sort of check value? BodyWriter.Write((ushort)0); BodyWriter.Write((ushort)0); BodyWriter.Write(isaacServerSeed); BodyWriter.Write(isaacClientSeed); BodyWriter.Write(0u); }
/// <summary> /// 初始化包体 /// </summary> protected override void PutBody() { BodyWriter.Write(new byte[] { 0x33, 0x00, 0x05, 0x00, 0x08, 0x74, 0x2E, 0x71, 0x71, 0x2E, 0x63, 0x6F, 0x6D, 0x00, 0x0A, 0x71, 0x75, 0x6E, 0x2E, 0x71, 0x71, 0x2E, 0x63, 0x6F, 0x6D, 0x00, 0x0C, 0x71, 0x7A, 0x6F, 0x6E, 0x65, 0x2E, 0x71, 0x71, 0x2E, 0x63, 0x6F, 0x6D, 0x00, 0x0C, 0x6A, 0x75, 0x62, 0x61, 0x6F, 0x2E, 0x71, 0x71, 0x2E, 0x63, 0x6F, 0x6D, 0x00, 0x09, 0x6B, 0x65, 0x2E, 0x71, 0x71, 0x2E, 0x63, 0x6F, 0x6D }); }
/// <summary> /// 初始化包体 /// </summary> protected override void PutBody() { BodyWriter.Write(new TLV0007().Get_Tlv(User)); BodyWriter.Write(new TLV000C().Get_Tlv(User)); BodyWriter.Write(new TLV0015().Get_Tlv(User)); BodyWriter.Write(new TLV0036().Get_Tlv(User)); BodyWriter.Write(new TLV0018().Get_Tlv(User)); BodyWriter.Write(new TLV001F().Get_Tlv(User)); BodyWriter.Write(new TLV0105().Get_Tlv(User)); BodyWriter.Write(new TLV010B().Get_Tlv(User)); BodyWriter.Write(new TLV002D().Get_Tlv(User)); }
/// <summary> /// 初始化包体 /// </summary> protected override void PutBody() { var pic = new Bitmap(FileName); var width = pic.Size.Width; // 图片的宽度 var height = pic.Size.Height; // 图片的高度 var picBytes = ImageHelper.ImageToBytes(pic); var md5 = QQTea.MD5(picBytes); var data = new BinaryWriter(new MemoryStream()); data.Write(new byte[] { 0x01, 0x08, 0x01, 0x12 }); data.Write((byte)0x5A); data.Write((byte)0x08); data.Write(Util.HexStringToByteArray(Util.PB_toLength(User.QQ))); data.Write((byte)0x10); data.Write(Util.HexStringToByteArray(Util.PB_toLength(ToQQ))); data.BeWrite((ushort)0x1800); data.Write((byte)0x22); data.Write((byte)0x10); data.Write(md5); data.Write((byte)0x28); data.Write(Util.HexStringToByteArray(Util.PB_toLength(picBytes.Length))); data.Write((byte)0x32); data.Write((byte)0x1A); data.Write(new byte[] { 0x57, 0x00, 0x53, 0x00, 0x4E, 0x00, 0x53, 0x00, 0x4C, 0x00, 0x54, 0x00, 0x31, 0x00, 0x36, 0x00, 0x47, 0x00, 0x45, 0x00, 0x4F, 0x00, 0x5B, 0x00, 0x5F, 0x00 }); data.BeWrite((ushort)0x3801); data.BeWrite((ushort)0x4801); data.Write((byte)0x70); data.Write(Util.HexStringToByteArray(Util.PB_toLength(width))); data.Write((byte)0x78); data.Write(Util.HexStringToByteArray(Util.PB_toLength(height))); BodyWriter.Write(new byte[] { 0x00, 0x00, 0x00, 0x07 }); //数据长度 BodyWriter.BeWrite(data.BaseStream.Length); BodyWriter.Write(new byte[] { 0x08, 0x01, 0x12, 0x03, 0x98, 0x01 }); //数据 BodyWriter.Write(data.BaseStream.ToBytesArray()); }
/// <summary> /// 初始化包体 /// </summary> protected override void PutBody() { if (AddType == AddFriendType.AddFriend) { BodyWriter.Write(new byte[] { 0x00 }); BodyWriter.BeWrite(AddQQ); if (User.AddFriend0018Value.Length > 0) { BodyWriter.BeWrite((ushort)User.AddFriend0018Value.Length); BodyWriter.Write(User.AddFriend0018Value); BodyWriter.BeWrite((ushort)User.AddFriend0020Value.Length); BodyWriter.Write(User.AddFriend0020Value); } else { BodyWriter.Write(new byte[] { 0x00, 0x00 }); BodyWriter.BeWrite((ushort)User.AddFriend0020Value.Length); BodyWriter.Write(User.AddFriend0020Value); } BodyWriter.Write(new byte[] { 0x10, 0x00 }); } else { BodyWriter.Write(new byte[] { 0x02 }); BodyWriter.BeWrite(AddQQ); BodyWriter.Write(new byte[] { 0x00, 0x00 }); BodyWriter.BeWrite((ushort)User.AddFriend0020Value.Length); BodyWriter.Write(User.AddFriend0020Value); BodyWriter.Write(new byte[] { 0x10, 0x00 }); BodyWriter.BeWrite((ushort)Message.Length); BodyWriter.Write(Message); } BodyWriter.Write(new byte[] { 0x01, 0x00, 0x00, 0x0F, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00 }); }
protected virtual byte[] GenerateBody() { //http://www.mongodb.org/display/DOCS/Mongo+Wire+Protocol#MongoWireProtocol-OPQUERY //int32 ZERO; // 0 - reserved for future use //cstring fullCollectionName; // "dbname.collectionname" //int32 numberToReturn; // number of documents to return //int64 cursorID // cursorID from the OP_REPLY using (var stream = new MemoryStream()) { using (var writer = new BodyWriter(stream)) { writer.Write(0); writer.Write(NodeName); writer.WriteTerminator(); writer.Write(NumberOfDocumentsToReturn); writer.Write(InitialCursorId); return(stream.ToArray()); } } }
/// <summary> /// 初始化包体 /// </summary> protected override void PutBody() { BodyWriter.Write(new byte[] { 0x00, 0x00, 0x00, 0x0D }); var data = new BinaryWriter(new MemoryStream()); data.Write(new byte[] { 0x0A, 0x12, 0x08 }); data.Write(Util.HexStringToByteArray(Util.PB_toLength(_groupQQ))); data.Write(new byte[] { 0x12, 0x0a, 0x38, 0x00, 0x40, 0x00, 0x4a, 0x04, 0x08, 0x00, 0x10, 0x00 }); //数据长度 BodyWriter.BeWrite(data.BaseStream.Length); BodyWriter.Write(new byte[] { 0x08, 0x01, 0x12, 0x09, 0x10, 0x91, 0x07, 0x88, 0x01, 0x04, 0x98, 0x01, 0x00 }); //数据 BodyWriter.Write(data.BaseStream.ToBytesArray()); }
/// <summary> /// 初始化包体 /// </summary> protected override void PutBody() { var pic = new Bitmap(FileName); var width = pic.Size.Width; // 图片的宽度 var height = pic.Size.Height; // 图片的高度 //var Md5 = Util.GetMD5ToGuidHashFromFile(fileName); var picBytes = ImageHelper.ImageToBytes(pic); var md5 = QQTea.MD5(picBytes); BodyWriter.Write(new byte[] { 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x5E, 0x08, 0x01, 0x12, 0x03, 0x98, 0x01, 0x01, 0x10, 0x01, 0x1A }); BodyWriter.Write((byte)0x5A); BodyWriter.Write((byte)0x08); BodyWriter.Write(Util.HexStringToByteArray(Util.PB_toLength(Group))); BodyWriter.Write((byte)0x10); BodyWriter.Write(Util.HexStringToByteArray(Util.PB_toLength(User.QQ))); BodyWriter.BeWrite((ushort)0x1800); BodyWriter.Write((byte)0x22); BodyWriter.Write((byte)0x10); BodyWriter.Write(md5); BodyWriter.Write((byte)0x28); BodyWriter.Write(Util.HexStringToByteArray(Util.PB_toLength(picBytes.Length))); //TODO: BodyWriter.Write((byte)0x32); BodyWriter.Write((byte)0x1A); BodyWriter.Write(new byte[] { 0x37, 0x00, 0x4D, 0x00, 0x32, 0x00, 0x25, 0x00, 0x4C, 0x00, 0x31, 0x00, 0x56, 0x00, 0x32, 0x00, 0x7B, 0x00, 0x39, 0x00, 0x30, 0x00, 0x29, 0x00, 0x52, 0x00 }); BodyWriter.BeWrite((ushort)0x3801); BodyWriter.BeWrite((ushort)0x4801); BodyWriter.Write((byte)0x50); BodyWriter.Write(Util.HexStringToByteArray(Util.PB_toLength(width))); //TODO: BodyWriter.Write((byte)0x58); BodyWriter.Write(Util.HexStringToByteArray(Util.PB_toLength(height))); //TODO: BodyWriter.BeWrite((ushort)0x6004); BodyWriter.BeWrite((ushort)0x6A05); BodyWriter.Write(new byte[] { 0x32, 0x36, 0x36, 0x35, 0x36 }); BodyWriter.BeWrite((ushort)0x7000); BodyWriter.BeWrite((ushort)0x7803); BodyWriter.BeWrite((ushort)0x8001); BodyWriter.Write((byte)0x00); }
protected byte[] GenerateBody() { //http://www.mongodb.org/display/DOCS/Mongo+Wire+Protocol#MongoWireProtocol-OPINSERT //int32 ZERO; // 0 - reserved for future use //cstring fullCollectionName; // "dbname.collectionname" //BSON[] documents; // one or more documents to insert into the collection using (var stream = new MemoryStream()) { using (var writer = new BodyWriter(stream)) { writer.Write(0); writer.Write(FullCollectionName); writer.WriteTerminator(); foreach (var document in Documents) { writer.WriteDocument(document); } return(stream.ToArray()); } } }
protected byte[] GenerateBody() { //http://www.mongodb.org/display/DOCS/Mongo+Wire+Protocol#MongoWireProtocol-OPUPDATE //int32 ZERO; // 0 - reserved for future use //cstring fullCollectionName; // "dbname.collectionname" //int32 flags; // bit vector. see below //BSON selector; // the query to select the document //BSON document; // the document data to update with or insert using (var stream = new MemoryStream()) { using (var writer = new BodyWriter(stream)) { writer.Write(0); writer.Write(FullCollectionName); writer.WriteTerminator(); writer.Write((int)Mode); writer.WriteSelector(QuerySelector ?? new object()); writer.WriteDocument(Document); return(stream.ToArray()); } } }
/// <summary> /// 初始化包体 /// </summary> protected override void PutBody() { BodyWriter.Write(new byte[] { 0x00, 0x00, 0x00, 0x07 }); var data = new BinaryWriter(new MemoryStream()); data.Write(new byte[] { 0x03, 0x08, 0x03, 0x22, 0x46, 0x08 }); data.Write(Util.HexStringToByteArray(Util.PB_toLength(_recvGroupQQ))); data.Write((byte)0x10); data.Write( Util.HexStringToByteArray( Util.PB_toLength(Convert.ToInt64(Util.ToHex(MessageTime).Replace(" ", ""), 16)))); data.Write(new byte[] { 0x20, 0x00 }); //数据长度 BodyWriter.BeWrite(data.BaseStream.Length); BodyWriter.Write(new byte[] { 0x08, 0x01, 0x12, 0x03, 0x98, 0x01, 0x00 }); //数据 BodyWriter.Write(data.BaseStream.ToBytesArray()); }
/// <summary> /// 初始化包体 /// </summary> protected override void PutBody() { var pic = new Bitmap(FileName.Content); var width = pic.Size.Width; // 图片的宽度 var height = pic.Size.Height; // 图片的高度 var picBytes = ImageHelper.ImageToBytes(pic); _md5 = QQTea.MD5(picBytes); FileName.Set("Md5", Md5); BodyWriter.Write(new byte[] { 0x00, 0x00, 0x00, 0x07 }); var data = new BinaryWriter(new MemoryStream()); data.Write(new byte[] { 0x10, 0x01, 0x1A, 0x5A, 0x08 }); data.Write(Util.HexStringToByteArray(Util.PB_toLength(Group))); data.Write((byte)0x10); data.Write(Util.HexStringToByteArray(Util.PB_toLength(User.QQ))); data.Write(new byte[] { 0x18, 0x00, 0x22, 0x10 }); data.Write(_md5); data.Write((byte)0x28); data.Write(Util.HexStringToByteArray(Util.PB_toLength(picBytes.Length))); data.Write(new byte[] { 0x32, 0x1a }); data.Write(new byte[] { 0x50, 0x00, 0x42, 0x00, 0x41, 0x00, 0x42, 0x00, 0x52, 0x00, 0x24, 0x00, 0x4d, 0x00, 0x36, 0x00, 0x5f, 0x00, 0x5a, 0x00, 0x32, 0x00, 0x25, 0x00, 0x39, 0x00 }); data.Write(new byte[] { 0x38, 0x01, 0x48, 0x01 }); data.Write((byte)0x50); data.Write(Util.HexStringToByteArray(Util.PB_toLength(width))); data.Write((byte)0x58); data.Write(Util.HexStringToByteArray(Util.PB_toLength(height))); data.Write(new byte[] { 0x60, 0x04, 0x6a, 0x05 }); data.Write(new byte[] { 0x32, 0x36, 0x36, 0x35, 0x32 }); data.Write(new byte[] { 0x70, 0x00, 0x78, 0x03, 0x80, 0x01, 0x00 }); //数据长度 BodyWriter.BeWrite(data.BaseStream.Length); BodyWriter.Write(new byte[] { 0x08, 0x01, 0x12, 0x03, 0x98, 0x01, 0x01 }); //数据 BodyWriter.Write(data.BaseStream.ToBytesArray()); //使用之后释放文件 pic.Dispose(); }
/// <summary> /// 初始化包体 /// </summary> protected override void PutBody() { BodyWriter.Write(new TLV0112().Get_Tlv(User)); BodyWriter.Write(new TLV030F().Get_Tlv(User)); BodyWriter.Write(new TLV0005().Get_Tlv(User)); BodyWriter.Write(new TLV0006().Get_Tlv(User)); BodyWriter.Write(new TLV0015().Get_Tlv(User)); BodyWriter.Write(new TLV001A().Get_Tlv(User)); BodyWriter.Write(new TLV0018().Get_Tlv(User)); BodyWriter.Write(new TLV0103().Get_Tlv(User)); if (_type == Login0X0836Type.Login0X0836686) { BodyWriter.Write(new TLV0110().Get_Tlv(User)); BodyWriter.Write(new TLV0032().Get_Tlv(User)); } BodyWriter.Write(new TLV0312().Get_Tlv(User)); BodyWriter.Write(new TLV0508().Get_Tlv(User)); BodyWriter.Write(new TLV0313().Get_Tlv(User)); BodyWriter.Write(new TLV0102().Get_Tlv(User)); }
/// <summary> /// 初始化包体 /// </summary> protected override void PutBody() { var pbGroupId = Util.HexStringToByteArray(Util.PB_toLength(_groupId)); var pbMessageId = Util.HexStringToByteArray( Util.PB_toLength(Convert.ToInt64(Util.ToHex(_messageId).Replace(" ", ""), 16))); var pbMessageIndex = Util.HexStringToByteArray( Util.PB_toLength(Convert.ToInt64(Util.ToHex(_messageIndex).Replace(" ", ""), 16))); BodyWriter.Write(new byte[] { 0x00, 0x00, 0x00, 0x07 }); var data = new BinaryWriter(new MemoryStream()); data.Write(new byte[] { 0x08, 0x01, 0x10, 0x00, 0x18 }); data.Write(pbGroupId); data.Write(new byte[] { 0x22, 0x09, 0x08 }); data.Write(pbMessageIndex); //消息索引 data.Write((byte)0x10); data.Write(pbMessageId); //消息Id var data_2A = new BinaryWriter(new MemoryStream()); data_2A.Write(new byte[] { 0x08, 0x00 }); var data12 = new BinaryWriter(new MemoryStream()); data12.Write((byte)0x08); data12.Write(pbMessageIndex); //消息索引 data12.Write((byte)0x10); data12.Write(new byte[] { 0x00, 0x18, 0x01, 0x20, 0x00 }); data_2A.Write((byte)0x12); data_2A.Write((byte)data12.BaseStream.Length); data_2A.Write(data12.BaseStream.ToBytesArray()); data.Write((byte)0x2a); data.Write((byte)data_2A.BaseStream.Length); data.Write(data_2A.BaseStream.ToBytesArray()); //数据长度 BodyWriter.BeWrite(data.BaseStream.Length); BodyWriter.Write(new byte[] { 0x08, 0x01, 0x12, 0x03, 0x98, 0x01, 0x00 }); //数据 BodyWriter.Write(data.BaseStream.ToBytesArray()); }
protected override void PutBody() { var myid = Util.HexStringToByteArray(Util.PB_toLength(User.QQ)); var id = Util.HexStringToByteArray(Util.PB_toLength(_toQQ)); BodyWriter.Write(new byte[] { 0x00, 0x00, 0x00 }); BodyWriter.BeWrite(myid.Length + 11); BodyWriter.Write(new byte[] { 0x00, 0x00, 0x00 }); BodyWriter.BeWrite(myid.Length + id.Length + 8); BodyWriter.Write(new byte[] { 0x08, 0x01 }); BodyWriter.Write(new byte[] { 0x12 }); BodyWriter.BeWrite(myid.Length + 7); BodyWriter.Write(new byte[] { 0x08 }); BodyWriter.Write(myid); BodyWriter.Write(new byte[] { 0x10, 0xE3, 0x07, 0x98, 0x01, 0x00 }); BodyWriter.Write(new byte[] { 0x08, 0xE5, 0x0F }); BodyWriter.Write(new byte[] { 0x10, 0x01 }); BodyWriter.Write(new byte[] { 0x22 }); BodyWriter.BeWrite(id.Length + 6); BodyWriter.Write(new byte[] { 0x58 }); BodyWriter.Write(id); BodyWriter.Write(new byte[] { 0x60, 0x92, 0x4E }); BodyWriter.Write(new byte[] { 0x68, 0x01 }); }
/// <summary> /// 初始化包体 /// </summary> protected override void PutBody() { BodyWriter.Write(new byte[] { 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00 }); }