public HtmlGenerator(HtmlConfig config) { myConfig = config; htmlPath = config.GetHtmlFullPath(); }
private void DoAnalysis() { MaoriObj word = GetSelectedMaoriObj(MaoriObjType.Word); PaConfig config = new PaConfig() { currentWord = word.Name, AnnieDir = ResMan.GetAnnieDir(), batFilePath = ResMan.GetAnnieDir() + "\\Process.bat", audioList = recordedWavFiles }; PaEngine engine = new PaEngine(config); if (engine.wavFilesOK()) { // The Main thread will wait until the process finishes engine.Start(); //listBoxREC.Items.Add(engine.GetRecognizedWord()); listREC.Add(engine.GetRecognizedWord()); RefreshListRecBox(); //copies the user recording files to the HTML report resource folder HtmlConfig hConfig = new HtmlConfig(systemIO.GetAppDataDir(allUsers.getCurrentUser())); ResMan.SuperCopy(CurrentVoicePath, hConfig.GetRecPath(listREC.Count, HtmlConfig.pathType.fullUserRecPath), true); //prepare to copy the sample recording file to the HTML report res folder //make sure the sample recording is different from each other string soundToPlay = null; int counter = 0; do { counter += 1; soundToPlay = ResMan.GetWordSound(GetAudioSource(), word.WordSoundId, true); if (soundToPlay == null) break; } while ((soundToPlay == lastPlayedSound) && (counter < 255)); lastPlayedSound = soundToPlay; //copies the sample recording files to the HTML res folder ResMan.SuperCopy(soundToPlay, hConfig.GetRecPath(listREC.Count, HtmlConfig.pathType.fullSampleRecPath), true); //change the UI buttonShowReport.Enabled = true; ReportPath = engine.GetReportPath(); } ResetRecordings(); }
private void buttonPlayUserRecording_Click(object sender, EventArgs e) { HtmlConfig fileLocator = new HtmlConfig(systemIO.GetAppDataDir(allUsers.getCurrentUser())); if (listBoxREC.Items.Count == 0) return; if (listBoxREC.SelectedItem == null) return; string targetSoundPath = fileLocator.GetRecPath(listBoxREC.SelectedIndex + 1, HtmlConfig.pathType.fullUserRecPath); if (File.Exists(targetSoundPath)) ResMan.PlaySound(targetSoundPath, false); }
private void buttonShowReport_Click(object sender, EventArgs e) { MaoriObj word = GetSelectedMaoriObj(MaoriObjType.Word); HtmlConfig hConfig = new HtmlConfig(systemIO.GetAppDataDir(allUsers.getCurrentUser())) { myWord = word.Name, correctnessValue = GetUserScore() }; if ((listREC != null) && (listREC.Count > 0)) hConfig.listRecognized = listREC.ToList(); HtmlGenerator htmlWriter = new HtmlGenerator(hConfig); htmlWriter.Run(); // Show the HTML file in system browser ReportPath = hConfig.GetHtmlFullPath(); if (File.Exists(ReportPath)) systemIO.ShowInBrowser(ReportPath); else buttonShowReport.Enabled = false; }