private void StopPlugins() { logger.LogVerbose("Stopping configured plugins"); if (stoppedPlugins.Count > 0) { throw new ValidationException("There are alredy stopped plugins, activate them first!"); } List <SdkStep> allPlugins = processRepository.GetAllCustomizableSDKSteps(); if (sdkSteps == null) { sdkSteps = allPlugins.Select(p => new Tuple <string, string>(p.Name, p.Handler)).ToList(); } if (sdkSteps != null && sdkSteps.Count > 0) { foreach (var item in sdkSteps) { SdkStep plugin = allPlugins.FirstOrDefault(p => p.Name == item.Item1 && p.Handler == item.Item2); if (plugin != null && plugin.SDKSepStatusCode == SdkSepStatusCode.Enabled) { DeactivateSdkStep(plugin); } else { logger.LogVerbose($"Plugin {item.Item1}:{item.Item2} does not exist or is already stopped"); } } } }
private void DeactivateSdkStep(SdkStep plugin) { try { processRepository.DeActivateSDKStep(plugin.Id); stoppedPlugins.Add(plugin.Id); logger.LogVerbose($"Plugin {plugin.Name}:{plugin.Handler} has been stopped"); } catch (Exception ex) { logger.LogWarning($"Cannot stop plugin {ex.Message}:{plugin.Name} error: {plugin.Handler}"); } }