public static void reLogin() { if (UN_Tlv.T143_token_A2 != null && QQ.shareKey != null && UN_Tlv.T10A_token_A4 != null) { var timestampHex = ((DateTime.Now.ToUniversalTime().Ticks - 621355968000000000) / 10000000).ToString(); QQ.login_Time = HexStrToByteArray(int.Parse(timestampHex).ToString("X")); var timestamp = long.Parse(Convert.ToInt64(DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1)).TotalMilliseconds).ToString().Substring(0, 10)); SyncCoookies SyncTimeStruct = new SyncCoookies { timestamp1 = timestamp, timestamp2 = timestamp, timestamp3 = timestamp, Field3 = 805979870, Field4 = 3344460674, Field5 = 82343012, Field6 = 3281833389, Field7 = 2696570484, Field8 = 81, Field10 = 0 }; using (var ms = new MemoryStream()) { Serializer.Serialize(ms, SyncTimeStruct); QQ.SyncCoookies = ms.ToArray(); } if (TClient.IsConnected() == false) { TClient = new TCPIPClient(Dns.GetHostEntry("msfwifi.3g.qq.com").AddressList[0].ToString(), 8080); } TClient.SendData(Pack.PackOnlineStatus("StatSvc.register", 1)); } }
public static void UploadFriendPicByTCP(long sendQQ, byte[] uKey, string Ip, int Port) { var TcpClient = new TCPIPClient(Ip, Port); byte[] SendBytes = null; int UploadLen = 0; var TempFileBytes = API.FileBytes; byte[] PBBytes = null; UploadFriendPicStruct UploadPicBytes = new UploadFriendPicStruct(); while (TempFileBytes.Length > 0) { if (TempFileBytes.Length >= 8192) { SendBytes = TempFileBytes.Take(8192).ToArray(); } else { SendBytes = TempFileBytes; } UploadPicBytes = new UploadFriendPicStruct { UploadFriendPicSendInfo = new UploadFriendPicSendInfos { amout = 1, sendQQ = sendQQ.ToString(), SendCmd = "PicUp.DataUp", RaqId = (new Random()).Next(90000, 99999), field5 = 0, appId = 537061440, sendSize = 4096, flag = 1 }, UploadFriendPicFileInfo = new UploadFriendPicFileInfos { fileSize = API.FileBytes.Length, uploadSize = UploadLen, sendSize = SendBytes.Length, uKey = uKey, sendFileHash = API.MD5Hash(SendBytes), TotalHash = API.FileHash } }; using (var ms = new MemoryStream()) { Serializer.Serialize(ms, UploadPicBytes); Debug.Print("上传好友图片:" + "\r\n" + BitConverter.ToString(ms.ToArray()).Replace("-", " ")); PBBytes = ms.ToArray(); } var bytes = new byte[] { 0x28 }; bytes = bytes.Concat(BitConverter.GetBytes(PBBytes.Length).Reverse().ToArray()).ToArray(); bytes = bytes.Concat(BitConverter.GetBytes(SendBytes.Length).Reverse().ToArray()).ToArray(); bytes = bytes.Concat(PBBytes).ToArray(); bytes = bytes.Concat(SendBytes).ToArray(); bytes = bytes.Concat(new byte[] { 0x29 }).ToArray(); Debug.Print("上传好友图片打包:" + "\r\n" + BitConverter.ToString(bytes).Replace("-", " ")); TcpClient.SendData(bytes); TempFileBytes = TempFileBytes.Skip(SendBytes.Length).ToArray(); UploadLen = UploadLen + SendBytes.Length; } Debug.Print("上传好友图片完成."); }