public PreCachingSequenceContext GetCacheCompileContext() { var preCachingSequenceContext = new PreCachingSequenceContext("Compiler"); _AddContext(preCachingSequenceContext); return(preCachingSequenceContext); }
public PreCachingSequenceContext GetCacheCompileContext() { if (_preCachingSequenceContext == null) { _preCachingSequenceContext = new PreCachingSequenceContext("Compiler"); _AddContext(_preCachingSequenceContext); } else if (!_instances.ContainsKey(_preCachingSequenceContext.Id)) { _AddContext(_preCachingSequenceContext); } return(_preCachingSequenceContext); }
/// <summary> /// Initializes the generator processes to begin the data extraction /// </summary> public void BeginGeneration() { //Stop the output devices from driving the execution engine. VixenSystem.OutputDeviceManagement.PauseAll(); _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 _context = VixenSystem.Contexts.GetCacheCompileContext(); _context.Sequence = Sequence; _context.Start(); TimingSource.Start(); UpdateState(); }
/// <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); }