Пример #1
0
        private ISendConnector GetMatchingSendConnector(string addressSpace)
        {
            ISendConnector sendConnector            = null;
            IEnumerable <ISendConnector> enumerable = base.OnPremisesSession.GetSendConnector();

            foreach (ISendConnector sendConnector2 in enumerable)
            {
                foreach (AddressSpace addressSpace2 in sendConnector2.AddressSpaces)
                {
                    if (addressSpace2.Address.Equals(addressSpace, StringComparison.InvariantCultureIgnoreCase))
                    {
                        if (sendConnector != null)
                        {
                            throw new LocalizedException(HybridStrings.ErrorDuplicateSendConnectorAddressSpace(addressSpace));
                        }
                        if (sendConnector2.AddressSpaces.Count > 1)
                        {
                            throw new LocalizedException(HybridStrings.ErrorSendConnectorAddressSpaceNotExclusive(addressSpace));
                        }
                        sendConnector = sendConnector2;
                    }
                }
            }
            if (sendConnector == null)
            {
                foreach (ISendConnector sendConnector3 in enumerable)
                {
                    if (string.Equals(sendConnector3.Name, this.DefaultSendConnectorName))
                    {
                        sendConnector = sendConnector3;
                        break;
                    }
                }
            }
            return(sendConnector);
        }