コード例 #1
0
ファイル: vController.cs プロジェクト: Tim-R/vScheduler
 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()
                        };
     ListViewItem lvi = new ListViewItem(caption);
     return lvi;
 }
コード例 #2
0
ファイル: vScheduler.cs プロジェクト: qolbu/vScheduler
 public void RemoveMicroEvents(vMixEvent evnt)
 {
     LocalListLock.WaitOne();
     for (int n = LocalList.Count - 1; n >= 0; n--)
     {
         if (LocalList[n].with == evnt)
         {
             LocalList.RemoveAt(n);
         }
     }
     LocalListLock.Release();
 }
コード例 #3
0
ファイル: vEvent.cs プロジェクト: qolbu/vScheduler
 public bool IsLike(vMixEvent other)
 {
     if (EventStart != other.EventStart)
     {
         return(false);
     }
     if (EventPath != other.EventPath)
     {
         return(false);
     }
     return(true);
 }
コード例 #4
0
        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()
            };
            ListViewItem lvi = new ListViewItem(caption);

            return(lvi);
        }
コード例 #5
0
ファイル: vScheduler.cs プロジェクト: qolbu/vScheduler
        public void RevokeMicroEvents(vMixEvent evnt, DateTime when)
        {
            LocalListLock.WaitOne();
            for (int n = LocalList.Count - 1; n >= 0; n--)
            {
                if (LocalList[n].with == evnt)
                {
                    LocalList.RemoveAt(n);
                }
            }

            LocalList.Add(new vMixMicroEvent(when + new TimeSpan(0, 0, MediaLinger), vmMicroEventType.remove, evnt));
            LocalList.Sort(delegate(vMixMicroEvent e1, vMixMicroEvent e2) { return(e1.when.CompareTo(e2.when)); });
            LocalListLock.Release();
        }
コード例 #6
0
ファイル: vScheduler.cs プロジェクト: qolbu/vScheduler
        public bool AddMicroEvents(vMixEvent evnt)
        {
            DateTime now = DateTime.Now;

            if (evnt.EventEnd < now + new TimeSpan(0, 0, MediaPreload + 1))
            {
                return(false);     // too late to add!
            }
            List <vMixMicroEvent> vmes = new List <vMixMicroEvent>();

            // prepare, transition, remove
            if (!evnt.HasDuration)
            {
                vmes.Add(new vMixMicroEvent(evnt.EventStart - new TimeSpan(0, 0, MediaPreload), vmMicroEventType.prepare, evnt));
                if (evnt.EventType == vmEventType.photos)
                {
                    vmes.Add(new vMixMicroEvent(evnt.EventStart - new TimeSpan(0, 0, 2), vmMicroEventType.setup, evnt));
                }
                vmes.Add(new vMixMicroEvent(evnt.EventStart, vmMicroEventType.transition, evnt));
            }
            else if (evnt.EventStart >= now + new TimeSpan(0, 0, MediaPreload))
            {
                vmes.Add(new vMixMicroEvent(evnt.EventStart - new TimeSpan(0, 0, MediaPreload), vmMicroEventType.prepare, evnt));
                if (evnt.EventInPoint >= new TimeSpan(0))
                {
                    vmes.Add(new vMixMicroEvent(evnt.EventStart - new TimeSpan(0, 0, 2), vmMicroEventType.fastforward, evnt));
                }
                vmes.Add(new vMixMicroEvent(evnt.EventStart, vmMicroEventType.transition, evnt));
            }
            else // has already started!!
            {
                evnt.EventTransition     = vmTransitionType.fade;
                evnt.EventTransitionTime = 300;
                vmes.Add(new vMixMicroEvent(now, vmMicroEventType.prepare, evnt));
                vmes.Add(new vMixMicroEvent(now + new TimeSpan(0, 0, 0, 1, 0), vmMicroEventType.fastforward, evnt));
                vmes.Add(new vMixMicroEvent(now + new TimeSpan(0, 0, 0, 2, 0), vmMicroEventType.transition, evnt));
            }

            vmes.Add(new vMixMicroEvent(evnt.EventEnd + new TimeSpan(0, 0, MediaLinger), vmMicroEventType.remove, evnt));

            LocalListLock.WaitOne();
            LocalList.AddRange(vmes);
            LocalList.Sort(delegate(vMixMicroEvent e1, vMixMicroEvent e2) { return(e1.when.CompareTo(e2.when)); });
            LocalListLock.Release();
            return(true);
        }
コード例 #7
0
 private void RemoveEvent(vMixEvent evnt)
 {
     try
     {
         if (this.InvokeRequired)
         {
             this.Invoke(new MethodInvoker(delegate { RemoveEvent(evnt); }));
         }
         else
         {
             EventListLock.WaitOne();
             EventList.Remove(evnt);
             EventListLock.Release();
             lvEventList.VirtualListSize = EventList.Count;
         }
     }
     catch (Exception e)
     {
         Console.Write(e.StackTrace);
     }
 }
コード例 #8
0
ファイル: vScheduler.cs プロジェクト: Tim-R/vScheduler
        public bool AddMicroEvents(vMixEvent evnt)
        {
            DateTime now = DateTime.Now;
            if (evnt.EventEnd < now + new TimeSpan(0, 0, MediaPreload+1))
                return false;     // too late to add!

            List<vMixMicroEvent> vmes = new List<vMixMicroEvent>();

            // prepare, transition, remove
            if (!evnt.HasDuration)
            {
                vmes.Add(new vMixMicroEvent(evnt.EventStart - new TimeSpan(0, 0, MediaPreload), vmMicroEventType.prepare, evnt));
                if (evnt.EventType ==  vmEventType.photos )
                    vmes.Add(new vMixMicroEvent(evnt.EventStart - new TimeSpan(0, 0, 2), vmMicroEventType.setup, evnt));
                vmes.Add(new vMixMicroEvent(evnt.EventStart, vmMicroEventType.transition, evnt));
            }
            else if (evnt.EventStart >= now + new TimeSpan(0,0,MediaPreload))
            {
                vmes.Add(new vMixMicroEvent(evnt.EventStart - new TimeSpan(0, 0, MediaPreload), vmMicroEventType.prepare, evnt));
                if (evnt.EventInPoint >= new TimeSpan(0) )
                    vmes.Add(new vMixMicroEvent(evnt.EventStart - new TimeSpan(0, 0, 2), vmMicroEventType.fastforward, evnt));
                vmes.Add(new vMixMicroEvent(evnt.EventStart, vmMicroEventType.transition, evnt));
            }
            else // has already started!!
            {
                evnt.EventTransition = vmTransitionType.fade;
                evnt.EventTransitionTime = 300;
                vmes.Add(new vMixMicroEvent(now, vmMicroEventType.prepare, evnt));
                vmes.Add(new vMixMicroEvent(now + new TimeSpan(0, 0, 0, 1, 0), vmMicroEventType.fastforward, evnt));
                vmes.Add(new vMixMicroEvent(now + new TimeSpan(0, 0, 0, 2, 0), vmMicroEventType.transition, evnt));
            }

            vmes.Add(new vMixMicroEvent(evnt.EventEnd + new TimeSpan (0, 0, MediaLinger), vmMicroEventType.remove, evnt));

            LocalListLock.WaitOne();
            LocalList.AddRange(vmes);
            LocalList.Sort(delegate(vMixMicroEvent e1, vMixMicroEvent e2) { return e1.when.CompareTo(e2.when); });
            LocalListLock.Release();
            return true;
        }
コード例 #9
0
ファイル: vController.cs プロジェクト: Tim-R/vScheduler
 private void RemoveEvent(vMixEvent evnt)
 {
     try
     {
         if (this.InvokeRequired)
             this.Invoke(new MethodInvoker(delegate { RemoveEvent(evnt); }));
         else
         {
             EventListLock.WaitOne();
             EventList.Remove(evnt);
             EventListLock.Release();
             lvEventList.VirtualListSize = EventList.Count;
         }
     }
     catch (Exception e)
     {
         Console.Write(e.StackTrace);
     }
 }
コード例 #10
0
ファイル: vController.cs プロジェクト: Tim-R/vScheduler
        private void ReloadSchedule()
        {
            if (this.InvokeRequired)
                this.Invoke(new MethodInvoker(ReloadSchedule));
            else
            {
                this.Enabled = false;

                string schedulename = ScheduleFolder + "\\vMixSchedule.xml";
                if (File.Exists(schedulename))
                {
                    List<vMixEvent> vmes = new List<vMixEvent>();
                    XmlDocument d = new XmlDocument();
                    try
                    {
                        d.Load(schedulename);
                        lvEventList.SelectedIndices.Clear();
                        vmes.Sort(delegate(vMixEvent e1, vMixEvent e2) { return e1.EventStart.CompareTo(e2.EventStart); });
                        for (int n = EventList.Count - 1; n >= 0; n--)
                        {
                            if (!EventList[n].IsLoaded)
                            {
                                MasterClock.RemoveMicroEvents(EventList[n]);
                                EventList.RemoveAt(n);
                            }
                        }

                        foreach (XmlNode n in d.SelectNodes("//vMixManager//Events//Event"))
                        {
                            vMixEvent ne = new vMixEvent (n);
                            if (ne.EventEnd > DateTime.Now )
                            {
                                bool found = false;
                                foreach (vMixEvent ve in EventList)
                                    if (ve.IsLike (ne))
                                        found = true;
                                if (!found)
                                    vmes.Add(new vMixEvent (n));
                            }
                        }

                        if (vmes.Count > 0)
                        {
                            DateTime revoke = vmes[0].EventStart > DateTime.Now ? vmes[0].EventStart : DateTime.Now;
                            foreach (vMixEvent ve in EventList)
                                MasterClock.RevokeMicroEvents (ve,revoke);
                            foreach (vMixEvent vme in vmes)
                                if (MasterClock.AddMicroEvents(vme))
                                    EventList.Add(vme);
                            EventList.Sort(delegate(vMixEvent e1, vMixEvent e2) { return e1.EventStart.CompareTo(e2.EventStart); });
                            lvEventList.VirtualListSize = EventList.Count;
                            lvEventList.RedrawItems(0, EventList.Count - 1, false);
                        }
                    }
                    catch {}
                }
                this.Enabled = true;
            }
        }
コード例 #11
0
ファイル: vMicroEvent.cs プロジェクト: qolbu/vScheduler
 public vMixMicroEvent(vmMicroEventType type)
 {
     when = new DateTime();
     what = type;
     with = null;
 }
コード例 #12
0
ファイル: vMicroEvent.cs プロジェクト: qolbu/vScheduler
 public vMixMicroEvent(DateTime time, vmMicroEventType type, vMixEvent vmevent)
 {
     when = time;
     what = type;
     with = vmevent;
 }
コード例 #13
0
ファイル: vMicroEvent.cs プロジェクト: Tim-R/vScheduler
 public vMixMicroEvent(vmMicroEventType type)
 {
     when = new DateTime();
     what = type;
     with = null;
 }
コード例 #14
0
ファイル: vMicroEvent.cs プロジェクト: Tim-R/vScheduler
 public vMixMicroEvent(DateTime time, vmMicroEventType type, vMixEvent vmevent)
 {
     when = time;
     what = type;
     with = vmevent;
 }
コード例 #15
0
ファイル: vScheduler.cs プロジェクト: Tim-R/vScheduler
        public void RevokeMicroEvents(vMixEvent evnt, DateTime when)
        {
            LocalListLock.WaitOne();
            for (int n = LocalList.Count - 1; n >= 0; n--)
                if (LocalList[n].with == evnt)
                    LocalList.RemoveAt(n);

            LocalList.Add (new vMixMicroEvent(when + new TimeSpan(0,0,MediaLinger), vmMicroEventType.remove, evnt));
            LocalList.Sort(delegate(vMixMicroEvent e1, vMixMicroEvent e2) { return e1.when.CompareTo(e2.when); });
            LocalListLock.Release();
        }
コード例 #16
0
        private void ReloadSchedule()
        {
            if (this.InvokeRequired)
            {
                this.Invoke(new MethodInvoker(ReloadSchedule));
            }
            else
            {
                this.Enabled = false;

                string schedulename = ScheduleFolder + "\\vMixSchedule.xml";
                if (File.Exists(schedulename))
                {
                    List <vMixEvent> vmes = new List <vMixEvent>();
                    XmlDocument      d    = new XmlDocument();
                    try
                    {
                        d.Load(schedulename);
                        lvEventList.SelectedIndices.Clear();
                        vmes.Sort(delegate(vMixEvent e1, vMixEvent e2) { return(e1.EventStart.CompareTo(e2.EventStart)); });
                        for (int n = EventList.Count - 1; n >= 0; n--)
                        {
                            if (!EventList[n].IsLoaded)
                            {
                                MasterClock.RemoveMicroEvents(EventList[n]);
                                EventList.RemoveAt(n);
                            }
                        }

                        foreach (XmlNode n in d.SelectNodes("//vMixManager//Events//Event"))
                        {
                            vMixEvent ne = new vMixEvent(n);
                            if (ne.EventEnd > DateTime.Now)
                            {
                                bool found = false;
                                foreach (vMixEvent ve in EventList)
                                {
                                    if (ve.IsLike(ne))
                                    {
                                        found = true;
                                    }
                                }
                                if (!found)
                                {
                                    vmes.Add(new vMixEvent(n));
                                }
                            }
                        }

                        if (vmes.Count > 0)
                        {
                            DateTime revoke = vmes[0].EventStart > DateTime.Now ? vmes[0].EventStart : DateTime.Now;
                            foreach (vMixEvent ve in EventList)
                            {
                                MasterClock.RevokeMicroEvents(ve, revoke);
                            }
                            foreach (vMixEvent vme in vmes)
                            {
                                if (MasterClock.AddMicroEvents(vme))
                                {
                                    EventList.Add(vme);
                                }
                            }
                            EventList.Sort(delegate(vMixEvent e1, vMixEvent e2) { return(e1.EventStart.CompareTo(e2.EventStart)); });
                            lvEventList.VirtualListSize = EventList.Count;
                            lvEventList.RedrawItems(0, EventList.Count - 1, false);
                        }
                    }
                    catch {}
                }
                this.Enabled = true;
            }
        }
コード例 #17
0
        private void WorkloadFunc()
        {
            vMixMicroEvent vme;

            while (!exitApp)
            {
                PaintTime();
                if (Workload.TryTake(out vme, 1000))
                {
                    vMixEvent evnt = vme.with;

                    if (vme.what.Equals(vmMicroEventType.exit))
                    {
                        break;
                    }

                    switch (vme.what)
                    {
                    case vmMicroEventType.prepare:
                        evnt.state = 1;
                        if (evnt.EventType == vmEventType.input)
                        {
                            WebClient.GetGUID(evnt.Title, out evnt.GUID);
                        }
                        else if (evnt.EventType == vmEventType.black)
                        {
                            WebClient.AddInput("Colour", "black", evnt.GUID);
                        }
                        else if (evnt.HasMedia)
                        {
                            WebClient.AddInput(evnt.EventTypeString(), evnt.EventPath, evnt.GUID);
                        }
                        break;

                    case vmMicroEventType.setup:
                        if (evnt.EventType == vmEventType.photos)
                        {
                            WebClient.SetupSlideshow(evnt.SlideshowInterval, evnt.SlideshowTypeString(), evnt.SlideshowTransitionTime, evnt.GUID);
                        }
                        break;

                    case  vmMicroEventType.fastforward:
                        if (evnt.HasDuration)
                        {
                            int position = (int)(DateTime.Now - evnt.EventStart + evnt.EventInPoint).TotalMilliseconds;
                            WebClient.ForwardTo(evnt.GUID, position);
                        }
                        break;

                    case vmMicroEventType.transition:
                        evnt.state = 2;
                        if (evnt.EventType == vmEventType.input)
                        {
                            string type     = evnt.TransitionTypeString();
                            int    duration = evnt.EventTransitionTime;
                            WebClient.Transition(evnt.GUID, type, duration);
                        }
                        else if (evnt.HasMedia)
                        {
                            string type     = evnt.TransitionTypeString();
                            int    duration = evnt.EventTransitionTime;
                            WebClient.Transition(evnt.GUID, type, duration);
                        }
                        break;

                    case vmMicroEventType.remove:
                        if (evnt.EventType != vmEventType.input)
                        {
                            WebClient.CloseInput(evnt.GUID);
                        }
                        RemoveEvent(evnt);
                        break;
                    }
                }
            }
            CloseWindow();
        }
コード例 #18
0
ファイル: vEvent.cs プロジェクト: Tim-R/vScheduler
 public bool IsLike(vMixEvent other)
 {
     if (EventStart != other.EventStart) return false;
     if (EventPath != other.EventPath) return false;
     return true;
 }
コード例 #19
0
ファイル: vScheduler.cs プロジェクト: Tim-R/vScheduler
 public void RemoveMicroEvents(vMixEvent evnt)
 {
     LocalListLock.WaitOne();
     for (int n = LocalList.Count - 1; n >= 0; n--)
         if (LocalList[n].with == evnt)
             LocalList.RemoveAt(n);
     LocalListLock.Release();
 }