Пример #1
0
        /// <summary>
        /// Create a cache of the entire sequence command outputs
        /// </summary>
        private void _BuildSequenceCache()
        {
            //Need some hooks in here for progess....... Need to think about that.
            //Stop the output devices from driving the execution engine.
            VixenSystem.OutputDeviceManagement.PauseAll();
            IEnumerable <IContext> runningContexts = VixenSystem.Contexts.Where(x => x.IsRunning);

            foreach (var runningContext in runningContexts)
            {
                runningContext.Pause();
            }
            _outputCount = VixenSystem.OutputControllers.GetAll().Sum(x => x.OutputCount);
            VixenSystem.Elements.ClearStates();
            //Special context to pre cache commands. We don't need all the other fancy executor or timing as we will advance it ourselves
            PreCachingSequenceContext context = VixenSystem.Contexts.GetCacheCompileContext();

            context.Sequence = Sequence;
            TimingSource.Start();
            context.Start();

            while (TimingSource.Position <= Sequence.Length && IsRunning)
            {
                List <CommandOutput> commands = _UpdateState(TimingSource.Position);
                Cache.OutputStateListAggregator.AddCommands(commands);
                //Advance the timing
                TimingSource.Increment();
            }

            TimingSource.Stop();
            context.Stop();
            foreach (var runningContext in runningContexts)
            {
                runningContext.Resume();
            }

            VixenSystem.Contexts.ReleaseContext(_context);
            //restart the devices
            VixenSystem.OutputDeviceManagement.ResumeAll();
            IsRunning = false;
            //Cache is now ready to use or save.
            //cache.Save();
            // To load the cache use the following
            //ISequenceCache cache2 = SequenceService.Instance.LoadCache(cache.SequenceFilePath);
        }
Пример #2
0
 /// <summary>
 /// Gets the command outputs for the current interval and then increments the timing source.
 /// </summary>
 /// <returns>Command outputs or null if there are no more intervals.</returns>
 public void NextInterval()
 {
     //Advance the timing
     TimingSource.Increment();
     UpdateState();
 }