private IProcessingContextCollection PrepareSignals(string moduleName, string signalKey, bool isWriteOperation, InputModelParameters inputModelParametersTemplate) { List <IProcessingContext> resultContexts = new List <IProcessingContext>(); bool isMaintenance = false; InputModelParameters inputModelParameters = inputModelParametersTemplate.DeepClone(); if (string.IsNullOrEmpty(moduleName) || moduleName.Equals("null", StringComparison.OrdinalIgnoreCase))//Apply for all modules { foreach (KraftModule kraftModule in _KraftModuleCollection.GetSortedModules()) { KraftModuleSignal signal = FindSignal(kraftModule, signalKey); if (signal != null) { isMaintenance = signal.Maintenance; if (kraftModule.KraftModuleRootConf.Signals.Count > 0) { resultContexts.Add(Signal2ProcessingContext(inputModelParameters, kraftModule, signal, isWriteOperation)); } } } } else { KraftModule kraftModule = _KraftModuleCollection.GetSortedModules().Find(m => m.Key.Equals(moduleName, StringComparison.OrdinalIgnoreCase)); KraftModuleSignal signal = FindSignal(kraftModule, signalKey); if (signal != null) { isMaintenance = signal.Maintenance; resultContexts.Add(Signal2ProcessingContext(inputModelParameters, kraftModule, signal, isWriteOperation)); } } _ProcessingContextCollection = new ProcessingContextCollection(resultContexts, isMaintenance); return(_ProcessingContextCollection); }
private static ModuleSignalDetails GenerateDetails(string moduleKey, KraftModuleSignal kraftModuleSignal, INodeSetService nodeSetService) { ModuleSignalDetails moduleSignalDetails = new ModuleSignalDetails(); LoadedNodeSet nodeSet = nodeSetService.LoadNodeSet(moduleKey, kraftModuleSignal.NodeSet, kraftModuleSignal.NodePath); if (nodeSet.StartNode.Read != null) { moduleSignalDetails.Read = nodeSet.StartNode.Read; moduleSignalDetails.Read.Parameters = nodeSet.StartNode.Parameters; //moduleSignalDetails.InitRead(); } if (nodeSet.StartNode.Write != null) { moduleSignalDetails.Write = nodeSet.StartNode.Write; moduleSignalDetails.Write.Parameters = nodeSet.StartNode.Parameters; //moduleSignalDetails.InitWrite(); } return(moduleSignalDetails); }
private IProcessingContext Signal2ProcessingContext(InputModelParameters inputModelParameters, KraftModule kraftModule, KraftModuleSignal signal, bool isWriteOperation) { inputModelParameters.Module = kraftModule.Key; inputModelParameters.Nodeset = signal?.NodeSet; inputModelParameters.Nodepath = signal?.NodePath; inputModelParameters.IsWriteOperation = isWriteOperation; if (inputModelParameters.LoaderType == ELoaderType.None) { inputModelParameters.LoaderType = ELoaderType.DataLoader; } IProcessingContext processingContext = new ProcessingContext(this); processingContext.InputModel = new InputModel(inputModelParameters); return(processingContext); }