private void check_User() { if (this.tb_userName.Text.Length > 0) { Exception exception; try { StudentServiceModel model = new StudentServiceModel();//new StudentService().getStudent(this.tb_userName.Text, "~!{#$@cdf3}"); if (false && model.version != 4) { MessageBox.Show("版本太低,请从新下载最新的版本"); //Application.Exit(); } else if (true || model != null) { if (false && model.starttime.ToString() == "0001/1/1 0:00:00") { MessageBox.Show("没有该堂考试信息。。。"); //Application.Exit(); } else { TimeSpan span = (TimeSpan)(model.currenttime - model.starttime); TimeSpan span2 = (TimeSpan)(model.endtime - model.currenttime); if (false && span2.Minutes < 0) { MessageBox.Show("考试时间已过请联系管理员。。。"); //Application.Exit(); } else if (false && span.Minutes < 0) { MessageBox.Show("未到考试时间。。。"); //Application.Exit(); } else { //StudentModel.isReGeneration = model.isregeneration; //StudentModel.studentNumber = model.studentnumber; //StudentModel.mac = model.mac; //StudentModel.chooseNumber = model.choosenumber; //StudentModel.gapfillingNumber = model.gapfillingnumber; //StudentModel.calculationNumber = model.calculationnumber; //StudentModel.endTime = model.endtime; //StudentModel.examCode = model.examcode; //StudentModel.grade = model.grade; //StudentModel.startTime = model.starttime; //StudentModel.status = model.status; //StudentModel.studentName = model.studentname; //StudentModel.studentClass = model.studentclass; StudentModel.isReGeneration = true; StudentModel.studentNumber = "02166407"; StudentModel.mac = "FF:FF:FF:FF:FF:FF"; StudentModel.chooseNumber = generateChoice(); //"ChapterOne_25,3,2,1,4,|ChapterTwo_9,1,4,2,3,|ChapterThree_3,3,1,4,2,|ChapterFour_11,4,2,1,3,|ChapterFive_3,4,1,2,3,|"; StudentModel.gapfillingNumber = generateGapFilling(); //"g_four_1.xml|g_one_2.xml|g_five_1.xml|g_six_1.xml|g_two_2_6.xml|"; StudentModel.calculationNumber = generateCal(); //"c8.xml|c1.xml|c3.xml|c10.xml|"; StudentModel.endTime = DateTime.Now.AddDays(1); StudentModel.examCode = 2; StudentModel.grade = 0; StudentModel.startTime = DateTime.Now.AddDays(-1); StudentModel.status = 0; StudentModel.studentName = "AMFairy"; StudentModel.studentClass = "NEU Mathe"; if (true || (StudentModel.mac.Length == 0) || ((StudentModel.mac == new GetMacAddress().getmac()) && (StudentModel.status == 1))) { string str2; string str3; string str = "temp"; SupportTools.DirectoryIsExist("temp"); SupportTools.DirectoryIsExist("temp/generate"); SupportTools.DirectoryIsExist("temp/UA"); if (!StudentModel.isReGeneration) { str2 = StudentModel.examCode + "/" + StudentModel.studentNumber; str3 = "Parameter.zip"; try { UploadAndDownload.DownloadFile(str2, str3); Zip.Extract("./" + str + "/" + str3, "./", 0x400); UploadAndDownload.DownloadFile(str2, "Answer.zip"); Zip.Extract("./" + str + "/Answer.zip", "./", 0x400); } catch (Exception) { try { UploadAndDownload.DownloadFile(str2, str3); Zip.Extract("./" + str + "/" + str3, "./", 0x400); UploadAndDownload.DownloadFile(str2, "AnswerCopy.zip"); Zip.Extract("./" + str + "/AnswerCopy.zip", "./", 0x400); } catch (Exception exception2) { exception = exception2; MessageBox.Show("试卷还原的参数下载失败"); } } } List <string> list = new List <string>(); List <string> list2 = new List <string>(); foreach (string str4 in StudentModel.chooseNumber.Split(new char[] { '|' }, StringSplitOptions.RemoveEmptyEntries)) { string[] strArray2 = str4.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries); list.Add(strArray2[0]); string[] strArray3 = strArray2[0].Split(new char[] { '_' }); list2.Add(strArray3[0]); } try { MessageBox.Show("即将开始考试,请耐心等待试卷生成"); for (int j = 0; j < list.Count; j++) { str2 = list2[j]; str3 = list[j] + ".zip"; UploadAndDownload2.DownloadFile(str2, str3); } } catch (Exception exception3) { exception = exception3; MessageBox.Show("从服务器上下载文件失败\r\n" + exception.Message); } for (int i = 0; i < list.Count; i++) { str2 = list2[i]; Zip.Extract("./temp/" + (list[i] + ".zip"), "./temp", 0x400); } new Origination().Show(); base.Hide(); } else { MessageBox.Show("在另外一台机器上登陆了。。。"); //Application.Exit(); } } } } else { MessageBox.Show("输入的学号不存在或不在考试时间范围内"); //Application.Exit(); } } catch (Exception exception4) { exception = exception4; if (exception.Message.Contains("System.Number.ParseInt32")) { MessageBox.Show("未安排你的考试"); } else { MessageBox.Show("连接服务器错误。。。" + exception.Message); } //Application.Exit(); } } else { MessageBox.Show("请输入学号"); } }