private void TM_VoteCheck_Tick(object sender, EventArgs e) { TM_VoteCheck.Stop(); TM_VoteCheck.Interval = 600000; Log("Checking if I need to vote..."); LBL_Status.Text = "Checking if I need to vote..."; if (File.Exists("LastVote")) { try { StreamReader reader = new StreamReader("LastVote"); string lastVote = reader.ReadLine(); if (DateTime.Parse(lastVote).AddHours(12) < DateTime.Now) { Vote(false); } else { string type = " Hours"; int nextVote = DateTimeCeil(DateTime.Parse(lastVote).AddHours(12) - DateTime.Now, new TimeSpan(1, 0, 0)).Hour; if (nextVote == 1) { type = " Minutes"; nextVote = DateTimeCeil(DateTime.Parse(lastVote).AddHours(12) - DateTime.Now, new TimeSpan(0, 1, 0)).Minute; } if (nextVote == 1) { type = " Secondes"; nextVote = DateTimeCeil(DateTime.Parse(lastVote).AddHours(12) - DateTime.Now, new TimeSpan(0, 0, 1)).Second; } Log("No need to vote. Next vote in " + nextVote + type + ". Waiting."); LBL_Status.Text = "I don't need to vote. Next vote in " + nextVote + type + ". Waiting..."; TM_VoteCheck.Start(); } reader.Close(); } catch { Log("[WARNING] LastVote file is corrupted, deleting it..."); LBL_Status.Text = "LastVote file is corrupted, deleting it..."; File.Delete("LastVote"); Log("Success !"); Vote(false); } } else { Vote(false); } }
private void EnableDisable() { if (!enabled) { Log("Enabling."); enabled = true; BT_EnableDisable.Text = "Disable"; TM_VoteCheck.Interval = 10; TM_VoteCheck.Start(); } else { Log("Disabling."); enabled = false; if (voting) { WB_Main.Navigate("https://heroes-wow.com/wotlk/"); } currentSite = 0; BT_EnableDisable.Text = "Enable"; LBL_Status.Text = "Ready !"; TM_VoteCheck.Stop(); } }
private void TM_VoteProcess_Tick(object sender, EventArgs e) { TM_VoteProcess.Stop(); WB_Main.AllowNavigation = true; switch (currentSite) { case 1: currentSite++; InternetSetCookie("http://heroes-wow.com", "HTTP_REFERER", "http%3A%2F%2Fwww.top100arena.com%2Fout.asp%3Fid%3D44752"); WB_Main.Navigate("https://heroes-wow.com/wotlk/execute.php?take=vote&site=2"); break; case 2: currentSite++; InternetSetCookie("http://heroes-wow.com", "HTTP_REFERER", "http%3A%2F%2Fwww.openwow.com%2Fvisit%3D2125"); WB_Main.Navigate("https://heroes-wow.com/wotlk/execute.php?take=vote&site=3"); break; case 3: currentSite++; InternetSetCookie("http://heroes-wow.com", "HTTP_REFERER", "http%3A%2F%2Fwww.rpg-paradize.com%2Fsite-Heroes%2BWoW%2B548%2Band%2B335a%2B255%2BLevel-22237"); WB_Main.Navigate("https://heroes-wow.com/wotlk/execute.php?take=vote&site=4"); break; case 4: currentSite++; InternetSetCookie("http://heroes-wow.com", "HTTP_REFERER", "http%3A%2F%2Ftopg.org%2Fserver-heroes-wow-id347987"); WB_Main.Navigate("https://heroes-wow.com/wotlk/execute.php?take=vote&site=5"); break; case 5: currentSite++; InternetSetCookie("http://heroes-wow.com", "HTTP_REFERER", "http%3A%2F%2Fwww.wowstatus.net%2F%7Ewowstatus%2Fserverlist%2Fout%2Fid%2F725206%2Flink%2Fhomepage"); WB_Main.Navigate("https://heroes-wow.com/wotlk/execute.php?take=vote&site=6"); break; case 6: currentSite += 2; InternetSetCookie("http://heroes-wow.com", "HTTP_REFERER", "http%3A%2F%2Ftopwow.ru%2Findex.php"); WB_Main.Navigate("https://heroes-wow.com/wotlk/execute.php?take=vote&site=8"); break; case 8: currentSite += 2; InternetSetCookie("http://heroes-wow.com", "HTTP_REFERER", "http%3A%2F%2Fwww.wowtop.es%2Findex.php"); WB_Main.Navigate("https://heroes-wow.com/wotlk/execute.php?take=vote&site=10"); break; case 10: currentSite++; InternetSetCookie("http://heroes-wow.com", "HTTP_REFERER", "http%3A%2F%2Fwww.gowonda.com%2Fserveur-wow-4956-Heroes-WoW-5.4.8-and-3.3.5a-255-Level.htm"); WB_Main.Navigate("https://heroes-wow.com/wotlk/execute.php?take=vote&site=11"); break; case 11: Log("Successfully voted !"); LBL_Status.Text = "Successfully voted !"; voting = false; currentSite = 0; if (!File.Exists("LastVote")) { File.Create("LastVote").Close(); } StreamWriter writer = new StreamWriter("LastVote"); writer.Write(DateTime.Now); writer.Close(); TM_VoteCheck.Start(); WB_Main.Navigate("http://heroes-wow.com/wotlk/"); break; } }