private void Timer_Listening_Tick(object sender, EventArgs e) { DateTime time6; TimeSpan span; this.Timer_Listening.Interval = 0x3e8; int currentPosition = 0; if (this.TestSection == TestingSection.LISTENING) { currentPosition = this.MP3Player.CurrentPosition; } this.tb_currentpos.Value = currentPosition; this.pb_currentpos.Value = currentPosition; this.tb_currentpos1.Value = currentPosition; this.pb_currentpos1.Value = currentPosition; DateTime time = DateTime.ParseExact(base.lbl_timeremain.Text.ToString(), "mm:ss", null); if (time < DateTime.ParseExact("00:01", "mm:ss", null)) { this.Timer_Listening.Stop(); this.SaveUserAnswers(); if (this.TestSection == TestingSection.LISTENING) { MessageBox.Show("Time over!", "Warning", MessageBoxButtons.OK); this.PartNO++; if (this.PartNO > this.PartCount) { this.PartNO = 0; this.PassageNO = 0; this.QuestionNO = 0; this.TestSection = TestingSection.SPEAKING; this.btn_LoadTest_Click(new Button(), e); } else { this.scoreReport(2); this.PassageNO = 4; this.QuestionNO = 0x11; this.btn_LoadTest_Click(new Button(), e); } return; } if (this.TestSection == TestingSection.READING) { MessageBox.Show("Time over!", "Warning", MessageBoxButtons.OK); this.PassageNO++; if (this.PassageNO <= this.PassageCount) { this.scoreReport(2); this.PreInsertPosition = -1; XMLFileReader reader = new XMLFileReader(@"Tests\" + this.TPONO + @"\Reading\config.xml"); this.RSpiltQuestionNO = int.Parse(reader.GetAttr("//Passage[@NO=" + this.PassageNO + "]/@spiltQuestionNO")); base.lbl_timeremain.Text = reader.GetAttr("//Passage[@NO=" + this.PassageNO + "]/@time"); this.tabf_test.SelectedIndex = READING; this.tabf_Reading.SelectedIndex = RDIRECTION; this.QuestionNO = 0; this.RMaterial = new TPOPassage(RtfReader.getRTF(@"Tests\" + this.TPONO.ToString() + @"\Reading\" + this.PassageNO.ToString() + ".txt").Substring(0xb5), RtfReader.getRTF(@"Explanations\" + this.TPONO.ToString() + @"\Reading\P" + this.PassageNO.ToString() + ".txt").Substring(0xb5)); if (File.Exists(@"Explanations\" + this.TPONO.ToString() + @"\Reading\" + this.ReadingPassageNo.ToString() + ".mp3") && ConstantValues.TPOEXPLANATION[this.TPONO]) { this.bn_readText.Visible = true; this.bn_readText.Enabled = true; } else { this.bn_readText.Visible = false; } this.TestQuestions = new TPOQuestions(RtfReader.getRTF(@"Tests\" + this.TPONO.ToString() + @"\Reading\questions" + this.PassageNO.ToString() + ".txt").Substring(0xb5), "", RtfReader.getRTF(@"Explanations\" + this.TPONO.ToString() + @"\Reading\Q" + this.PassageNO.ToString() + ".txt").Substring(0xb5)); this.QuestionCount = this.TestQuestions.QuestionCount; this.LoadReadingMaterialAndQA(); } else { int num2 = this.TPONO % 10; if (num2 == 0) { num2 = 10; } this.btn_LoadTest_Click(this.BtnLoadTest[10 + num2], e); this.PartNO = 1; this.PassageNO = 1; this.QuestionNO = 0; } } } if (time < DateTime.ParseExact("05:00", "mm:ss", null)) { base.button1.Visible = false; base.lbl_timeremain.Visible = true; this.flash_timer.Start(); } if (time < DateTime.ParseExact("04:45", "mm:ss", null)) { this.flash_timer.Stop(); base.lbl_timeremain.ForeColor = Color.Red; } if (this.TestSection == TestingSection.LISTENING) { int num4; if (this.IsPassageMP3) { if (this.rb_PracticeMode.Checked) { this.ckb_viewSpeakingText.Visible = true; } int length = this.SPictureTimeLines.Length; DateTime time2 = DateTime.ParseExact(this.MP3Player.CurrentPosStr, "mm:ss", null); if (length == 1) { this.pb_ListenScene.Load(Application.StartupPath + @"\Tests\images\" + this.SPicturePaths[0]); this.pb_ListenScene1.Load(Application.StartupPath + @"\Tests\images\" + this.SPicturePaths[0]); } else { for (num4 = 1; num4 < length; num4++) { DateTime time3 = DateTime.ParseExact(this.SPictureTimeLines[num4 - 1], "mm:ss", null); DateTime time4 = DateTime.ParseExact(this.SPictureTimeLines[num4], "mm:ss", null); if ((time3 <= time2) && (time2 <= time4)) { this.pb_ListenScene.Load(Application.StartupPath + @"\Tests\images\" + this.SPicturePaths[num4 - 1]); this.pb_ListenScene1.Load(Application.StartupPath + @"\Tests\images\" + this.SPicturePaths[num4 - 1]); } } DateTime time5 = DateTime.ParseExact(this.SPictureTimeLines[length - 1], "mm:ss", null); if (time2 > time5) { this.pb_ListenScene.Load(Application.StartupPath + @"\Tests\images\" + this.SPicturePaths[length - 1]); this.pb_ListenScene1.Load(Application.StartupPath + @"\Tests\images\" + this.SPicturePaths[length - 1]); } } } else { this.ckb_viewSpeakingText.Visible = false; } if (this.rb_TestMode.Checked && ((this.MP3Player.CurrentPosition + 1) < this.MP3Player.Duration)) { base.btn_preQuestion.Enabled = false; base.btn_preQuestion.BackgroundImage = (Image)this.resmgr.GetObject("ok"); } if (this.MP3Player.CurrentPosition < this.MP3Player.Duration) { this.ckb_ShowAnswer.Visible = false; } else { if (!this.HasClickedNext) { base.btn_nextQuestion.Enabled = true; base.btn_nextQuestion.BackgroundImage = (Image)this.resmgr.GetObject("next1"); } if (this.rb_PracticeMode.Checked) { this.ckb_ShowAnswer.Visible = true; } if (this.QuestionNO > 0) { time6 = DateTime.ParseExact("00:01", "mm:ss", null); span = (TimeSpan)(DateTime.ParseExact(base.lbl_timeremain.Text.ToString(), "mm:ss", null) - time6); base.lbl_timeremain.Text = span.Minutes.ToString().PadLeft(2, '0') + ":" + span.Seconds.ToString().PadLeft(2, '0'); } if (this.QuestionNO >= 1) { Question question = (Question)this.TestQuestions.Questions[this.QuestionNO - 1]; switch (question.QuestionType) { case QuestionType.TABEL: if (!this.ckb_ShowAnswer.Checked) { this.lbl_tableAnswer.Visible = false; break; } this.lbl_tableAnswer.Visible = true; this.lbl_tableAnswer.Text = question.RightAnswersStr; break; case QuestionType.SORT: if (question.QuestionType == QuestionType.SORT) { this.rtb_sumQuestion.Rtf = question.QuestionTitle; this.rtb_sumQuestion.Visible = true; num4 = 0; while ((num4 < question.Answer.Length) && (num4 < this.CkbSummary.Length)) { this.RtbSumAnswersToBeSelected[num4].Visible = true; this.CkbSummary[num4].Visible = true; this.RtbSumAnswersToBeSelected[num4].Rtf = (question.Answer[num4]).ToString(); num4++; } for (num4 = 0; num4 < question.RightAnswers.Length; num4++) { this.RtbSumSelected[num4].Visible = true; } this.Timer_Listening.Stop(); } break; default: for (num4 = 0; (num4 < question.Answer.Length) && (num4 < this.CkbReading.Length); num4++) { this.LRtbAnswers[num4].Visible = true; this.LCkbAnswers[num4].Visible = true; this.LRtbAnswers[num4].Rtf = (question.Answer[num4]).ToString(); } break; } if (this.IsQuestionAfter) { this.tabf_Listening.SelectedIndex = LQUESTIONS; this.LoadListeningQA(); this.IsQuestionAfter = false; } } } } if ((this.TestSection == TestingSection.READING) && (this.CurrentReadingStep >= 1)) { time6 = DateTime.ParseExact("00:01", "mm:ss", null); span = (TimeSpan)(DateTime.ParseExact(base.lbl_timeremain.Text.ToString(), "mm:ss", null) - time6); base.lbl_timeremain.Text = span.Minutes.ToString().PadLeft(2, '0') + ":" + span.Seconds.ToString().PadLeft(2, '0'); } }
private void Timer_Speaking_Tick(object sender, EventArgs e) { DateTime time = new DateTime(); DateTime time2 = new DateTime(); TimeSpan span = new TimeSpan(); DateTime time3 = new DateTime(); string str = ""; if (this.TestSection != TestingSection.SPEAKING) { if (this.TestSection == TestingSection.WRITING) { switch (this.CurrentWritingStep) { case 0: if (!this.HasLoadMP3) { try { this.tabf_test.SelectedIndex = WRITING; this.tabf_writing.SelectedIndex = WDIRECTION; this.MP3Player = new MP3MCI(); str = @"Tests\Direction\writeA1.mp3"; this.MP3Player.FileName = str; this.MP3Player.play(); this.MP3Player.SetVolume(base.tb_sound.Value.ToString()); this.HasLoadMP3 = true; } catch { } } if (this.MP3Player.CurrentPosition >= this.MP3Player.Duration) { this.CurrentWritingStep = 1; this.HasLoadMP3 = false; } break; case 1: if (!this.HasLoadMP3) { try { base.btn_nextQuestion.Enabled = true; base.btn_nextQuestion.BackgroundImage = (Image)this.resmgr.GetObject("next1"); this.tabf_test.SelectedIndex = WRITING; this.tabf_writing.SelectedIndex = WSPEECH; this.MP3Player = new MP3MCI(); str = @"Tests\Direction\writeA2.mp3"; this.MP3Player.FileName = str; this.MP3Player.play(); this.MP3Player.SetVolume(base.tb_sound.Value.ToString()); this.pb_writingScene.Load(Application.StartupPath + @"\Tests\images\WaitPerson.jpg"); this.wpb_speak.Maximum = this.MP3Player.Duration; this.wtb_speak.Maximum = this.MP3Player.Duration; this.HasLoadMP3 = true; } catch { } } this.wpb_speak.Value = this.MP3Player.CurrentPosition; this.wtb_speak.Value = this.MP3Player.CurrentPosition; if (this.MP3Player.CurrentPosition >= this.MP3Player.Duration) { this.CurrentWritingStep = 2; this.HasLoadMP3 = false; } break; case 2: if (!this.HasLoadMP3) { base.btn_nextQuestion.Enabled = true; base.btn_nextQuestion.BackgroundImage = (Image)this.resmgr.GetObject("next1"); base.btn_preQuestion.Enabled = false; base.btn_preQuestion.BackgroundImage = (Image)this.resmgr.GetObject("back"); this.MP3Player.StopT(); this.tabf_test.SelectedIndex = WRITING; this.tabf_writing.SelectedIndex = WINDEPENDENT; this.wrtb_writing2.ReadOnly = true; this.wrtbQuestion2.Rtf = this.WritingQuestions[0]; base.lbl_timeremain.Text = "03:00"; base.lbl_timeremain.ForeColor = SystemColors.ControlText; this.HasLoadMP3 = true; } time = DateTime.ParseExact("00:01", "mm:ss", null); span = (TimeSpan)(DateTime.ParseExact(base.lbl_timeremain.Text.ToString(), "mm:ss", null) - time); base.lbl_timeremain.Text = span.Minutes.ToString().PadLeft(2, '0') + ":" + span.Seconds.ToString().PadLeft(2, '0'); if (DateTime.ParseExact(base.lbl_timeremain.Text.ToString(), "mm:ss", null) <= DateTime.ParseExact("00:00", "mm:ss", null)) { this.CurrentWritingStep = 3; this.HasLoadMP3 = false; } break; case 3: if (!this.HasLoadMP3) { try { if (this.rb_PracticeMode.Checked) { base.btn_preQuestion.Enabled = true; base.btn_preQuestion.BackgroundImage = (Image)this.resmgr.GetObject("back1"); } base.btn_nextQuestion.Enabled = true; base.btn_nextQuestion.BackgroundImage = (Image)this.resmgr.GetObject("next1"); this.tabf_test.SelectedIndex = WRITING; this.tabf_writing.SelectedIndex = WSPEECH; this.MP3Player = new MP3MCI(); base.lbl_timeremain.Text = "20:00"; base.lbl_timeremain.ForeColor = SystemColors.ControlText; str = @"Tests\" + this.TPONO + @"\Writing\Speech.mp3"; this.MP3Player.FileName = str; this.MP3Player.play(); this.MP3Player.SetVolume(base.tb_sound.Value.ToString()); this.wpb_speak.Maximum = this.MP3Player.Duration; this.wtb_speak.Maximum = this.MP3Player.Duration; this.pb_writingScene.Load(Application.StartupPath + @"\Tests\images\write" + this.TPONO.ToString() + ".jpg"); this.HasLoadMP3 = true; } catch { MessageBox.Show("open" + str + "出错!"); } } this.wpb_speak.Value = this.MP3Player.CurrentPosition; this.wtb_speak.Value = this.MP3Player.CurrentPosition; if (this.MP3Player.CurrentPosition >= this.MP3Player.Duration) { this.CurrentWritingStep = 4; this.HasLoadMP3 = false; } break; case 4: if (!this.HasLoadMP3) { try { if (this.rb_PracticeMode.Checked) { base.btn_preQuestion.Enabled = true; base.btn_preQuestion.BackgroundImage = (Image)this.resmgr.GetObject("back1"); } base.btn_nextQuestion.Enabled = true; base.btn_nextQuestion.BackgroundImage = (Image)this.resmgr.GetObject("next1"); this.tabf_test.SelectedIndex = WRITING; this.tabf_writing.SelectedIndex = WINDEPENDENT; this.MP3Player = new MP3MCI(); str = @"Tests\Direction\writeA3.mp3"; this.MP3Player.FileName = str; this.MP3Player.play(); this.MP3Player.SetVolume(base.tb_sound.Value.ToString()); this.wrtb_writing2.ReadOnly = false; this.HasLoadMP3 = true; } catch { MessageBox.Show("open" + str + "出错!"); } } this.wpb_speak.Value = this.MP3Player.CurrentPosition; this.wtb_speak.Value = this.MP3Player.CurrentPosition; if (this.MP3Player.CurrentPosition >= this.MP3Player.Duration) { this.CurrentWritingStep = 5; this.HasLoadMP3 = false; } break; case 5: if (!this.HasLoadMP3) { if (this.rb_PracticeMode.Checked) { base.btn_preQuestion.Enabled = true; base.btn_preQuestion.BackgroundImage = (Image)this.resmgr.GetObject("back1"); } base.btn_nextQuestion.Enabled = true; base.btn_nextQuestion.BackgroundImage = (Image)this.resmgr.GetObject("next1"); this.MP3Player.StopT(); this.tabf_test.SelectedIndex = WRITING; this.tabf_writing.SelectedIndex = WINDEPENDENT; base.lbl_questionNO.Text = "Question 1 of 2"; this.wrtbQuestion2.Rtf = this.WritingQuestions[0]; this.wrtb_writing2.ReadOnly = false; this.lbl_writeDirection.Text = "Directions: You have 20 minutes to plan and write your response. Your response will be judged on the basis of the quality of your writing and on how well your response presents in the lecture and their relationship to the reading passage. Typically, an effective response will be 150 to 225 words.\n Question: Summarize the points made in the lecture, being sure to explain how they cast doubt on specific points made in the reading passage."; base.lbl_timeremain.Text = "20:00"; base.lbl_timeremain.ForeColor = SystemColors.ControlText; this.HasLoadMP3 = true; } time = DateTime.ParseExact("00:01", "mm:ss", null); span = (TimeSpan)(DateTime.ParseExact(base.lbl_timeremain.Text.ToString(), "mm:ss", null) - time); base.lbl_timeremain.Text = span.Minutes.ToString().PadLeft(2, '0') + ":" + span.Seconds.ToString().PadLeft(2, '0'); time3 = DateTime.ParseExact(base.lbl_timeremain.Text.ToString(), "mm:ss", null); this.WriteWritingAnswers("write1.txt", this.wrtb_writing2.Text); if (time3 <= DateTime.ParseExact("00:00", "mm:ss", null)) { this.Timer_Speaking.Stop(); if (MessageBox.Show("Time over", "Warning", MessageBoxButtons.OK) == DialogResult.OK) { this.Timer_Speaking.Start(); } this.CurrentWritingStep = 6; this.HasLoadMP3 = false; } break; case 6: if (!this.HasLoadMP3) { this.MP3Player.StopT(); if (this.rb_PracticeMode.Checked) { base.btn_preQuestion.Enabled = true; base.btn_preQuestion.BackgroundImage = (Image)this.resmgr.GetObject("back1"); } this.WriteWritingAnswers("write1.txt", this.wrtb_writing2.Text); this.tabf_test.SelectedIndex = WRITING; this.tabf_writing.SelectedIndex = WINDEPENDENT; this.lbl_writeDirection.Text = "Directions: Read the question below. You have 30 minutes to plan, write, and revise your essay. Typically, an effective response will contain a minimum of 300 words."; this.wrtb_writing2.Text = ""; this.wrtb_writing2.ReadOnly = false; this.wrtbQuestion2.Rtf = this.WritingQuestions[1]; base.lbl_questionNO.Text = "Question 2 of 2"; base.lbl_timeremain.Text = "30:00"; base.lbl_timeremain.ForeColor = SystemColors.ControlText; this.HasLoadMP3 = true; } this.WriteWritingAnswers("write2.txt", this.wrtb_writing2.Text); time = DateTime.ParseExact("00:01", "mm:ss", null); span = (TimeSpan)(DateTime.ParseExact(base.lbl_timeremain.Text.ToString(), "mm:ss", null) - time); base.lbl_timeremain.Text = span.Minutes.ToString().PadLeft(2, '0') + ":" + span.Seconds.ToString().PadLeft(2, '0'); if (DateTime.ParseExact(base.lbl_timeremain.Text.ToString(), "mm:ss", null) <= DateTime.ParseExact("00:00", "mm:ss", null)) { this.WriteWritingAnswers("write2.txt", this.wrtb_writing2.Text); this.Timer_Speaking.Stop(); if (MessageBox.Show("Time over", "Warning", MessageBoxButtons.OK) == DialogResult.OK) { this.btn_mainmenu_Click(sender, e); } this.CurrentWritingStep = 6; this.HasLoadMP3 = false; } break; } } } else { XMLFileReader reader = new XMLFileReader(@"Tests\" + this.TPONO + @"\Speaking\questions.xml"); string attr = reader.GetAttr("//question[@NO=" + this.QuestionNO + "]/@SpeakingIntro"); string str3 = reader.GetAttr("//question[@NO=" + this.QuestionNO + "]/@SpeakingMP3"); string str4 = reader.GetAttr("//question[@NO=" + this.QuestionNO + "]/@ReadingMP3"); string str5 = reader.GetAttr("//question[@NO=" + this.QuestionNO + "]/@SpeakingQuestion"); string str6 = reader.GetAttr("//question[@NO=" + this.QuestionNO + "]/@BeepPrepare"); string str7 = reader.GetAttr("//question[@NO=" + this.QuestionNO + "]/@BeepSpeak"); switch (this.CurrentSpeakingStep) { case 0: if (!this.HasLoadMP3) { try { this.tabf_test.SelectedIndex = SPEAKING; this.tabf_speaking.SelectedIndex = SDIRECTION; this.MP3Player = new MP3MCI(); str = @"Tests\Direction\Speaking_Introduction.mp3"; this.MP3Player.FileName = str; this.MP3Player.play(); this.MP3Player.SetVolume(base.tb_sound.Value.ToString()); this.HasLoadMP3 = true; this.srtb_introduction.Rtf = this.SpeakingQuestions[this.QuestionNO - 1].ToString(); this.srtb_introduction.Visible = true; this.srtb_timeindicator.Visible = false; this.srtb_timer.Visible = false; this.spb.Visible = false; } catch { MessageBox.Show("open" + str + "出错!"); } } if (this.MP3Player.CurrentPosition >= this.MP3Player.Duration) { this.CurrentSpeakingStep = 1; this.HasLoadMP3 = false; } break; case 1: if (this.CONTINUECLICKED) { if (!this.HasLoadMP3) { try { this.pb_speakingScene.Load(Application.StartupPath + @"\Tests\images\WaitPerson.jpg"); base.lbl_questionNO.Text = "Question " + this.QuestionNO + " of 6"; this.tabf_test.SelectedIndex = SPEAKING; this.tabf_speaking.SelectedIndex = SQUESTION; this.pb_speakingScene.Visible = true; this.srtb_introduction.Visible = false; this.MP3Player = new MP3MCI(); str = string.Concat(new object[] { @"Tests\", this.TPONO, @"\Speaking\", attr }); this.MP3Player.FileName = str; this.MP3Player.play(); this.MP3Player.SetVolume(base.tb_sound.Value.ToString()); this.srtb_timeindicator.Visible = false; this.srtb_timer.Visible = false; this.spb.Visible = false; this.HasLoadMP3 = true; } catch { MessageBox.Show("open" + str + "出错!"); } } if (this.MP3Player.CurrentPosition >= this.MP3Player.Duration) { if ((((this.QuestionNO == 1) || (this.QuestionNO == 2)) || (this.QuestionNO == 5)) || (this.QuestionNO == 6)) { this.CurrentSpeakingStep = 4; } else if ((this.QuestionNO == 3) || (this.QuestionNO == 4)) { this.CurrentSpeakingStep = 2; } this.HasLoadMP3 = false; } } break; case 2: if (!this.HasLoadMP3) { try { this.tabf_test.SelectedIndex = SPEAKING; this.tabf_speaking.SelectedIndex = SQUESTION; this.MP3Player = new MP3MCI(); str = string.Concat(new object[] { @"Tests\", this.TPONO, @"\Speaking\", str4 }); this.MP3Player.FileName = str; this.MP3Player.play(); this.MP3Player.SetVolume(base.tb_sound.Value.ToString()); this.pb_speakingScene.Visible = false; base.lbl_timeremain.Text = "00:45"; this.srtb_timeindicator.Text = "READING TIME"; this.srtb_introduction.Rtf = this.SReadingMaterials[this.QuestionNO - 3]; this.srtb_timer.Text = "00:" + base.lbl_timeremain.Text; this.srtb_introduction.Visible = true; this.srtb_timeindicator.Visible = true; this.srtb_timer.Visible = true; this.spb.Visible = false; this.HasLoadMP3 = true; } catch { MessageBox.Show("open" + str + "出错!"); } } if (this.MP3Player.CurrentPosition >= this.MP3Player.Duration) { this.CurrentSpeakingStep = 3; this.HasLoadMP3 = false; } break; case 3: if (!this.HasLoadMP3) { this.tabf_test.SelectedIndex = SPEAKING; this.tabf_speaking.SelectedIndex = SQUESTION; this.srtb_introduction.Rtf = this.SReadingMaterials[this.QuestionNO - 3]; this.srtb_introduction.Visible = true; this.pb_speakingScene.Visible = false; base.lbl_timeremain.Text = "00:45"; this.srtb_timeindicator.Text = "READING TIME"; this.srtb_timer.Text = "00:" + base.lbl_timeremain.Text; this.srtb_timeindicator.Visible = true; this.srtb_timer.Visible = true; this.spb.Visible = false; this.HasLoadMP3 = true; } time = DateTime.ParseExact("00:01", "mm:ss", null); span = (TimeSpan)(DateTime.ParseExact(base.lbl_timeremain.Text.ToString(), "mm:ss", null) - time); base.lbl_timeremain.Text = span.Minutes.ToString().PadLeft(2, '0') + ":" + span.Seconds.ToString().PadLeft(2, '0'); this.srtb_timeindicator.Text = "READING TIME"; this.srtb_timer.Text = "00:" + base.lbl_timeremain.Text; if (DateTime.ParseExact(base.lbl_timeremain.Text.ToString(), "mm:ss", null) <= DateTime.ParseExact("00:00", "mm:ss", null)) { this.CurrentSpeakingStep = 4; this.HasLoadMP3 = false; } break; case 4: if (!this.HasLoadMP3) { try { this.tabf_test.SelectedIndex = SPEAKING; this.tabf_speaking.SelectedIndex = SQUESTION; this.MP3Player = new MP3MCI(); str = string.Concat(new object[] { @"Tests\", this.TPONO, @"\Speaking\", str3 }); this.MP3Player.FileName = str; this.MP3Player.play(); this.MP3Player.SetVolume(base.tb_sound.Value.ToString()); this.spb.Maximum = this.MP3Player.Duration; if (this.QuestionNO > 2) { this.spb.Visible = true; } else { this.spb.Visible = false; } this.srtb_introduction.Rtf = this.SpeakingQuestions[this.QuestionNO - 1]; if ((this.QuestionNO == 1) || (this.QuestionNO == 2)) { this.srtb_introduction.Visible = true; this.pb_speakingScene.Visible = false; } else { this.srtb_introduction.Visible = false; this.pb_speakingScene.Load(string.Concat(new object[] { Application.StartupPath, @"\Tests\images\speak", this.QuestionNO, ".jpg" })); this.srtb_timeindicator.Visible = false; this.srtb_timer.Visible = false; this.pb_speakingScene.Visible = true; } this.HasLoadMP3 = true; } catch { MessageBox.Show("open" + str + "出错!"); } } this.spb.Value = this.MP3Player.CurrentPosition; if (this.MP3Player.CurrentPosition >= this.MP3Player.Duration) { if ((this.QuestionNO == 1) || (this.QuestionNO == 2)) { this.CurrentSpeakingStep = 6; this.spb.Visible = false; base.lbl_timeremain.Text = "00:15"; this.srtb_timeindicator.Text = "PREPARATION TIME"; this.srtb_timeindicator.Visible = true; this.srtb_timer.Text = "00:" + base.lbl_timeremain.Text; this.srtb_timer.Visible = true; } else { this.CurrentSpeakingStep = 5; } this.HasLoadMP3 = false; } break; case 5: if (!this.HasLoadMP3) { try { this.tabf_test.SelectedIndex = SPEAKING; this.tabf_speaking.SelectedIndex = SQUESTION; this.MP3Player = new MP3MCI(); str = string.Concat(new object[] { @"Tests\", this.TPONO, @"\Speaking\", str5 }); this.spb.Visible = false; this.MP3Player.FileName = str; this.MP3Player.play(); this.MP3Player.SetVolume(base.tb_sound.Value.ToString()); this.srtb_introduction.Rtf = this.SpeakingQuestions[this.QuestionNO - 1]; this.srtb_introduction.Visible = true; this.pb_speakingScene.Visible = false; if ((this.QuestionNO == 3) || (this.QuestionNO == 4)) { base.lbl_timeremain.Text = "00:30"; } else { base.lbl_timeremain.Text = "00:20"; } this.srtb_timeindicator.Text = "PREPARATION TIME"; this.srtb_timeindicator.Visible = true; this.srtb_timer.Text = "00:" + base.lbl_timeremain.Text; this.srtb_timer.Visible = true; this.HasLoadMP3 = true; } catch { MessageBox.Show("open" + str + "出错!"); } } if (this.MP3Player.CurrentPosition >= this.MP3Player.Duration) { this.CurrentSpeakingStep = 6; this.HasLoadMP3 = false; } break; case 6: if (!this.HasLoadMP3) { try { this.tabf_test.SelectedIndex = SPEAKING; this.tabf_speaking.SelectedIndex = SQUESTION; this.MP3Player = new MP3MCI(); str = string.Concat(new object[] { @"Tests\", this.TPONO, @"\Speaking\", str6 }); this.spb.Visible = false; this.MP3Player.FileName = str; this.MP3Player.play(); this.MP3Player.SetVolume(base.tb_sound.Value.ToString()); this.srtb_introduction.Visible = true; this.pb_speakingScene.Visible = false; this.HasLoadMP3 = true; } catch { MessageBox.Show("open" + str + "出错!"); } } if (this.MP3Player.CurrentPosition >= this.MP3Player.Duration) { this.CurrentSpeakingStep = 7; this.HasLoadMP3 = false; } break; case 7: if (!this.HasLoadMP3) { this.tabf_test.SelectedIndex = SPEAKING; this.tabf_speaking.SelectedIndex = SQUESTION; this.srtb_introduction.Visible = true; this.pb_speakingScene.Visible = false; this.HasLoadMP3 = true; } time = DateTime.ParseExact("00:01", "mm:ss", null); span = (TimeSpan)(DateTime.ParseExact(base.lbl_timeremain.Text.ToString(), "mm:ss", null) - time); base.lbl_timeremain.Text = span.Minutes.ToString().PadLeft(2, '0') + ":" + span.Seconds.ToString().PadLeft(2, '0'); this.srtb_timer.Text = "00:" + base.lbl_timeremain.Text; if (DateTime.ParseExact(base.lbl_timeremain.Text.ToString(), "mm:ss", null) <= DateTime.ParseExact("00:00", "mm:ss", null)) { if ((this.QuestionNO == 1) || (this.QuestionNO == 2)) { base.lbl_timeremain.Text = "00:45"; } else { base.lbl_timeremain.Text = "01:00"; } this.srtb_timeindicator.Visible = true; this.srtb_timer.Visible = true; this.srtb_timeindicator.Text = "RESPONSE TIME"; this.srtb_timer.Text = "00:" + base.lbl_timeremain.Text; this.CurrentSpeakingStep = 8; this.HasLoadMP3 = false; } break; case 8: if (!this.HasLoadMP3) { try { this.tabf_test.SelectedIndex = SPEAKING; this.tabf_speaking.SelectedIndex = SQUESTION; this.MP3Player = new MP3MCI(); str = string.Concat(new object[] { @"Tests\", this.TPONO, @"\Speaking\", str7 }); this.MP3Player.FileName = str; this.MP3Player.play(); this.MP3Player.SetVolume(base.tb_sound.Value.ToString()); this.srtb_introduction.Visible = true; this.pb_speakingScene.Visible = false; this.HasLoadMP3 = true; } catch { MessageBox.Show("open" + str + "出错!"); } } if (this.MP3Player.CurrentPosition >= this.MP3Player.Duration) { this.CurrentSpeakingStep = 9; this.HasLoadMP3 = false; } break; case 9: if (!this.HasLoadMP3) { this.tabf_test.SelectedIndex = SPEAKING; this.tabf_speaking.SelectedIndex = SQUESTION; this.MP3Recorder = new MP3Record(); this.MP3Recorder.SetFilePath(string.Concat(new object[] { @"users\", USERNAME, @"\", this.TPONO, @"\SpeakingAnswer", this.QuestionNO, ".wav" })); this.MP3Recorder.Start(); this.srtb_introduction.Visible = true; this.pb_speakingScene.Visible = false; this.HasLoadMP3 = true; } time = DateTime.ParseExact("00:01", "mm:ss", null); span = (TimeSpan)(DateTime.ParseExact(base.lbl_timeremain.Text.ToString(), "mm:ss", null) - time); base.lbl_timeremain.Text = span.Minutes.ToString().PadLeft(2, '0') + ":" + span.Seconds.ToString().PadLeft(2, '0'); this.srtb_timeindicator.Visible = true; this.srtb_timer.Visible = true; this.srtb_timer.Text = "00:" + base.lbl_timeremain.Text; if (DateTime.ParseExact(base.lbl_timeremain.Text.ToString(), "mm:ss", null) <= DateTime.ParseExact("00:00", "mm:ss", null)) { this.CurrentSpeakingStep = 10; this.MP3Recorder.Stop(); this.HasLoadMP3 = false; } break; case 10: if (!this.HasLoadMP3) { if (this.QuestionNO >= 6) { this.TestSection = TestingSection.WRITING; this.btn_LoadTest_Click(new Button(), e); break; } this.QuestionNO++; this.CurrentSpeakingStep = 1; this.srtb_introduction.Visible = false; this.pb_speakingScene.Visible = true; this.srtb_timeindicator.Visible = false; this.srtb_timer.Visible = false; } break; } } }
private void RBtn_nextQuestion(EventArgs e) { if (this.QuestionNO == this.RSpiltQuestionNO) { this.PreInsertPosition = -1; if (this.RSpiltQuestionNO > 0) { this.Timer_Listening.Stop(); if (MessageBox.Show("You have finished all the questions in this passage, and you will go to the NEXT PASSAGE of this READING section.\nBut you CAN return to this passage again", "Information", MessageBoxButtons.OK, MessageBoxIcon.Asterisk) == DialogResult.OK) { this.btn_stopReading_Click(new object(), e); this.ReadingPassageNo = 3; try { this.TRANSUI.Close(); this.EXP.Close(); } catch { } base.btn_continue.Visible = false; this.Timer_Listening.Start(); } } } #region temporarily disabled //this.SaveUserAnswers(); #endregion temporarily disabled if (this.HasReachedEndOfSection()) { if (this.PassageNO < this.PassageCount) { if (MessageBox.Show("You have seen all the questions in this part of the reading section.\nYou may go back and review your answers. As long as there is time remaining, you can check your work\n\nClick on Cancel to continue working.\nClick on OK to go on.\nOnce you leave this part of the reading section, you WILL NOT be able to return to it", "Finish Warning", MessageBoxButtons.OKCancel, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button2) == DialogResult.OK) { this.btn_stopReading_Click(new object(), e); this.ReadingPassageNo = 2; try { this.TRANSUI.Close(); this.EXP.Close(); } catch { } base.btn_continue.Visible = true; this.scoreReport(2); this.Timer_Listening.Stop(); this.PreInsertPosition = -1; this.PassageNO++; this.PartNO++; XMLFileReader reader = new XMLFileReader(@"Tests\" + this.TPONO + @"\Reading\config.xml"); this.RSpiltQuestionNO = int.Parse(reader.GetAttr("//Passage[@NO=" + this.PassageNO + "]/@spiltQuestionNO")); base.lbl_timeremain.Text = reader.GetAttr("//Passage[@NO=" + this.PassageNO + "]/@time"); this.tabf_test.SelectedIndex = READING; this.tabf_Reading.SelectedIndex = RDIRECTION; this.QuestionNO = 0; this.RMaterial = new TPOPassage(RtfReader.getRTF(@"Tests\" + this.TPONO.ToString() + @"\Reading\" + this.PassageNO.ToString() + ".txt").Substring(0xb5), RtfReader.getRTF(@"Explanations\" + this.TPONO.ToString() + @"\Reading\P" + this.PassageNO.ToString() + ".txt").Substring(0xb5)); if (File.Exists(@"Explanations\" + this.TPONO.ToString() + @"\Reading\" + this.ReadingPassageNo.ToString() + ".mp3") && ConstantValues.TPOEXPLANATION[this.TPONO]) { this.bn_readText.Visible = true; this.bn_readText.Enabled = true; } else { this.bn_readText.Visible = false; } this.TestQuestions = new TPOQuestions(RtfReader.getRTF(@"Tests\" + this.TPONO.ToString() + @"\Reading\questions" + this.PassageNO.ToString() + ".txt").Substring(0xb5), "", RtfReader.getRTF(@"Explanations\" + this.TPONO.ToString() + @"\Reading\Q" + this.PassageNO.ToString() + ".txt").Substring(0xb5)); this.QuestionCount = this.TestQuestions.QuestionCount; this.LoadReadingMaterialAndQA(); if (this.rb_PracticeMode.Checked && (MessageBox.Show("Do you want to load the answers you saved last time?", "Warning", MessageBoxButtons.OKCancel, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button2) == DialogResult.OK)) { this.LoadUserAnswer(); } } } else if (MessageBox.Show("You have seen all the questions in the reading section.\nYou may go back and review your answers. As long as there is time remaining, you can check your work\n\nClick on Cancel to continue working.\nClick on OK to go on.\nOnce you leave the reading section, you WILL NOT be able to return to it", "Finish Warning", MessageBoxButtons.OKCancel, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button2) == DialogResult.OK) { this.btn_stopReading_Click(new object(), e); try { this.TRANSUI.Close(); this.EXP.Close(); } catch { } base.btn_continue.Visible = true; int num = this.TPONO % 10; if (num == 0) { num = 10; } this.btn_LoadTest_Click(this.BtnLoadTest[10 + num], e); this.PartNO = 1; this.PassageNO = 1; this.QuestionNO = 0; } } else { this.QuestionNO++; this.LoadReadingMaterialAndQA(); } }
private string scoreReport(int type) { Question question = null; XMLFileReader reader = new XMLFileReader(@"Tests\Direction\Scoring.xml"); int num = 0; int num2 = 0; int num3 = 0; int num4 = 0; for (int i = 0; i < this.TestQuestions.Questions.Count; i++) { question = (Question)this.TestQuestions.Questions[i]; if (question.UserAnswersStr.Equals(question.RightAnswersStr)) { num4 += question.Score; num++; } else if (question.UserAnswersStr.Equals("")) { num3++; } else { num2++; } } string str = ""; if (type == 1) { this.IBTScore = int.Parse(reader.GetAttr("//ScoreSections//Section[@NO=2]//Score[@TestScore='" + num4 + "']//@IBTScore")); return string.Concat(new object[] { "Your score is (total score): ", num4, " Your standard score is (in 30 scores): ", this.IBTScore, "\nRight answered: ", num, " Wrong answered: ", num2, " Not answered: ", num3 }); } if (type == 2) { this.RightAnsweredQuestions = num; this.WrongAnsweredQuestions = num2; this.NotAnsweredQuestions = num3; this.TotalQuestions = this.QuestionCount; this.TotalScore = num4; return str; } if (type != 3) { return str; } int num6 = this.RightAnsweredQuestions + num; int num7 = this.WrongAnsweredQuestions + num2; int num8 = this.NotAnsweredQuestions + num3; int num9 = this.TotalQuestions + this.QuestionCount; int num10 = this.TotalScore + num4; if (this.TestSection == TestingSection.READING) { this.IBTScore = int.Parse(reader.GetAttr("//ScoreSections//Section[@NO=1]//Score[@TestScore='" + num10 + "']//@IBTScore")); } else { this.IBTScore = int.Parse(reader.GetAttr("//ScoreSections//Section[@NO=2]//Score[@TestScore='" + num10 + "']//@IBTScore")); } return string.Concat(new object[] { "Your score is (total score): ", num10, " Your standard score is (in 30 scores): ", this.IBTScore, "\nRight answered: ", num6, " Wrong answered: ", num7, " Not answered: ", num8, " Total question count: ", num9 }); }
public void LoadListeningMaterial() { this.IsPassageMP3 = true; this.tabf_test.SelectedIndex = LISTENING; if (this.ckb_viewSpeakingText.Checked) { this.tabf_Listening.SelectedIndex = LMATERIALS; } else { this.tabf_Listening.SelectedIndex = LMATERIALS1; } this.pb_ListenScene.Image = null; this.pb_ListenScene1.Image = null; if (this.PassageNO <= 1) { this.TestQuestions = new TPOQuestions(RtfReader.getRTF(@"Tests\" + this.TPONO + @"\Listening\questions.rtf"), @"Tests\" + this.TPONO + @"\Listening\questions.xml", ""); } base.lbl_questionNO.Text = "Question " + this.QuestionNO.ToString() + " of 34"; XMLFileReader reader = new XMLFileReader(@"Tests\" + this.TPONO + @"\Listening\questions.xml"); string attr = reader.GetAttr(string.Concat(new object[] { "//part[@NO=", this.PartNO, "]/passage[@NO=", this.PassageNO, "]/@Content" })); this.PassageLastQuestionIndex = int.Parse(reader.GetAttr(string.Concat(new object[] { "//part[@NO=", this.PartNO, "]/passage[@NO=", this.PassageNO, "]/@lastQuestionIndex" }))); this.PartLastPassageIndex = int.Parse(reader.GetAttr("//part[@NO=" + this.PartNO + "]/@lastPassageIndex")); int num = int.Parse(reader.GetAttr("//passage[@NO=" + this.PassageNO + "]/pictures/@pictureCount")); this.SPicturePaths = new string[num]; this.SPictureTimeLines = new string[num]; for (int i = 1; i < (num + 1); i++) { this.SPicturePaths[i - 1] = reader.GetAttr(string.Concat(new object[] { "//passage[@NO=", this.PassageNO, "]/pictures/picture[@NO=", i, "]/@pictureName" })); this.SPictureTimeLines[i - 1] = reader.GetAttr(string.Concat(new object[] { "//passage[@NO=", this.PassageNO, "]/pictures/picture[@NO=", i, "]/@Start" })); } this.loadLRC(string.Concat(new object[] { @"Tests\", this.TPONO, @"\Listening\", reader.GetAttr(string.Concat(new object[] { "//part[@NO=", this.PartNO, "]/passage[@NO=", this.PassageNO, "]/@passageName" })) })); try { this.MP3Player = new MP3MCI(); string str2 = string.Concat(new object[] { @"Tests\", this.TPONO, @"\Listening\", attr }); this.MP3Player.FileName = str2; this.PlayFileName.Text = str2; this.pb_currentpos.Maximum = this.MP3Player.Duration; this.pb_currentpos1.Maximum = this.MP3Player.Duration; this.tb_currentpos.Maximum = this.MP3Player.Duration; this.tb_currentpos1.Maximum = this.MP3Player.Duration; this.MP3Player.play(); this.MP3Player.SetVolume(base.tb_sound.Value.ToString()); this.Timer_Listening.Start(); this.IsPassageMP3 = true; } catch { MessageBox.Show("open出错!"); } }
private void btn_LoadTest_Click(object sender, EventArgs e) { this.rtb_writinganswers.Text = ""; try { for (int i = 1; i < 0x1c; i++) { string path = @"users\" + USERNAME + @"\" + i.ToString(); if (!Directory.Exists(path)) { Directory.CreateDirectory(path); } } this.InitialParas(); this.flash_timer.Stop(); Button button = (Button)sender; string name = button.Name; if (name.Contains("Reading")) { this.TestSection = TestingSection.READING; } if (name.Contains("Listening")) { this.TestSection = TestingSection.LISTENING; } if (name.Contains("Speaking")) { this.TestSection = TestingSection.SPEAKING; } if (name.Contains("Writing")) { this.TestSection = TestingSection.WRITING; } if (name.Contains("Review")) { this.TestSection = TestingSection.REVIEW; } if (name.Contains("Answer")) { this.TestSection = TestingSection.VIEWANSWERS; } if (this.TPONO <= 0) { this.TPONO = Convert.ToInt16(name.Substring(name.Length - 2)) + ((this.CurrentTPOPage - 1) * 10); } if (this.PartNO <= 0) { this.PartNO = 1; } if (this.PassageNO <= 0) { this.PassageNO = 1; } if (!ConstantValues.TPOACTIVED[this.TPONO]) { if (MessageBox.Show("The TPO" + this.TPONO.ToString() + " is not actived yet, Do you want to buy the product?", "Warning", MessageBoxButtons.OKCancel, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1) == DialogResult.OK) { Process.Start("http://item.taobao.com/item.htm?id=12627161348"); new RegisterForm().Show(); } this.TPONO = 0; this.PartNO = 0; this.PassageNO = 0; this.QuestionNO = 0; } else if (this.CheckFileConsistence()) { base.btn_continue.Enabled = true; base.btn_continue.Visible = true; this.BottonsStatus(); this.rb_PracticeMode.Visible = false; this.rb_TestMode.Visible = false; if (this.rb_PracticeMode.Checked) { base.lbl_mode.Text = "PRACTICE MODE"; } else { base.lbl_mode.Text = "TEST MODE"; } XMLFileReader reader = new XMLFileReader(); switch (this.TestSection) { case TestingSection.READING: this.Timer_Listening.Start(); this.lbl_testingSection.Visible = true; this.lbl_testingSection.Text = "Reading Section"; base.lbl_timeremain.ForeColor = SystemColors.ControlText; base.lbl_timeremain.Text = "20:00"; this.ReadingPassageNo = 1; this.QuestionNO = 0; this.tabf_test.SelectedIndex = READING; this.tabf_Reading.SelectedIndex = RDIRECTION; reader = new XMLFileReader(@"Tests\" + this.TPONO + @"\Reading\config.xml"); this.RSpiltQuestionNO = int.Parse(reader.GetAttr("//Passage[@NO=" + this.PassageNO + "]/@spiltQuestionNO")); this.PassageCount = int.Parse(reader.GetAttr("//@passageCount")); base.lbl_timeremain.Text = reader.GetAttr("//Passage[@NO=" + this.PassageNO + "]/@time"); this.RMaterial = new TPOPassage(RtfReader.getRTF(@"Tests\" + this.TPONO.ToString() + @"\Reading\" + this.PassageNO.ToString() + ".txt").Substring(0xb5), RtfReader.getRTF(@"Explanations\" + this.TPONO.ToString() + @"\Reading\P" + this.PassageNO.ToString() + ".txt").Substring(0xb5)); if (!File.Exists(@"Explanations\" + this.TPONO.ToString() + @"\Reading\" + this.ReadingPassageNo.ToString() + ".mp3") || !ConstantValues.TPOEXPLANATION[this.TPONO]) { goto Label_0597; } this.bn_readText.Visible = true; this.bn_readText.Enabled = true; goto Label_05A6; case TestingSection.LISTENING: { this.lbl_testingSection.Visible = true; base.btn_nextQuestion.Enabled = false; base.btn_nextQuestion.BackgroundImage = (Image)this.resmgr.GetObject("next"); base.btn_preQuestion.Enabled = false; base.btn_preQuestion.BackgroundImage = (Image)this.resmgr.GetObject("ok"); base.lbl_timeremain.ForeColor = SystemColors.ControlText; base.lbl_timeremain.Text = "10:00"; this.lbl_testingSection.Text = "Listening Section"; reader = new XMLFileReader(@"Tests\" + this.TPONO + @"\Listening\questions.xml"); this.PartCount = int.Parse(reader.GetAttr("//parts/@partCount")); string attr = reader.GetAttr("//passage[@NO=" + 2 + "]/pictures/picture/@pictureName"); base.lbl_timeremain.Text = reader.GetAttr("//part[@NO=" + this.PartNO + "]/@timeLimitation"); this.TimeLimitation = DateTime.ParseExact(reader.GetAttr("//part[@NO=" + this.PartNO + "]/@timeLimitation"), "mm:ss", null); this.QuestionCount = int.Parse(reader.GetAttr("//part[@NO=" + this.PartNO + "]/@questionCount")); this.tabf_test.SelectedIndex = LISTENING; this.tabf_Listening.SelectedIndex = LDIRECTION1; if (this.PassageNO <= 1) { this.TestQuestions = new TPOQuestions(RtfReader.getRTF(@"Tests\" + this.TPONO.ToString() + @"\Listening\questions.rtf"), @"Tests\" + this.TPONO.ToString() + @"\Listening\questions.xml", ""); } string str4 = reader.GetAttr("//part[@NO=" + this.PartNO + "]/@partDirection"); try { this.MP3Player = new MP3MCI(); string str5 = string.Concat(new object[] { @"Tests\", this.TPONO, @"\Listening\", str4 }); this.MP3Player.FileName = str5; this.PlayFileName.Text = str5; this.pb_currentpos.Maximum = this.MP3Player.Duration; this.pb_currentpos1.Maximum = this.MP3Player.Duration; this.tb_currentpos.Maximum = this.MP3Player.Duration; this.tb_currentpos1.Maximum = this.MP3Player.Duration; this.MP3Player.play(); this.MP3Player.SetVolume(base.tb_sound.Value.ToString()); this.Timer_Listening.Start(); } catch { MessageBox.Show("open出错!"); } break; } case TestingSection.SPEAKING: this.lbl_testingSection.Visible = true; this.lbl_testingSection.Text = "Speaking Section"; base.btn_nextQuestion.Visible = false; base.btn_preQuestion.Visible = false; this.LoadSpeakingQuestion(); this.tabf_test.SelectedIndex = SPEAKING; this.tabf_speaking.SelectedIndex = SDIRECTION; this.QuestionNO = 1; this.CurrentSpeakingStep = 0; this.Timer_Speaking.Start(); break; case TestingSection.WRITING: this.Timer_Listening.Start(); this.lbl_testingSection.Visible = true; base.btn_nextQuestion.Enabled = false; base.btn_nextQuestion.BackgroundImage = (Image)this.resmgr.GetObject("next"); base.lbl_timeremain.ForeColor = SystemColors.ControlText; base.lbl_timeremain.Text = "03:00"; this.lbl_testingSection.Text = "Writing Section"; base.lbl_questionNO.Text = "Question 1 of 2"; this.LoadWritingQuestion(); this.tabf_test.SelectedIndex = WRITING; this.tabf_writing.SelectedIndex = WDIRECTION; this.CurrentWritingStep = 0; this.Timer_Speaking.Start(); break; case TestingSection.REVIEW: { this.rb_TestMode.Checked = true; int index = this.TPONO % 10; if (index == 0) { index = 10; } this.btn_LoadTest_Click(this.BtnLoadTest[index], e); break; } case TestingSection.VIEWANSWERS: base.btn_continue.Visible = false; this.ReportingScores(); this.tabf_test.SelectedIndex = USERANSWERS; this.btn_NexPage.Visible = false; this.btn_LastPage.Visible = false; base.btn_mainmenu.Visible = true; break; } } return; Label_0597: this.bn_readText.Visible = false; Label_05A6: ; this.TestQuestions = new TPOQuestions(RtfReader.getRTF(@"Tests\" + this.TPONO.ToString() + @"\Reading\questions" + this.PassageNO.ToString() + ".txt").Substring(0xb5), "", RtfReader.getRTF(@"Explanations\" + this.TPONO.ToString() + @"\Reading\Q" + this.PassageNO.ToString() + ".txt").Substring(0xb5)); this.QuestionCount = this.TestQuestions.QuestionCount; this.LoadReadingMaterialAndQA(); if (this.rb_PracticeMode.Checked && (MessageBox.Show("Do you want to load the answers you saved last time?", "Warning", MessageBoxButtons.OKCancel, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button2) == DialogResult.OK)) { this.LoadUserAnswer(); } } catch (Exception exception) { MessageBox.Show(exception.StackTrace); } }
private void Antuorization() { int num; ISACTIVED = true; string str = "1B3F1E4B5F1B3F5F80300206A7"; Encode encode = new Encode(); string hardDiskID = encode.GetHardDiskID(); string cPUID = encode.GetCPUID(); str = str + encode.GetSHA1MachineCode(hardDiskID + cPUID); for (num = 0; num < 0x18; num++) { ConstantValues.TPOACTIVED[num] = false; ConstantValues.TPOEXPLANATION[num] = false; } XMLFileReader reader = new XMLFileReader("license.xml"); for (num = 1; num < 0x1c; num++) { string attr = reader.GetAttr("//licenses/license[@name='TPO" + num.ToString() + "']/@value"); try { string str5 = encode.Decode(attr); if (str5.Contains(str + "TPO" + num.ToString())) { ConstantValues.TPOACTIVED[num] = true; } if (str5.Contains("EXP")) { ConstantValues.TPOEXPLANATION[num] = true; } } catch { } } ConstantValues.TPOACTIVED[1] = true; ConstantValues.TPOACTIVED[0x12] = true; ConstantValues.TPOEXPLANATION[1] = true; ConstantValues.TPOEXPLANATION[0x12] = true; }
public void ReportingScores() { DataRow row; string str4; string str5; string str6; string str7; string str8; Exception exception; DataTable table = new DataTable(); DataColumn column = new DataColumn("QuestionID", typeof(string)); table.Columns.Add(column); column = new DataColumn("QuestionType", typeof(string)); table.Columns.Add(column); column = new DataColumn("MyAnswer", typeof(string)); table.Columns.Add(column); column = new DataColumn("StandardAnswer", typeof(string)); table.Columns.Add(column); column = new DataColumn("QuestionStatus", typeof(string)); table.Columns.Add(column); column = new DataColumn("QuestionScore", typeof(string)); table.Columns.Add(column); string str = string.Concat(new object[] { Application.StartupPath, @"\users\", USERNAME, @"\", this.TPONO, @"\Reading" }); string str2 = ""; int num = 0; string path = ""; Stream stream = null; StreamReader reader = null; int num2 = 0; int num3 = 0; int num4 = 0; int num5 = 0; int num6 = 0; int num7 = 0; for (int i = 1; i < 3; i++) { path = str + i.ToString() + ".txt"; if (File.Exists(path)) { num = 0; try { stream = File.Open(path, FileMode.Open, FileAccess.Read); reader = new StreamReader(stream); while (!reader.EndOfStream) { num++; str2 = reader.ReadLine(); if (num >= 2) { row = table.NewRow(); str4 = str2.Substring(0, 15).TrimEnd(new char[0]); str5 = str2.Substring(15, 15).TrimEnd(new char[0]); str6 = str2.Substring(30, 15).TrimEnd(new char[0]); str7 = str2.Substring(0x2d, 15).TrimEnd(new char[0]); str8 = str2.Substring(60, 15).TrimEnd(new char[0]); row["QuestionID"] = str4; row["QuestionType"] = str5; row["MyAnswer"] = str6; row["StandardAnswer"] = str7; row["QuestionScore"] = str8; if (str6.Equals("")) { row["QuestionStatus"] = "Not Answered"; } else { row["QuestionStatus"] = "Answered"; } table.Rows.Add(row); if (str6.Equals(str7)) { num2++; num4 += Convert.ToInt16(str8); num5 += Convert.ToInt16(str8); } else { if (str6.Equals("")) { num6++; } else { num3++; } num5 += Convert.ToInt16(str8); } } } if (reader != null) { reader.Close(); } if (stream != null) { stream.Close(); } } catch (Exception exception1) { exception = exception1; if (reader != null) { reader.Close(); } if (stream != null) { stream.Close(); } } } } this.dgv_readinganswers.DataSource = table; XMLFileReader reader2 = new XMLFileReader(@"Tests\Direction\Scoring.xml"); num7 = int.Parse(reader2.GetAttr("//ScoreSections//Section[@NO=1]//Score[@TestScore='" + num4 + "']//@IBTScore")); string str9 = string.Concat(new object[] { "Your score is (total score): ", num4, " Your standard score is (in 30 scores): ", num7, "\nRight answered: ", num2, " Wrong answered: ", num3, " Not answered: ", num6 }); this.lbl_readingscorereport.Text = str9; DataTable table2 = new DataTable(); column = new DataColumn("QuestionID", typeof(string)); table2.Columns.Add(column); column = new DataColumn("QuestionType", typeof(string)); table2.Columns.Add(column); column = new DataColumn("MyAnswer", typeof(string)); table2.Columns.Add(column); column = new DataColumn("StandardAnswer", typeof(string)); table2.Columns.Add(column); column = new DataColumn("QuestionStatus", typeof(string)); table2.Columns.Add(column); column = new DataColumn("QuestionScore", typeof(string)); table2.Columns.Add(column); num = 0; path = string.Concat(new object[] { Application.StartupPath, @"\users\", USERNAME, @"\", this.TPONO, @"\Listening.txt" }); num2 = 0; num3 = 0; num4 = 0; num5 = 0; num6 = 0; num7 = 0; if (File.Exists(path)) { try { stream = File.Open(path, FileMode.Open, FileAccess.Read); reader = new StreamReader(stream); while (!reader.EndOfStream) { num++; str2 = reader.ReadLine(); if (num >= 2) { row = table2.NewRow(); str4 = str2.Substring(0, 15).TrimEnd(new char[0]); str5 = str2.Substring(15, 15).TrimEnd(new char[0]); str6 = str2.Substring(30, 15).TrimEnd(new char[0]); str7 = str2.Substring(0x2d, 15).TrimEnd(new char[0]); str8 = str2.Substring(60, 15).TrimEnd(new char[0]); row["QuestionID"] = str4; row["QuestionType"] = str5; row["MyAnswer"] = str6; row["StandardAnswer"] = str7; row["QuestionScore"] = str8; if (str6.Equals("")) { row["QuestionStatus"] = "Not Answered"; } else { row["QuestionStatus"] = "Answered"; } table2.Rows.Add(row); if (str6.Equals(str7)) { num2++; num4 += Convert.ToInt16(str8); num5 += Convert.ToInt16(str8); } else { if (str6.Equals("")) { num6++; } else { num3++; } num5 += Convert.ToInt16(str8); } } } if (reader != null) { reader.Close(); } if (stream != null) { stream.Close(); } } catch (Exception exception2) { exception = exception2; if (reader != null) { reader.Close(); } if (stream != null) { stream.Close(); } } } num7 = int.Parse(reader2.GetAttr("//ScoreSections//Section[@NO=2]//Score[@TestScore='" + num4 + "']//@IBTScore")); str9 = string.Concat(new object[] { "Your score is (total score): ", num4, " Your standard score is (in 30 scores): ", num7, "\nRight answered: ", num2, " Wrong answered: ", num3, " Not answered: ", num6 }); this.lbl_listeningScorereport.Text = str9; this.dgv_listeninganswers.DataSource = table2; num = 0; path = string.Concat(new object[] { Application.StartupPath, @"\users\", USERNAME, @"\", this.TPONO, @"\Writing1.txt" }); if (File.Exists(path)) { try { stream = File.Open(path, FileMode.Open, FileAccess.Read); reader = new StreamReader(stream); while (!reader.EndOfStream) { num++; str2 = reader.ReadToEnd(); this.rtb_writinganswers.Text = str2; } if (reader != null) { reader.Close(); } if (stream != null) { stream.Close(); } } catch (Exception exception3) { exception = exception3; if (reader != null) { reader.Close(); } if (stream != null) { stream.Close(); } } } }
public void LoadUserAnswer() { XMLFileReader reader = new XMLFileReader(); string path = string.Concat(new object[] { Application.StartupPath, @"\users\", USERNAME, @"\", this.TPONO }); if (this.TestSection == TestingSection.READING) { path = path + @"\Reading" + this.PartNO.ToString() + ".txt"; } else { path = path + @"\Listening.txt"; } string str2 = ""; Stream stream = null; StreamReader reader2 = null; try { int num = 0; stream = File.Open(path, FileMode.Open, FileAccess.Read); reader2 = new StreamReader(stream); while (!reader2.EndOfStream) { num++; str2 = reader2.ReadLine(); if (num >= 2) { Question question = (Question)this.TestQuestions.Questions[num - 2]; string str3 = str2.Substring(30, 15).TrimEnd(new char[0]); question.UserAnswers.Clear(); for (int i = 0; i < str3.Length; i++) { char ch = str3.ToCharArray()[i]; int num3 = ch; question.UserAnswers.Add(num3 - 0x40); } } } if (reader2 != null) { reader2.Close(); } if (stream != null) { stream.Close(); } } catch (Exception) { if ((reader2 != null) && (reader2 != null)) { reader2.Close(); } if ((stream != null) && (stream != null)) { stream.Close(); } } }