Ejemplo n.º 1
0
        private void Comment_Load(object sender, EventArgs e)
        {
            //int successCNT = 0;

            Root_1 root_Now = new Root_1();

            var Detail_Now = new Root_2();

            //this.Text = Handle_Question.task.taskName;

            //if (!Directory.Exists(Hack_tmpFilePath)) Directory.CreateDirectory(Hack_tmpFilePath);


            ////LoginInstance loginInstance = new LoginInstance();
            ////AddColumn("ID", 50);
            ////AddColumn("Phone", 200);
            ////AddColumn("Name", 150);
            if (File.Exists(Path.Combine(Path_Hack, "phone_vaild.txt")))
            {
                try
                {
                    using (StreamReader streamReader = new StreamReader(Path.Combine(Path_Hack, "phone_vaild.txt")))
                    {
                        PhoneNumberAndOwner = JsonConvert.DeserializeObject <Dictionary <string, string> >(streamReader.ReadToEnd());
                    }
                }
                catch (Exception)
                {
                    throw;
                }
            }
            else
            {
                MessageBox.Show("未获取到PhoneList");

                main.Show();
                this.Dispose();
            }
            ////this.listView1.BeginUpdate();   //数据更新,UI暂时挂起,直到EndUpdate绘制控件,可以有效避免闪烁并大大提高加载速度
            if (PhoneNumberAndOwner == null)
            {
                throw new Exception("Phone是空的");
            }
            foreach (var item in PhoneNumberAndOwner)
            {
                Phones.Add(item.Key);
            }
            //foreach (var item in Phones)
            //{
            //    puppets_1.Add(Login(item));

            //    puppets_2.Add(GetDetail());
            //}
            for (int i = 0; i < Phones.Count; i++)
            {
                puppets_1.Add(Login(Phones[i]));
                puppets_2.Add(GetDetail(puppets_1[i].data.andToken));
            }
            if (puppets_1.Count == Phones.Count && puppets_2.Count == Phones.Count)
            {
                MessageBox.Show("傀儡安装完毕!个数:" + Phones.Count.ToString());
            }
            //MessageBox.Show(Phones.Count.ToString());
        }
Ejemplo n.º 2
0
        private void HomeworkHacker_Load(object sender, EventArgs e)
        {
            int    successCNT = 0;
            Root_1 root_Now   = new Root_1();

            var Detail_Now = new Root_2();

            this.Text = Handle_Question.task.taskName;

            if (!Directory.Exists(Hack_tmpFilePath))
            {
                Directory.CreateDirectory(Hack_tmpFilePath);
            }
            ////LoginInstance loginInstance = new LoginInstance();
            ////AddColumn("ID", 50);
            ////AddColumn("Phone", 200);
            ////AddColumn("Name", 150);
            if (File.Exists(Path.Combine(Path_Hack, "phone_vaild.txt")))
            {
                try
                {
                    using (StreamReader streamReader = new StreamReader(Path.Combine(Path_Hack, "phone_vaild.txt")))
                    {
                        PhoneNumberAndOwner = JsonConvert.DeserializeObject <Dictionary <string, string> >(streamReader.ReadToEnd());
                    }
                }
                catch (Exception)
                {
                    throw;
                }
            }
            else
            {
                MessageBox.Show("未获取到PhoneList");

                main.Show();
                this.Dispose();
            }
            ////this.listView1.BeginUpdate();   //数据更新,UI暂时挂起,直到EndUpdate绘制控件,可以有效避免闪烁并大大提高加载速度
            if (PhoneNumberAndOwner == null)
            {
                throw new Exception("Phone是空的");
            }
            foreach (var item in PhoneNumberAndOwner)
            {
                Phones.Add(item.Key);
            }
            //for (int i = 0; i < PhoneNumberAndOwner.Count; i++)   //添加10行数据
            //{
            //    ListViewItem lvi = new ListViewItem();

            //    lvi.ImageIndex = i;     //通过与imageList绑定,显示imageList中第i项图标

            //    lvi.Text = i.ToString();

            //    //lvi.SubItems.Add("第2列,第" + i + "行");
            //    lvi.SubItems.Add(Phones[i]);

            //    lvi.SubItems.Add(PhoneNumberAndOwner[Phones[i]]);

            //    //this.listView1.Items.Add(lvi);
            //}

            //this.listView1.EndUpdate();  //结束数据处理,UI界面一次性绘制。
            //if(File.Exists())
            foreach (var item in Phones)
            {
                var Root = Helper.Login(item);

                Token = Root.data.andToken;

                var Detail = Helper.GetDetail(Token);

                stuId = Detail.data.stuId.ToString();

                ClassId = Detail.data.classId.ToString();

                System.Net.WebClient WebClientObj = new System.Net.WebClient();

                System.Collections.Specialized.NameValueCollection PostVars = new System.Collections.Specialized.NameValueCollection();

                PostVars.Add("token", Token);

                PostVars.Add("stuId", stuId);

                PostVars.Add("classId", ClassId);

                PostVars.Add("taskId", TaskId);

                WebClientObj.Encoding = Encoding.UTF8;

                string sRemoteInfo = string.Empty;

                byte[] byRemoteInfo = WebClientObj.UploadValues("http://xxzy.xinkaoyun.com:8081/holidaywork/student/getMutualTaskInfo?0.17584490646948914", "POST", PostVars);

                sRemoteInfo = System.Text.Encoding.UTF8.GetString(byRemoteInfo);

                JsonSerializerSettings jsonSerializerSettings = new JsonSerializerSettings();

                jsonSerializerSettings.NullValueHandling = NullValueHandling.Ignore;

                var Tmp_Root = JsonConvert.DeserializeObject <Root>(sRemoteInfo);

                if (Tmp_Root.msg != "获取互评作业详细信息成功")
                {
                    continue;
                }

                else if (Tmp_Root.msg == "获取互评作业详细信息成功")
                {
                    successCNT++;

                    root_Now = Root;

                    Detail_Now = Detail;

                    Handle_Root = Tmp_Root;

                    break;
                }

                //if (!File.Exists(Path.Combine(tmpFilePath, listView1.SelectedItems[0].Index.ToString() + ".html")))
                //{
                //    if (!Directory.Exists(tmpFilePath)) Directory.CreateDirectory(tmpFilePath);
                //    using (StreamWriter streamWriter = new StreamWriter(File.Create(Path.Combine(tmpFilePath, listView1.SelectedItems[0].Index.ToString() + ".html")), Encoding.UTF8))
                //    {
                //        streamWriter.Write(questions.data[listView1.SelectedItems[0].Index].teaTitle);
                //    }
                //}
                //webBrowser1.Url = Tmp_Root.data[listBox1.SelectedIndex].teaTitle;
                //msg = 获取互评作业详细信息成功
            }

            if (successCNT > 0)
            {
                MessageBox.Show($"题目预加载成功!现在用的账号是:{root_Now.data.realName}-----{Detail_Now.data.userName}");
                for (int i = 0; i < Handle_Root.data.Count; i++)
                {
                    listBox1.Items.Add("题目:" + (i + 1).ToString());
                }
            }
            else
            {
                MessageBox.Show("可能您的小伙伴作业还没有写完,暂时不能提供答案", "啊欧~Sorry!");
                return;
            }
        }