public static void LoginIn([MarshalAs(UnmanagedType.LPStr)] string userId, [MarshalAs(UnmanagedType.LPStr)] string password) { API.ThisQQ = long.Parse(userId); InitSdk(userId, password); API.QQ.loginState = (int)API.LoginState.Logining; if (API.UN_Tlv.T143_token_A2 != null && API.QQ.shareKey != null && API.UN_Tlv.T10A_token_A4 != null) { API.reLogin(); } else { API.TClient.SendData(Pack.LoginPackage()); } }
public static bool CheckHeartBeat() { System.Timers.Timer timer = new System.Timers.Timer(); timer.Interval = 18000; //30000 '每5分钟检测一次 timer.Elapsed += CheckHeartBeats; timer.Enabled = true; timer.Start(); done.WaitOne(); Debug.Print("HeartBeat:" + HeartBeatResult.ToString()); if (HeartBeatResult = false) { API.reLogin(); } return(HeartBeatResult); }
public void Disconnected(object sender, EventArgs e) { Console.WriteLine("*** Server disconnected"); API.reLogin(); }