private void bn_remove_Click(object sender, EventArgs e) { if (ActiveEvent == null) { return; } int position = vMixEvents.IndexOf(ActiveEvent); donotredraw = true; vMixEvents.Remove(ActiveEvent); ActiveEvent = null; EventList.VirtualListSize = vMixEvents.Count; EventList.SelectedIndices.Clear(); if (position >= vMixEvents.Count) { position--; } if (position >= 0) { EventList.SelectedIndices.Add(position); } RebuildTimetable(); donotredraw = false; UpdateDisplay(); }
private void bn_add_audio_Click(object sender, EventArgs e) { OpenFileDialog ofd = new OpenFileDialog(); ofd.Multiselect = true; if (ofd.ShowDialog() == System.Windows.Forms.DialogResult.OK) { foreach (string file in ofd.FileNames) { vMixEvent new_event = ParseAudioData(file); if (new_event != null) { new_event.EventTransition = new_event.TransitionTypeFromString(lb_transition.Text); new_event.EventTransitionTime = (int)ud_transition_time.Value; int position; if (ActiveEvent != null) position = vMixEvents.IndexOf(ActiveEvent) + 1; else position = vMixEvents.Count; vMixEvents.Insert(position, new_event); ActiveEvent = new_event; EventList.VirtualListSize = vMixEvents.Count; EventList.SelectedIndices.Clear(); RebuildTimetable(); EventList.SelectedIndices.Add(position); UpdateDisplay(); } } } }
private void bn_load_Click(object sender, EventArgs e) { OpenFileDialog ofd = new OpenFileDialog(); ofd.Filter = "XML-Files|*.xml|all Files|*.*"; if (ofd.ShowDialog() == System.Windows.Forms.DialogResult.OK) { List <vMixEvent> vmes = new List <vMixEvent> (); XmlDocument d = new XmlDocument(); d.Load(ofd.FileName); foreach (XmlNode n in d.SelectNodes("//vMixManager//Events//Event")) { vmes.Add(new vMixEvent(n)); } if (vmes.Count > 0) { vmes.Sort(delegate(vMixEvent e1, vMixEvent e2) { return(e1.EventStart.CompareTo(e2.EventStart)); }); donotredraw = true; EventList.SelectedIndices.Clear(); ActiveEvent = null; vMixEvents = vmes; EventList.VirtualListSize = vmes.Count; dtp_timetable.Value = vmes[0].EventStart; RebuildTimetable(); UpdateDisplay(); donotredraw = false; MessageBox.Show(vMixEvents.Count.ToString() + " events loaded from xml.", "Success!", MessageBoxButtons.OK, MessageBoxIcon.Information); } } }
private void bn_add_audio_Click(object sender, EventArgs e) { OpenFileDialog ofd = new OpenFileDialog(); ofd.Multiselect = true; if (ofd.ShowDialog() == System.Windows.Forms.DialogResult.OK) { foreach (string file in ofd.FileNames) { vMixEvent new_event = ParseAudioData(file); if (new_event != null) { new_event.EventTransition = new_event.TransitionTypeFromString(lb_transition.Text); new_event.EventTransitionTime = (int)ud_transition_time.Value; int position; if (ActiveEvent != null) { position = vMixEvents.IndexOf(ActiveEvent) + 1; } else { position = vMixEvents.Count; } vMixEvents.Insert(position, new_event); ActiveEvent = new_event; EventList.VirtualListSize = vMixEvents.Count; EventList.SelectedIndices.Clear(); RebuildTimetable(); EventList.SelectedIndices.Add(position); UpdateDisplay(); } } } }
private void bn_add_manual_Click(object sender, EventArgs e) { vMixEvent new_event = new vMixEvent(vmEventType.manual, dtp_timetable.Value, new TimeSpan(1, 0, 0)); if (new_event != null) { new_event.EventTransition = new_event.TransitionTypeFromString(lb_transition.Text); new_event.EventTransitionTime = (int)ud_transition_time.Value; int position; if (ActiveEvent != null) { position = vMixEvents.IndexOf(ActiveEvent) + 1; } else { position = vMixEvents.Count; } vMixEvents.Insert(position, new_event); ActiveEvent = new_event; EventList.VirtualListSize = vMixEvents.Count; EventList.SelectedIndices.Clear(); RebuildTimetable(); EventList.SelectedIndices.Add(position); UpdateDisplay(); } }
private void bn_clear_Click(object sender, EventArgs e) { EventList.SelectedIndices.Clear(); donotredraw = true; ActiveEvent = null; vMixEvents.Clear(); EventList.VirtualListSize = 0; UpdateDisplay(); donotredraw = false; }
private vMixEvent ParseVideoData(string path) { vMixEvent new_event = null; string infotext = path; FileInfo.Open(path); string result = FileInfo.Get(StreamKind.General, 0, "Video_Format_List"); if (result != "") { infotext += "\r\nVideo: " + result; result = FileInfo.Get(StreamKind.General, 0, "Audio_Format_List"); if (result != "") { infotext += "\r\nAudio: " + result; } double milliseconds = -1; TimeSpan duration = new TimeSpan(0); result = FileInfo.Get(StreamKind.General, 0, "Duration"); CultureInfo cult = CultureInfo.CreateSpecificCulture("en-GB"); if (result != "" && double.TryParse(result, NumberStyles.Float | NumberStyles.AllowDecimalPoint, cult, out milliseconds)) { duration = new TimeSpan(0, 0, 0, 0, (int)milliseconds); infotext += "\r\nDuration: " + duration.ToString(@"hh\:mm\:ss"); } else { MessageBox.Show("I can't decode this files duration!", "No Duration?", MessageBoxButtons.OK, MessageBoxIcon.Warning); } new_event = new vMixEvent(System.IO.Path.GetFileNameWithoutExtension(path), path, vmEventType.video, dtp_timetable.Value, new TimeSpan(0), duration, duration, true, vmTransitionType.cut, 1000, true); new_event.EventInfoText = infotext; } else { MessageBox.Show("I can't recognize the video format!", "No Video?", MessageBoxButtons.OK, MessageBoxIcon.Error); } FileInfo.Close(); return(new_event); }
public ListViewItem EventListItem(vMixEvent vmixevent) { string[] caption = { vmixevent.Title, vmixevent.EventStart.ToString("MM-dd HH:mm:ss"), vmixevent.EventDuration.ToString(@"hh\:mm\:ss"), vmixevent.EventTypeString(), vmixevent.EventPath }; ListViewItem lvi = new ListViewItem(caption); lvi.ToolTipText = vmixevent.EventInfoText; return lvi; }
private void bn_schedule_Click(object sender, EventArgs e) { if (vMixEvents.Count == 0) { return; } DateTime start = vMixEvents[0].EventStart; DateTime end = vMixEvents[vMixEvents.Count - 1].EventEnd; string datafolder = Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) + "\\vMixScheduler"; if (!System.IO.Directory.Exists(datafolder)) { System.IO.Directory.CreateDirectory(datafolder); } string schedulename = datafolder + "\\vMixSchedule.xml"; List <vMixEvent> vmes = new List <vMixEvent>(); XmlDocument d = new XmlDocument(); if (System.IO.File.Exists(schedulename)) { d.Load(schedulename); foreach (XmlNode n in d.SelectNodes("//vMixManager//Events//Event")) { vMixEvent vme = new vMixEvent(n); if (vme.EventStart > DateTime.Now && (vme.EventStart < start || vme.EventStart > end)) { vmes.Add(vme); } } d = new XmlDocument(); } vmes.AddRange(vMixEvents); vmes.Sort(delegate(vMixEvent e1, vMixEvent e2) { return(e1.EventStart.CompareTo(e2.EventStart)); }); XmlNode root = d.CreateElement("vMixManager"); d.AppendChild(root); XmlNode events = d.CreateElement("Events"); root.AppendChild(events); foreach (vMixEvent vme in vmes) { events.AppendChild(vme.ToXMLNode(d)); } d.Save(schedulename); MessageBox.Show("Events scheduled.", "Success!", MessageBoxButtons.OK, MessageBoxIcon.Information); }
public ListViewItem EventListItem(vMixEvent vmixevent) { string[] caption = { vmixevent.Title, vmixevent.EventStart.ToString("MM-dd HH:mm:ss"), vmixevent.EventDuration.ToString(@"hh\:mm\:ss"), vmixevent.EventTypeString(), vmixevent.EventPath }; ListViewItem lvi = new ListViewItem(caption); lvi.ToolTipText = vmixevent.EventInfoText; return(lvi); }
private void bn_add_photos_Click(object sender, EventArgs e) { FolderBrowserDialog fbd = new FolderBrowserDialog(); if (fbd.ShowDialog() == System.Windows.Forms.DialogResult.OK) { string path = fbd.SelectedPath; TimeSpan ts = new TimeSpan(0, 3, 0); vMixEvent new_event = new vMixEvent(System.IO.Path.GetFileName(path), path, vmEventType.photos, dtp_timetable.Value, new TimeSpan(0), ts, ts, false, vmTransitionType.fade, 500, false); if (new_event != null) { new_event.EventTransition = new_event.TransitionTypeFromString(lb_transition.Text); new_event.EventTransitionTime = (int)ud_transition_time.Value; new_event.SlideshowInterval = (int)ud_slideshow_interval.Value; new_event.SlideshowTransition = new_event.TransitionTypeFromString(lb_slideshow_transition.Text); new_event.SlideshowTransitionTime = (int)ud_slideshow_transition.Value; new_event.EventInfoText = "slideshow"; int position; if (ActiveEvent != null) { position = vMixEvents.IndexOf(ActiveEvent) + 1; } else { position = vMixEvents.Count; } vMixEvents.Insert(position, new_event); ActiveEvent = new_event; EventList.VirtualListSize = vMixEvents.Count; EventList.SelectedIndices.Clear(); RebuildTimetable(); EventList.SelectedIndices.Add(position); UpdateDisplay(); } } }
public vMixEvent(vMixEvent e) { Title = e.Title; EventPath = e.EventPath; EventType = e.EventType; EventStart = e.EventEnd; EventInPoint = e.EventInPoint; MediaDuration = e.MediaDuration; EventDuration = e.EventDuration; KeepDuration = e.KeepDuration; EventTransition = e.EventTransition; EventTransitionTime = e.EventTransitionTime; EventLooping = e.EventLooping; SlideshowInterval = e.SlideshowInterval; SlideshowTransition = e.SlideshowTransition; SlideshowTransitionTime = e.SlideshowTransitionTime; EventInfoText = e.EventInfoText; }
private void EventList_SelectedIndexChanged(object sender, EventArgs e) { ActiveEvent = null; if (EventList.SelectedIndices.Count > 0) { ActiveEvent = vMixEvents[EventList.SelectedIndices[0]]; bn_move_up.Enabled = (EventList.SelectedIndices[0] > 0); bn_move_down.Enabled = (EventList.SelectedIndices[0] < vMixEvents.Count - 1); bn_remove.Enabled = true; } else { bn_move_up.Enabled = false; bn_move_down.Enabled = false; bn_remove.Enabled = true; } UpdateDisplay(); }
private void bn_clone_Click(object sender, EventArgs e) { if (ActiveEvent == null) { return; } int position = vMixEvents.IndexOf(ActiveEvent) + 1; donotredraw = true; vMixEvent copy = new vMixEvent(ActiveEvent); vMixEvents.Insert(position, copy); ActiveEvent = copy; EventList.VirtualListSize = vMixEvents.Count; EventList.SelectedIndices.Clear(); EventList.SelectedIndices.Add(position); RebuildTimetable(); donotredraw = false; UpdateDisplay(); }
private void bn_add_black_Click(object sender, EventArgs e) { vMixEvent new_event = new vMixEvent (vmEventType.black, dtp_timetable.Value,new TimeSpan (0,0,10)); if (new_event != null) { new_event.EventTransition = new_event.TransitionTypeFromString(lb_transition.Text); new_event.EventTransitionTime = (int)ud_transition_time.Value; int position; if (ActiveEvent != null) position = vMixEvents.IndexOf(ActiveEvent) + 1; else position = vMixEvents.Count; vMixEvents.Insert(position, new_event); ActiveEvent = new_event; EventList.VirtualListSize = vMixEvents.Count; EventList.SelectedIndices.Clear(); RebuildTimetable(); EventList.SelectedIndices.Add(position); UpdateDisplay(); } }
private vMixEvent ParseImageData(string path) { vMixEvent new_event = null; string infotext = path; FileInfo.Open(path); string result = FileInfo.Get(StreamKind.General, 0, "Video_Format_List"); if (result != "JPEG") { result = FileInfo.Get(StreamKind.General, 0, "Image_Format_List"); } if (result != "") { infotext += "\r\nImage: " + result; TimeSpan duration = new TimeSpan(0, 0, 10); new_event = new vMixEvent(System.IO.Path.GetFileNameWithoutExtension(path), path, vmEventType.image, dtp_timetable.Value, new TimeSpan(0), duration, duration, false, vmTransitionType.cut, 1000, true); new_event.EventInfoText = infotext; } else { MessageBox.Show("I can't recognize the image format!", "No Image?", MessageBoxButtons.OK, MessageBoxIcon.Error); } FileInfo.Close(); return(new_event); }
private void RebuildTimetable() { if (vMixEvents.Count == 0) { return; } DateTime nextstart = dtp_timetable.Value; for (int i = 0; i < vMixEvents.Count; i++) { vMixEvent e = vMixEvents [i]; if (i > 0) { nextstart -= new TimeSpan(0, 0, 0, 0, e.EventTransitionTime); } if (e.EventStart != nextstart) { e.EventStart = nextstart; } nextstart += e.EventDuration; } EventList.RedrawItems(0, vMixEvents.Count - 1, false); }
private void bn_add_photos_Click(object sender, EventArgs e) { FolderBrowserDialog fbd = new FolderBrowserDialog(); if (fbd.ShowDialog() == System.Windows.Forms.DialogResult.OK) { string path = fbd.SelectedPath; TimeSpan ts = new TimeSpan(0, 3, 0); vMixEvent new_event = new vMixEvent(System.IO.Path.GetFileName (path), path, vmEventType.photos, dtp_timetable.Value, new TimeSpan(0), ts, ts, false, vmTransitionType.fade, 500, false); if (new_event != null) { new_event.EventTransition = new_event.TransitionTypeFromString(lb_transition.Text); new_event.EventTransitionTime = (int)ud_transition_time.Value; new_event.SlideshowInterval = (int)ud_slideshow_interval.Value; new_event.SlideshowTransition = new_event.TransitionTypeFromString(lb_slideshow_transition.Text); new_event.SlideshowTransitionTime = (int)ud_slideshow_transition.Value; new_event.EventInfoText = "slideshow"; int position; if (ActiveEvent != null) position = vMixEvents.IndexOf(ActiveEvent) + 1; else position = vMixEvents.Count; vMixEvents.Insert(position, new_event); ActiveEvent = new_event; EventList.VirtualListSize = vMixEvents.Count; EventList.SelectedIndices.Clear(); RebuildTimetable(); EventList.SelectedIndices.Add(position); UpdateDisplay(); } } }
private void bn_clone_Click(object sender, EventArgs e) { if (ActiveEvent == null) return; int position = vMixEvents.IndexOf(ActiveEvent) + 1; donotredraw = true; vMixEvent copy = new vMixEvent(ActiveEvent); vMixEvents.Insert(position, copy); ActiveEvent = copy; EventList.VirtualListSize = vMixEvents.Count; EventList.SelectedIndices.Clear(); EventList.SelectedIndices.Add(position); RebuildTimetable(); donotredraw = false; UpdateDisplay(); }
private void bn_load_Click(object sender, EventArgs e) { OpenFileDialog ofd = new OpenFileDialog(); ofd.Filter = "XML-Files|*.xml|all Files|*.*"; if (ofd.ShowDialog() == System.Windows.Forms.DialogResult.OK) { List<vMixEvent > vmes = new List<vMixEvent> (); XmlDocument d = new XmlDocument(); d.Load(ofd.FileName); foreach(XmlNode n in d.SelectNodes ("//vMixManager//Events//Event")) vmes.Add(new vMixEvent(n)); if (vmes.Count > 0) { vmes.Sort(delegate(vMixEvent e1, vMixEvent e2) {return e1.EventStart.CompareTo(e2.EventStart);}); donotredraw = true; EventList.SelectedIndices.Clear(); ActiveEvent = null; vMixEvents = vmes; EventList.VirtualListSize = vmes.Count; dtp_timetable.Value = vmes[0].EventStart; RebuildTimetable(); UpdateDisplay(); donotredraw = false; MessageBox.Show(vMixEvents.Count.ToString() + " events loaded from xml.", "Success!",MessageBoxButtons.OK,MessageBoxIcon.Information); } } }
private void bn_remove_Click(object sender, EventArgs e) { if (ActiveEvent == null) return; int position = vMixEvents.IndexOf(ActiveEvent); donotredraw = true; vMixEvents.Remove(ActiveEvent); ActiveEvent = null; EventList.VirtualListSize = vMixEvents.Count; EventList.SelectedIndices.Clear(); if (position >= vMixEvents.Count) position--; if (position >= 0) EventList.SelectedIndices.Add(position); RebuildTimetable(); donotredraw = false; UpdateDisplay(); }
private void bn_schedule_Click(object sender, EventArgs e) { if (vMixEvents.Count == 0) return; DateTime start = vMixEvents[0].EventStart; DateTime end = vMixEvents[vMixEvents.Count-1].EventEnd; string datafolder = Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData)+"\\vMixScheduler"; if (!System.IO.Directory.Exists(datafolder)) System.IO.Directory.CreateDirectory(datafolder); string schedulename = datafolder + "\\vMixSchedule.xml"; List<vMixEvent> vmes = new List<vMixEvent>(); XmlDocument d = new XmlDocument(); if (System.IO.File.Exists(schedulename)) { d.Load(schedulename); foreach (XmlNode n in d.SelectNodes("//vMixManager//Events//Event")) { vMixEvent vme = new vMixEvent(n); if (vme.EventStart > DateTime.Now && (vme.EventStart < start || vme.EventStart > end)) vmes.Add(vme); } d = new XmlDocument(); } vmes.AddRange(vMixEvents); vmes.Sort(delegate(vMixEvent e1, vMixEvent e2) { return e1.EventStart.CompareTo(e2.EventStart); }); XmlNode root = d.CreateElement("vMixManager"); d.AppendChild(root); XmlNode events = d.CreateElement("Events"); root.AppendChild(events); foreach (vMixEvent vme in vmes) events.AppendChild(vme.ToXMLNode(d)); d.Save(schedulename); MessageBox.Show("Events scheduled.", "Success!", MessageBoxButtons.OK, MessageBoxIcon.Information); }
private vMixEvent ParseImageData(string path) { vMixEvent new_event = null; string infotext = path; FileInfo.Open(path); string result = FileInfo.Get(StreamKind.General, 0, "Video_Format_List"); if (result != "JPEG") result = FileInfo.Get(StreamKind.General, 0, "Image_Format_List"); if (result != "") { infotext += "\r\nImage: " + result; TimeSpan duration = new TimeSpan(0,0,10); new_event = new vMixEvent(System.IO.Path.GetFileNameWithoutExtension(path), path, vmEventType.image, dtp_timetable.Value, new TimeSpan(0), duration, duration, false, vmTransitionType.cut, 1000, true); new_event.EventInfoText = infotext; } else MessageBox.Show("I can't recognize the image format!", "No Image?", MessageBoxButtons.OK, MessageBoxIcon.Error); FileInfo.Close(); return new_event; }
private vMixEvent ParseVideoData(string path) { vMixEvent new_event = null; string infotext = path; FileInfo.Open(path); string result = FileInfo.Get(StreamKind.General, 0, "Video_Format_List"); if (result != "") { infotext += "\r\nVideo: " + result; result = FileInfo.Get(StreamKind.General, 0, "Audio_Format_List"); if (result != "") infotext += "\r\nAudio: " + result; double milliseconds = -1; TimeSpan duration = new TimeSpan(0); result = FileInfo.Get(StreamKind.General, 0, "Duration"); CultureInfo cult = CultureInfo.CreateSpecificCulture("en-GB"); if (result != "" && double.TryParse(result, NumberStyles.Float | NumberStyles.AllowDecimalPoint, cult,out milliseconds)) { duration = new TimeSpan(0, 0, 0, 0, (int) milliseconds); infotext += "\r\nDuration: " + duration.ToString(@"hh\:mm\:ss"); } else MessageBox.Show("I can't decode this files duration!", "No Duration?", MessageBoxButtons.OK, MessageBoxIcon.Warning); new_event = new vMixEvent(System.IO.Path.GetFileNameWithoutExtension(path), path, vmEventType.video, dtp_timetable.Value, new TimeSpan (0), duration, duration, true, vmTransitionType.cut, 1000, true); new_event.EventInfoText = infotext; } else MessageBox.Show("I can't recognize the video format!", "No Video?", MessageBoxButtons.OK, MessageBoxIcon.Error); FileInfo.Close(); return new_event; }