internal ActiveDirectorySiteLinkBridge(DirectoryContext context, string bridgeName, ActiveDirectoryTransportType transport, bool existing)
 {
     this.links = new ActiveDirectorySiteLinkCollection();
     this.context = context;
     this.name = bridgeName;
     this.transport = transport;
     this.existing = existing;
 }
 internal ActiveDirectorySiteLinkBridge(DirectoryContext context, string bridgeName, ActiveDirectoryTransportType transport, bool existing)
 {
     this.links     = new ActiveDirectorySiteLinkCollection();
     this.context   = context;
     this.name      = bridgeName;
     this.transport = transport;
     this.existing  = existing;
 }
        public void AddRange(ActiveDirectorySiteLinkCollection links)
        {
            if (links == null)
                throw new ArgumentNullException("links");

            int count = links.Count;
            for (int i = 0; i < count; i++)
                this.Add(links[i]);
        }
        public void AddRange(ActiveDirectorySiteLinkCollection links)
        {
            if (links == null)
            {
                throw new ArgumentNullException("links");
            }
            int count = links.Count;

            for (int i = 0; i < count; i++)
            {
                this.Add(links[i]);
            }
        }
        public ActiveDirectorySiteLinkBridge(DirectoryContext context, string bridgeName, ActiveDirectoryTransportType transport)
        {
            DirectoryEntry directoryEntry;

            this.links = new ActiveDirectorySiteLinkCollection();
            ValidateArgument(context, bridgeName, transport);
            context        = new DirectoryContext(context);
            this.context   = context;
            this.name      = bridgeName;
            this.transport = transport;
            try
            {
                directoryEntry = DirectoryEntryManager.GetDirectoryEntry(context, WellKnownDN.RootDSE);
                string str = (string)PropertyManager.GetPropertyValue(context, directoryEntry, PropertyManager.ConfigurationNamingContext);
                string dn  = null;
                if (transport == ActiveDirectoryTransportType.Rpc)
                {
                    dn = "CN=IP,CN=Inter-Site Transports,CN=Sites," + str;
                }
                else
                {
                    dn = "CN=SMTP,CN=Inter-Site Transports,CN=Sites," + str;
                }
                directoryEntry = DirectoryEntryManager.GetDirectoryEntry(context, dn);
            }
            catch (COMException exception)
            {
                throw ExceptionHelper.GetExceptionFromCOMException(context, exception);
            }
            catch (ActiveDirectoryObjectNotFoundException)
            {
                throw new ActiveDirectoryOperationException(Res.GetString("ADAMInstanceNotFoundInConfigSet", new object[] { context.Name }));
            }
            try
            {
                string escapedPath = Utils.GetEscapedPath("cn=" + this.name);
                this.cachedEntry = directoryEntry.Children.Add(escapedPath, "siteLinkBridge");
            }
            catch (COMException exception2)
            {
                if (((exception2.ErrorCode == -2147016656) && Utils.CheckCapability(DirectoryEntryManager.GetDirectoryEntry(context, WellKnownDN.RootDSE), Capability.ActiveDirectoryApplicationMode)) && (transport == ActiveDirectoryTransportType.Smtp))
                {
                    throw new NotSupportedException(Res.GetString("NotSupportTransportSMTP"));
                }
                throw ExceptionHelper.GetExceptionFromCOMException(context, exception2);
            }
            finally
            {
                directoryEntry.Dispose();
            }
        }
 public ActiveDirectorySiteLinkBridge(DirectoryContext context, string bridgeName, ActiveDirectoryTransportType transport)
 {
     DirectoryEntry directoryEntry;
     this.links = new ActiveDirectorySiteLinkCollection();
     ValidateArgument(context, bridgeName, transport);
     context = new DirectoryContext(context);
     this.context = context;
     this.name = bridgeName;
     this.transport = transport;
     try
     {
         directoryEntry = DirectoryEntryManager.GetDirectoryEntry(context, WellKnownDN.RootDSE);
         string str = (string) PropertyManager.GetPropertyValue(context, directoryEntry, PropertyManager.ConfigurationNamingContext);
         string dn = null;
         if (transport == ActiveDirectoryTransportType.Rpc)
         {
             dn = "CN=IP,CN=Inter-Site Transports,CN=Sites," + str;
         }
         else
         {
             dn = "CN=SMTP,CN=Inter-Site Transports,CN=Sites," + str;
         }
         directoryEntry = DirectoryEntryManager.GetDirectoryEntry(context, dn);
     }
     catch (COMException exception)
     {
         throw ExceptionHelper.GetExceptionFromCOMException(context, exception);
     }
     catch (ActiveDirectoryObjectNotFoundException)
     {
         throw new ActiveDirectoryOperationException(Res.GetString("ADAMInstanceNotFoundInConfigSet", new object[] { context.Name }));
     }
     try
     {
         string escapedPath = Utils.GetEscapedPath("cn=" + this.name);
         this.cachedEntry = directoryEntry.Children.Add(escapedPath, "siteLinkBridge");
     }
     catch (COMException exception2)
     {
         if (((exception2.ErrorCode == -2147016656) && Utils.CheckCapability(DirectoryEntryManager.GetDirectoryEntry(context, WellKnownDN.RootDSE), Capability.ActiveDirectoryApplicationMode)) && (transport == ActiveDirectoryTransportType.Smtp))
         {
             throw new NotSupportedException(Res.GetString("NotSupportTransportSMTP"));
         }
         throw ExceptionHelper.GetExceptionFromCOMException(context, exception2);
     }
     finally
     {
         directoryEntry.Dispose();
     }
 }
 public void AddRange(ActiveDirectorySiteLinkCollection links)
 {
     throw new NotImplementedException();
 }
 public void AddRange(ActiveDirectorySiteLinkCollection links)
 {
     Contract.Requires(links != null);
 }
		public ActiveDirectorySiteLinkBridge(DirectoryContext context, string bridgeName, ActiveDirectoryTransportType transport)
		{
			DirectoryEntry directoryEntry;
			string str;
			this.links = new ActiveDirectorySiteLinkCollection();
			ActiveDirectorySiteLinkBridge.ValidateArgument(context, bridgeName, transport);
			context = new DirectoryContext(context);
			this.context = context;
			this.name = bridgeName;
			this.transport = transport;
			try
			{
				directoryEntry = DirectoryEntryManager.GetDirectoryEntry(context, WellKnownDN.RootDSE);
				string propertyValue = (string)PropertyManager.GetPropertyValue(context, directoryEntry, PropertyManager.ConfigurationNamingContext);
				if (transport != ActiveDirectoryTransportType.Rpc)
				{
					str = string.Concat("CN=SMTP,CN=Inter-Site Transports,CN=Sites,", propertyValue);
				}
				else
				{
					str = string.Concat("CN=IP,CN=Inter-Site Transports,CN=Sites,", propertyValue);
				}
				directoryEntry = DirectoryEntryManager.GetDirectoryEntry(context, str);
			}
			catch (COMException cOMException1)
			{
				COMException cOMException = cOMException1;
				throw ExceptionHelper.GetExceptionFromCOMException(context, cOMException);
			}
			catch (ActiveDirectoryObjectNotFoundException activeDirectoryObjectNotFoundException)
			{
				object[] name = new object[1];
				name[0] = context.Name;
				throw new ActiveDirectoryOperationException(Res.GetString("ADAMInstanceNotFoundInConfigSet", name));
			}
			try
			{
				try
				{
					string escapedPath = string.Concat("cn=", this.name);
					escapedPath = Utils.GetEscapedPath(escapedPath);
					this.cachedEntry = directoryEntry.Children.Add(escapedPath, "siteLinkBridge");
				}
				catch (COMException cOMException3)
				{
					COMException cOMException2 = cOMException3;
					if (cOMException2.ErrorCode == -2147016656)
					{
						DirectoryEntry directoryEntry1 = DirectoryEntryManager.GetDirectoryEntry(context, WellKnownDN.RootDSE);
						if (Utils.CheckCapability(directoryEntry1, Capability.ActiveDirectoryApplicationMode) && transport == ActiveDirectoryTransportType.Smtp)
						{
							throw new NotSupportedException(Res.GetString("NotSupportTransportSMTP"));
						}
					}
					throw ExceptionHelper.GetExceptionFromCOMException(context, cOMException2);
				}
			}
			finally
			{
				directoryEntry.Dispose();
			}
		}
		public void AddRange (ActiveDirectorySiteLinkCollection links)
		{
			throw new NotImplementedException ();
		}
 public void AddRange(ActiveDirectorySiteLinkCollection links)
 {
   Contract.Requires(links != null);
 }
        public ActiveDirectorySiteLinkBridge(DirectoryContext context, string bridgeName, ActiveDirectoryTransportType transport)
        {
            DirectoryEntry directoryEntry;
            string         str;

            this.links = new ActiveDirectorySiteLinkCollection();
            ActiveDirectorySiteLinkBridge.ValidateArgument(context, bridgeName, transport);
            context        = new DirectoryContext(context);
            this.context   = context;
            this.name      = bridgeName;
            this.transport = transport;
            try
            {
                directoryEntry = DirectoryEntryManager.GetDirectoryEntry(context, WellKnownDN.RootDSE);
                string propertyValue = (string)PropertyManager.GetPropertyValue(context, directoryEntry, PropertyManager.ConfigurationNamingContext);
                if (transport != ActiveDirectoryTransportType.Rpc)
                {
                    str = string.Concat("CN=SMTP,CN=Inter-Site Transports,CN=Sites,", propertyValue);
                }
                else
                {
                    str = string.Concat("CN=IP,CN=Inter-Site Transports,CN=Sites,", propertyValue);
                }
                directoryEntry = DirectoryEntryManager.GetDirectoryEntry(context, str);
            }
            catch (COMException cOMException1)
            {
                COMException cOMException = cOMException1;
                throw ExceptionHelper.GetExceptionFromCOMException(context, cOMException);
            }
            catch (ActiveDirectoryObjectNotFoundException activeDirectoryObjectNotFoundException)
            {
                object[] name = new object[1];
                name[0] = context.Name;
                throw new ActiveDirectoryOperationException(Res.GetString("ADAMInstanceNotFoundInConfigSet", name));
            }
            try
            {
                try
                {
                    string escapedPath = string.Concat("cn=", this.name);
                    escapedPath      = Utils.GetEscapedPath(escapedPath);
                    this.cachedEntry = directoryEntry.Children.Add(escapedPath, "siteLinkBridge");
                }
                catch (COMException cOMException3)
                {
                    COMException cOMException2 = cOMException3;
                    if (cOMException2.ErrorCode == -2147016656)
                    {
                        DirectoryEntry directoryEntry1 = DirectoryEntryManager.GetDirectoryEntry(context, WellKnownDN.RootDSE);
                        if (Utils.CheckCapability(directoryEntry1, Capability.ActiveDirectoryApplicationMode) && transport == ActiveDirectoryTransportType.Smtp)
                        {
                            throw new NotSupportedException(Res.GetString("NotSupportTransportSMTP"));
                        }
                    }
                    throw ExceptionHelper.GetExceptionFromCOMException(context, cOMException2);
                }
            }
            finally
            {
                directoryEntry.Dispose();
            }
        }