private void SurrogateRead(StreamingContext context) { SelectedTimingProvider = _selectedTimingProviderSurrogate.CreateSelectedTimingProvider(); Media = new MediaCollection(_mediaSurrogates.Select(x => x.CreateMedia())); // Rehydrate the local module data store. LocalDataSet = new ModuleLocalDataSet(); LocalDataSet.DataModels = _dataModels; // Rehydrate the modules. var elementNodes = VixenSystem.Nodes.Distinct().ToDictionary(x => x.Id); IEffectNode[] effectNodes = _effectNodeSurrogates.Select(x => x.CreateEffectNode(elementNodes)).ToArray(); // weed out effects without nodes.. effectNodes = effectNodes.Where(x => x.Effect.TargetNodes.Count() != 0).ToArray(); ISequenceFilterNode[] sequenceFilterNodes = _filterNodeSurrogates.Select(x => x.CreateFilterNode()).ToArray(); // Connect them to their respective data from the data store. // This was previously being done by adding the data to the sequence after loading the data. foreach (var effectNode in effectNodes) { LocalDataSet.AssignModuleInstanceData(effectNode.Effect); } foreach (var sequenceFilterNode in sequenceFilterNodes) { LocalDataSet.AssignModuleInstanceData(sequenceFilterNode.Filter); } // Get the modules back into their collections. _InitDataStreams(); EffectData.AddData(effectNodes); SequenceFilterData.AddData(sequenceFilterNodes); }
void SurrogateRead(StreamingContext context) { SelectedTimingProvider = _selectedTimingProviderSurrogate.CreateSelectedTimingProvider(); Media = new MediaCollection(_mediaSurrogates.Select(x => x.CreateMedia())); // Rehydrate the local module data store. LocalDataSet = new ModuleLocalDataSet(); LocalDataSet.DataModels = _dataModels; // Rehydrate the modules. IEffectNode[] effectNodes = _effectNodeSurrogates.Select(x => x.CreateEffectNode()).ToArray(); ISequenceFilterNode[] sequenceFilterNodes = _filterNodeSurrogates.Select(x => x.CreateFilterNode()).ToArray(); // Connect them to their respective data from the data store. // This was previously being done by adding the data to the sequence after loading the data. foreach (var effectNode in effectNodes) { LocalDataSet.AssignModuleInstanceData(effectNode.Effect); } foreach (var sequenceFilterNode in sequenceFilterNodes) { LocalDataSet.AssignModuleInstanceData(sequenceFilterNode.Filter); } // Get the modules back into their collections. _InitDataStreams(); EffectData.AddData(effectNodes); SequenceFilterData.AddData(sequenceFilterNodes); }