/// <summary> /// 動画、画像の順でループして表示させます /// </summary> /// <param name="video_path">表示する動画のGamesRootからの相対パス</param> /// <param name="panel_paths">表示する画像のGamesRootからの相対パス</param> /// <exception cref="ArgumentException">パスがnull</exception> public void SetMedia(string video_path, string[] panel_paths) { if (video_path == null || panel_paths == null) { throw new ArgumentException(); } displayMediaElement.Source = null; timer?.Close(); timer = null; currentContents.Clear(); contentCounter = 0; if (video_path != "") { currentContents.Add(new Content(new Uri(PathManage.GAMES_ROOT_PATH + "\\" + video_path, UriKind.Relative), ContentType.Video)); } foreach (var item in panel_paths) { if (item == "") { continue; } Uri temp; try { temp = new Uri(PathManage.GAMES_ROOT_PATH + "\\" + item, UriKind.Relative); } catch (FileNotFoundException e) { Logger.Inst.Log(e + "Panel not found.", LogLevel.Error); continue; } currentContents.Add(new Content(temp, ContentType.Image)); } PlayContent(); }
/*********************************************************************/ /// <summary> /// /// </summary> public bool Output(string outFile) { try { InstantTimer t = new InstantTimer(); System.IO.StreamWriter file; using (file = new System.IO.StreamWriter(outFile, false)) { foreach (S19Line line in SRecordLines) { string outLine = line.ToString(); file.WriteLine(outLine); } } file.Close(); //SRecordizer.LogIt(LogView.LogType.Info, "Saved File \'" + outFile + "\' Ok! (Time = " + t.Stop() +" ms)"); /* update the file name to the new file name - will match for save, but not for save as */ FileInfo fi = new FileInfo(outFile); _FileName = fi.Name; return(true); } catch { ExceptionTrap.Trap("Error writing S19 file. Your changes have not been saved!"); return(false); } }
/*********************************************************************/ /// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void checkS19ToolStripMenuItem_Click(object sender, EventArgs e) { /* get the active S19 open record and perform the check */ SRecordView activeDoc = (SRecordView)dockPanel.ActiveDocument; if (activeDoc != null) { InstantTimer t = new InstantTimer(); activeDoc.CheckFile(); //SRecordizer.LogIt(LogView.LogType.Info, "Checked " + activeDoc.Text + " Ok! (Time = " + t.Stop() + " ms)"); } }
private void PlayContent() { if (currentContents.Count == 0) { return; } current = currentContents[contentCounter]; contentCounter = contentCounter == currentContents.Count - 1 ? 0 : contentCounter + 1; displayMediaElement.Dispatcher.BeginInvoke(new Action(() => { displayMediaElement.Source = current.uri; if (!GameProcessControl.Inst.IsRunning) { displayMediaElement.Play(); } })); if (current.contentType == ContentType.Image) { timer = new InstantTimer(NEXT_IMAGE_TIME, PlayContent); } }