public void RefreshList(bool doClear) { string arg = VideoUnit.GetUnitsJSON(VideoUnit.GetUnits()); string command = string.Format("{0}('{1}')", (doClear ? "fillWithClear" : "fill"), arg); this.webView.ExecuteScript(command); }
void btRun_Click(object sender, EventArgs e) { VideoUnit = new VideoUnit(Path.GetDirectoryName(this.txVideoFile.Text) + "\\") { video = this.txVideoFile.Text, target = this.txSubtFile.Text }; }
protected void CallCompleteEvent() { VideoUnit vu = new VideoUnit(Path.GetFullPath(m_fileVideo)) { video = m_fileVideo, target = m_FileSubtEn, native = m_fileSubtNative }; ReaderForm.FileSelectorInstance.historyListUC1.RefreshList(true); FileSelector.VideoUnit = vu; }
public void AssignFiles() { if (FileSelector.VideoUnit == null) { return; } VideoUnit vu = FileSelector.VideoUnit; AssignFiles(vu.GetPathDOS(vu.video), vu.GetPathDOS(vu.target), vu.GetPathDOS(vu.native), vu.GetPathDOS(vu.lesson)); }
public void OpenVideoUnit(String folder) { Host.Invoke((Action)(() => { try { VideoUnit vu = VideoUnit.GetUnit(folder.Replace(@"/", @"\")); // for exammple System.IO.DirectoryNotFoundException когда удалили директорию FileSelector.VideoUnit = vu; } catch (Exception ex) { MessageBox.Show(ex.Message, Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } })); }
public void OpenLessonUnit(String folder) { // Host.Invoke((Action)(() => // { try { VideoUnit vu = VideoUnit.GetUnit(folder.Replace(@"/", @"\")); // for exammple System.IO.DirectoryNotFoundException когда удалили директорию if (!string.IsNullOrEmpty(vu.lesson)) { SentenceListWithVideo.RunLessson(vu.path + vu.lesson); } } catch (Exception ex) { MessageBox.Show(Application.ProductName, ex.Message, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } // })); }
/// <summary> /// При использовании полагать что может быть исключение /// </summary> /// <param name="path"></param> /// <returns></returns> public static VideoUnit GetUnit(string path) { VideoUnit vu = new VideoUnit(path.Replace(@"\", @"/")); // http://jsonformatter.curiousconcept.com/ "path":"C://Users\\serg\\ string[] allFiles = Directory.GetFiles(path); // когда директория не найдена вернет будет исключение DirectoryNotFoundException (могут быть и другие исключения) vu.video = GetFile(path, CurrentLangInfo.CurrentLangPair.From + ".mp4", allFiles, ".ogv", null); // ogv ... vu.target = GetFile(path, CurrentLangInfo.CurrentLangPair.From + ".srt", allFiles, ".txt", vu.native); // ... sub vu.native = GetFile(path, CurrentLangInfo.CurrentLangPair.To + ".srt", allFiles, ".txt", vu.target); vu.lesson = GetFile(path, ".lesson", allFiles, "", null); vu.img = GetFile(path, "thumb.jpg", allFiles, ".png", null); int startInd = path.LastIndexOf(@"\", path.Length - 2) + 1; vu.title = path.Substring(startInd).TrimEnd('\\'); if (vu.title[4] == '_' && vu.title[7] == '_' && vu.title[10] == '_') // cut part 2014_05_22_ from 2014_05_22_Morocco makes renewable energy progress while the sun shines { vu.title = vu.title.Substring(11); } return(vu); }