private void playsound() { TrainWord w = Transletors.getTrainerWord(); try { if (File.Exists(w.Url)) { Player.URL = w.Url; Player.controls.play(); } else { ErrorWord.add(new ErrorWord() { id = w.Index, path = w.path, word = w.Word }); } } catch { if (!File.Exists(w.Url)) { ErrorWord.add(new ErrorWord() { id = w.Index, path = w.path, word = w.Word }); } } }
public void LoadErrorList() { StreamReader stream = new StreamReader(workDirrectory + "\\" + "ErrorLoader.txt"); while (!stream.EndOfStream) { string wordError = stream.ReadLine(); ErrorWord word = new ErrorWord(wordError); ErrorWord.add(word); } stream.Close(); }
public int findErrorWords() { int i = 0; foreach (var item in BufferWords) { if (!File.Exists(item.Url)) { i++; ErrorWord.add(new ErrorWord() { id = item.Index, path = item.path, word = item.Word }); } } return(i); }
public void Audio() { string Url = string.Format("https://myefe.ru/data/sw/words/us/{0}/{1}__us_1.mp3", this.Word[0], this.Word); string filename = MainForm.workDirrectory + "\\" + this.Word + ".mp3"; if (File.Exists(filename) == false) { try { client.DownloadFile(Url, filename); ErrorWord er = new ErrorWord() { id = this.Index, word = this.Word, path = this.path }; ErrorWord.remove(er); } catch { AddAudio4(); if (Url == "") { AddAudio2(); if (Url == "") { AddAudio3(); if (Url == "") { ErrorWord er = new ErrorWord() { id = this.Index, word = this.Word, path = this.path }; ErrorWord.add(er); this.Url = ""; return; } } } } } this.Url = filename; }
public string AddAudio(string word) { string Url = string.Format("https://myefe.ru/data/sw/words/us/{0}/{1}__us_1.mp3", word[0], word); string filename = MainForm.workDirrectory + "\\sound\\" + word + ".mp3"; if (File.Exists(filename) == false) { try { client.DownloadFile(Url, filename); } catch { ErrorWord.add(new ErrorWord() { id = this.Index, word = word, path = this.path }); return(""); } } return(filename); }