private void ValidateDeliveryAgent(AgentInfo agentInfo) { HashSet <string> hashSet = new HashSet <string>(StringComparer.OrdinalIgnoreCase); foreach (AgentInfo agentInfo2 in base.MExConfiguration.AgentList) { DeliveryAgentManager deliveryAgentManager = FactoryTable.GetAgentManagerInstance(agentInfo2) as DeliveryAgentManager; if (deliveryAgentManager != null) { if (string.IsNullOrEmpty(deliveryAgentManager.SupportedDeliveryProtocol)) { this.WriteWarning(AgentStrings.DeliveryProtocolNotValid(agentInfo2.AgentName)); } else { hashSet.Add(deliveryAgentManager.SupportedDeliveryProtocol); } } } DeliveryAgentManager deliveryAgentManager2 = FactoryTable.GetAgentManagerInstance(agentInfo) as DeliveryAgentManager; if (deliveryAgentManager2 == null) { base.WriteError(new ArgumentException(AgentStrings.InvalidDeliveryAgentManager(this.Name)), ErrorCategory.InvalidArgument, null); } if (string.IsNullOrEmpty(deliveryAgentManager2.SupportedDeliveryProtocol)) { base.WriteError(new ArgumentException(AgentStrings.DeliveryProtocolNotSpecified(this.Name)), ErrorCategory.InvalidArgument, null); } if (hashSet.Contains(deliveryAgentManager2.SupportedDeliveryProtocol)) { base.WriteError(new ArgumentException(AgentStrings.MustHaveUniqueDeliveryProtocol(this.Name, deliveryAgentManager2.SupportedDeliveryProtocol)), ErrorCategory.InvalidArgument, null); } }
private bool IsAgentEnabled(AgentRecord agentRecord) { if (string.Equals(agentRecord.Type, MExSession.DeliveryAgentType, StringComparison.OrdinalIgnoreCase)) { DeliveryAgentManager deliveryAgentManager = (DeliveryAgentManager)this.settings.AgentFactories.GetAgentManager(agentRecord.Id); if (!string.Equals(deliveryAgentManager.SupportedDeliveryProtocol, this.name, StringComparison.OrdinalIgnoreCase)) { return(false); } } return(true); }