public frmTerminal(MediaFileList afilelist, string anexecutable) : this() { this.executable = anexecutable; if (afilelist != null) { mediafilelist = afilelist; } }
/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void mediafilesTestRunToolStripMenuItem_Click(object sender, EventArgs e) { MediaFileList newlist = new MediaFileList(); foreach (ListViewItem n in listViewFiles.SelectedItems) { string filename = Path.Combine(n.SubItems[Functions.SUBCOL_PATH].Text, n.SubItems[Functions.SUBCOL_FILENAME].Text); Preset preset = presetdata.FindPreset(n.SubItems[Functions.SUBCOL_PRESETNAME].Text); if (preset != null) { newlist.AddMediaFile(filename, preset, n.Index); } } frmTerminal nterm = new frmTerminal(newlist, Config.Settings.FFMPEGFilePath); nterm.Show(); nterm.StartProcessing(); }
/// <summary> /// Fold these in generic... /// Note: Complete presets are stored in the MediaFileList, in case these need to be /// restored on a third party-computer. "Take your Queue to where-ever you want" /// </summary> /// <param name="afilename"></param> /// <param name="filelist"></param> /// <returns></returns> public static bool SerializeMediaFileList(string afilename, MediaFileList filelist) { bool res = false; XmlSerializer nser = new XmlSerializer(typeof(MediaFileList)); TextWriter ntext = new StreamWriter(afilename); try { nser.Serialize(ntext, filelist); ntext.Flush(); res = true; } catch { res = false; } finally { ntext.Dispose(); } return res; }
/// <summary> /// Loads a pre-existing mediafile/queue into the mediafile object. /// </summary> /// <param name="afilename"></param> public void LoadMediaFileList(string afilename) { if (File.Exists(afilename)) { try { this.mediafilelist = Functions.DeserializeMediaFileList(afilename); // Add new presets, where necessary... if (mediafilelist != null) { foreach (MediaFile f in mediafilelist.Items) { Preset internalpreset = f.Preset; if (this.presetdata.FindPresetIndex(internalpreset) == -1) { this.presetdata.AddPreset(internalpreset); } } } } catch (Exception ex) { MessageBox.Show(ex.Message); } } }