Ejemplo n.º 1
0
 public int IndexOf(ActiveDirectorySiteLinkBridge bridge)
 {
     if (bridge != null)
     {
         string propertyValue = (string)PropertyManager.GetPropertyValue(bridge.context, bridge.cachedEntry, PropertyManager.DistinguishedName);
         int    num           = 0;
         while (num < base.InnerList.Count)
         {
             ActiveDirectorySiteLinkBridge item = (ActiveDirectorySiteLinkBridge)base.InnerList[num];
             string str = (string)PropertyManager.GetPropertyValue(item.context, item.cachedEntry, PropertyManager.DistinguishedName);
             if (Utils.Compare(str, propertyValue) != 0)
             {
                 num++;
             }
             else
             {
                 return(num);
             }
         }
         return(-1);
     }
     else
     {
         throw new ArgumentNullException("bridge");
     }
 }
		public int IndexOf(ActiveDirectorySiteLinkBridge bridge)
		{
			if (bridge != null)
			{
				string propertyValue = (string)PropertyManager.GetPropertyValue(bridge.context, bridge.cachedEntry, PropertyManager.DistinguishedName);
				int num = 0;
				while (num < base.InnerList.Count)
				{
					ActiveDirectorySiteLinkBridge item = (ActiveDirectorySiteLinkBridge)base.InnerList[num];
					string str = (string)PropertyManager.GetPropertyValue(item.context, item.cachedEntry, PropertyManager.DistinguishedName);
					if (Utils.Compare(str, propertyValue) != 0)
					{
						num++;
					}
					else
					{
						return num;
					}
				}
				return -1;
			}
			else
			{
				throw new ArgumentNullException("bridge");
			}
		}
        public int IndexOf(ActiveDirectorySiteLinkBridge bridge)
        {
            Contract.Requires(bridge != null);
            Contract.Ensures(Contract.Result <int>() >= -1);
            Contract.Ensures(Contract.Result <int>() < this.Count);

            return(default(int));
        }
    public int IndexOf(ActiveDirectorySiteLinkBridge bridge)
    {
      Contract.Requires(bridge != null);
      Contract.Ensures(Contract.Result<int>() >= -1);
      Contract.Ensures(Contract.Result<int>() < this.Count);

      return default(int);
    }
 public int IndexOf(ActiveDirectorySiteLinkBridge bridge)
 {
     if (bridge == null)
     {
         throw new ArgumentNullException("bridge");
     }
     string str = (string) PropertyManager.GetPropertyValue(bridge.context, bridge.cachedEntry, PropertyManager.DistinguishedName);
     for (int i = 0; i < base.InnerList.Count; i++)
     {
         ActiveDirectorySiteLinkBridge bridge2 = (ActiveDirectorySiteLinkBridge) base.InnerList[i];
         string str2 = (string) PropertyManager.GetPropertyValue(bridge2.context, bridge2.cachedEntry, PropertyManager.DistinguishedName);
         if (Utils.Compare(str2, str) == 0)
         {
             return i;
         }
     }
     return -1;
 }
        public int IndexOf(ActiveDirectorySiteLinkBridge bridge)
        {
            if (bridge == null)
                throw new ArgumentNullException("bridge");

            string dn = (string)PropertyManager.GetPropertyValue(bridge.context, bridge.cachedEntry, PropertyManager.DistinguishedName);

            for (int i = 0; i < InnerList.Count; i++)
            {
                ActiveDirectorySiteLinkBridge tmp = (ActiveDirectorySiteLinkBridge)InnerList[i];
                string tmpDn = (string)PropertyManager.GetPropertyValue(tmp.context, tmp.cachedEntry, PropertyManager.DistinguishedName);

                if (Utils.Compare(tmpDn, dn) == 0)
                {
                    return i;
                }
            }
            return -1;
        }
        public int IndexOf(ActiveDirectorySiteLinkBridge bridge)
        {
            if (bridge == null)
            {
                throw new ArgumentNullException("bridge");
            }
            string str = (string)PropertyManager.GetPropertyValue(bridge.context, bridge.cachedEntry, PropertyManager.DistinguishedName);

            for (int i = 0; i < base.InnerList.Count; i++)
            {
                ActiveDirectorySiteLinkBridge bridge2 = (ActiveDirectorySiteLinkBridge)base.InnerList[i];
                string str2 = (string)PropertyManager.GetPropertyValue(bridge2.context, bridge2.cachedEntry, PropertyManager.DistinguishedName);
                if (Utils.Compare(str2, str) == 0)
                {
                    return(i);
                }
            }
            return(-1);
        }
Ejemplo n.º 8
0
        public bool Contains(ActiveDirectorySiteLinkBridge bridge)
        {
            if (bridge == null)
            {
                throw new ArgumentNullException("bridge");
            }

            string dn = (string)PropertyManager.GetPropertyValue(bridge.context, bridge.cachedEntry, PropertyManager.DistinguishedName);

            for (int i = 0; i < InnerList.Count; i++)
            {
                ActiveDirectorySiteLinkBridge tmp = (ActiveDirectorySiteLinkBridge)InnerList[i];
                string tmpDn = (string)PropertyManager.GetPropertyValue(tmp.context, tmp.cachedEntry, PropertyManager.DistinguishedName);

                if (Utils.Compare(tmpDn, dn) == 0)
                {
                    return(true);
                }
            }
            return(false);
        }
		public int IndexOf (ActiveDirectorySiteLinkBridge bridge)
		{
			throw new NotImplementedException ();
		}
		public void CopyTo (ActiveDirectorySiteLinkBridge[] bridges, int index)
		{
			throw new NotImplementedException ();
		}
 public static ActiveDirectorySiteLinkBridge FindByName(DirectoryContext context, string bridgeName)
 {
     return(ActiveDirectorySiteLinkBridge.FindByName(context, bridgeName, ActiveDirectoryTransportType.Rpc));
 }
		public bool Contains (ActiveDirectorySiteLinkBridge bridge)
		{
			throw new NotImplementedException ();
		}
Ejemplo n.º 13
0
        public static ActiveDirectorySiteLinkBridge FindByName(DirectoryContext context, string bridgeName, ActiveDirectoryTransportType transport)
        {
            ValidateArgument(context, bridgeName, transport);

            //  work with copy of the context
            context = new DirectoryContext(context);

            // bind to the rootdse to get the configurationnamingcontext
            DirectoryEntry de;

            try
            {
                de = DirectoryEntryManager.GetDirectoryEntry(context, WellKnownDN.RootDSE);
                string config = (string)PropertyManager.GetPropertyValue(context, de, PropertyManager.ConfigurationNamingContext);
                string containerDN = "CN=Inter-Site Transports,CN=Sites," + config;
                if (transport == ActiveDirectoryTransportType.Rpc)
                    containerDN = "CN=IP," + containerDN;
                else
                    containerDN = "CN=SMTP," + containerDN;
                de = DirectoryEntryManager.GetDirectoryEntry(context, containerDN);
            }
            catch (COMException e)
            {
                throw ExceptionHelper.GetExceptionFromCOMException(context, e);
            }
            catch (ActiveDirectoryObjectNotFoundException)
            {
                // this is the case where the context is a config set and we could not find an ADAM instance in that config set
                throw new ActiveDirectoryOperationException(Res.GetString(Res.ADAMInstanceNotFoundInConfigSet, context.Name));
            }

            try
            {
                ADSearcher adSearcher = new ADSearcher(de,
                                                      "(&(objectClass=siteLinkBridge)(objectCategory=SiteLinkBridge)(name=" + Utils.GetEscapedFilterValue(bridgeName) + "))",
                                                      new string[] { "distinguishedName" },
                                                      SearchScope.OneLevel,
                                                      false, /* don't need paged search */
                                                      false /* don't need to cache result */);
                SearchResult srchResult = adSearcher.FindOne();

                if (srchResult == null)
                {
                    // no such site link bridge object
                    Exception e = new ActiveDirectoryObjectNotFoundException(Res.GetString(Res.DSNotFound), typeof(ActiveDirectorySiteLinkBridge), bridgeName);
                    throw e;
                }
                else
                {
                    DirectoryEntry connectionEntry = srchResult.GetDirectoryEntry();
                    // it is an existing site link bridge object
                    ActiveDirectorySiteLinkBridge bridge = new ActiveDirectorySiteLinkBridge(context, bridgeName, transport, true);
                    bridge.cachedEntry = connectionEntry;
                    return bridge;
                }
            }
            catch (COMException e)
            {
                if (e.ErrorCode == unchecked((int)0x80072030))
                {
                    // if it is ADAM and transport type is SMTP, throw NotSupportedException.
                    DirectoryEntry tmpDE = DirectoryEntryManager.GetDirectoryEntry(context, WellKnownDN.RootDSE);
                    if (Utils.CheckCapability(tmpDE, Capability.ActiveDirectoryApplicationMode) && transport == ActiveDirectoryTransportType.Smtp)
                    {
                        throw new NotSupportedException(Res.GetString(Res.NotSupportTransportSMTP));
                    }
                    else
                    {
                        // object is not found since we cannot even find the container in which to search
                        throw new ActiveDirectoryObjectNotFoundException(Res.GetString(Res.DSNotFound), typeof(ActiveDirectorySiteLinkBridge), bridgeName);
                    }
                }

                throw ExceptionHelper.GetExceptionFromCOMException(context, e);
            }
            finally
            {
                de.Dispose();
            }
        }
Ejemplo n.º 14
0
 internal int Add(ActiveDirectorySiteLinkBridge bridge)
 {
     return(base.InnerList.Add(bridge));
 }
        public bool Contains(ActiveDirectorySiteLinkBridge bridge)
        {
            Contract.Requires(bridge != null);

            return(default(bool));
        }
    public bool Contains(ActiveDirectorySiteLinkBridge bridge)
    {
      Contract.Requires(bridge!= null);

      return default(bool);
    }
 public int IndexOf(ActiveDirectorySiteLinkBridge bridge)
 {
     throw new NotImplementedException();
 }
        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 CopyTo(ActiveDirectorySiteLinkBridge[] bridges, int index)
		{
			base.InnerList.CopyTo(bridges, index);
		}
Ejemplo n.º 20
0
		public static ActiveDirectorySiteLinkBridge FindByName(DirectoryContext context, string bridgeName, ActiveDirectoryTransportType transport)
		{
			DirectoryEntry directoryEntry;
			ActiveDirectorySiteLinkBridge activeDirectorySiteLinkBridge;
			ActiveDirectorySiteLinkBridge.ValidateArgument(context, bridgeName, transport);
			context = new DirectoryContext(context);
			try
			{
				directoryEntry = DirectoryEntryManager.GetDirectoryEntry(context, WellKnownDN.RootDSE);
				string propertyValue = (string)PropertyManager.GetPropertyValue(context, directoryEntry, PropertyManager.ConfigurationNamingContext);
				string str = string.Concat("CN=Inter-Site Transports,CN=Sites,", propertyValue);
				if (transport != ActiveDirectoryTransportType.Rpc)
				{
					str = string.Concat("CN=SMTP,", str);
				}
				else
				{
					str = string.Concat("CN=IP,", str);
				}
				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[] strArrays = new string[1];
					strArrays[0] = "distinguishedName";
					ADSearcher aDSearcher = new ADSearcher(directoryEntry, string.Concat("(&(objectClass=siteLinkBridge)(objectCategory=SiteLinkBridge)(name=", Utils.GetEscapedFilterValue(bridgeName), "))"), strArrays, SearchScope.OneLevel, false, false);
					SearchResult searchResult = aDSearcher.FindOne();
					if (searchResult != null)
					{
						DirectoryEntry directoryEntry1 = searchResult.GetDirectoryEntry();
						ActiveDirectorySiteLinkBridge activeDirectorySiteLinkBridge1 = new ActiveDirectorySiteLinkBridge(context, bridgeName, transport, true);
						activeDirectorySiteLinkBridge1.cachedEntry = directoryEntry1;
						activeDirectorySiteLinkBridge = activeDirectorySiteLinkBridge1;
					}
					else
					{
						Exception exception = new ActiveDirectoryObjectNotFoundException(Res.GetString("DSNotFound"), typeof(ActiveDirectorySiteLinkBridge), bridgeName);
						throw exception;
					}
				}
				catch (COMException cOMException3)
				{
					COMException cOMException2 = cOMException3;
					if (cOMException2.ErrorCode != -2147016656)
					{
						throw ExceptionHelper.GetExceptionFromCOMException(context, cOMException2);
					}
					else
					{
						DirectoryEntry directoryEntry2 = DirectoryEntryManager.GetDirectoryEntry(context, WellKnownDN.RootDSE);
						if (!Utils.CheckCapability(directoryEntry2, Capability.ActiveDirectoryApplicationMode) || transport != ActiveDirectoryTransportType.Smtp)
						{
							throw new ActiveDirectoryObjectNotFoundException(Res.GetString("DSNotFound"), typeof(ActiveDirectorySiteLinkBridge), bridgeName);
						}
						else
						{
							throw new NotSupportedException(Res.GetString("NotSupportTransportSMTP"));
						}
					}
				}
			}
			finally
			{
				directoryEntry.Dispose();
			}
			return activeDirectorySiteLinkBridge;
		}
 public static ActiveDirectorySiteLinkBridge FindByName(DirectoryContext context, string bridgeName, ActiveDirectoryTransportType transport)
 {
     DirectoryEntry directoryEntry;
     ActiveDirectorySiteLinkBridge bridge2;
     ValidateArgument(context, bridgeName, transport);
     context = new DirectoryContext(context);
     try
     {
         directoryEntry = DirectoryEntryManager.GetDirectoryEntry(context, WellKnownDN.RootDSE);
         string str = (string) PropertyManager.GetPropertyValue(context, directoryEntry, PropertyManager.ConfigurationNamingContext);
         string dn = "CN=Inter-Site Transports,CN=Sites," + str;
         if (transport == ActiveDirectoryTransportType.Rpc)
         {
             dn = "CN=IP," + dn;
         }
         else
         {
             dn = "CN=SMTP," + dn;
         }
         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
     {
         SearchResult result = new ADSearcher(directoryEntry, "(&(objectClass=siteLinkBridge)(objectCategory=SiteLinkBridge)(name=" + Utils.GetEscapedFilterValue(bridgeName) + "))", new string[] { "distinguishedName" }, SearchScope.OneLevel, false, false).FindOne();
         if (result == null)
         {
             Exception exception2 = new ActiveDirectoryObjectNotFoundException(Res.GetString("DSNotFound"), typeof(ActiveDirectorySiteLinkBridge), bridgeName);
             throw exception2;
         }
         DirectoryEntry entry2 = result.GetDirectoryEntry();
         bridge2 = new ActiveDirectorySiteLinkBridge(context, bridgeName, transport, true) {
             cachedEntry = entry2
         };
     }
     catch (COMException exception3)
     {
         if (exception3.ErrorCode != -2147016656)
         {
             throw ExceptionHelper.GetExceptionFromCOMException(context, exception3);
         }
         if (Utils.CheckCapability(DirectoryEntryManager.GetDirectoryEntry(context, WellKnownDN.RootDSE), Capability.ActiveDirectoryApplicationMode) && (transport == ActiveDirectoryTransportType.Smtp))
         {
             throw new NotSupportedException(Res.GetString("NotSupportTransportSMTP"));
         }
         throw new ActiveDirectoryObjectNotFoundException(Res.GetString("DSNotFound"), typeof(ActiveDirectorySiteLinkBridge), bridgeName);
     }
     finally
     {
         directoryEntry.Dispose();
     }
     return bridge2;
 }
        public static ActiveDirectorySiteLinkBridge FindByName(DirectoryContext context, string bridgeName, ActiveDirectoryTransportType transport)
        {
            ValidateArgument(context, bridgeName, transport);

            //  work with copy of the context
            context = new DirectoryContext(context);

            // bind to the rootdse to get the configurationnamingcontext
            DirectoryEntry de;

            try
            {
                de = DirectoryEntryManager.GetDirectoryEntry(context, WellKnownDN.RootDSE);
                string config      = (string)PropertyManager.GetPropertyValue(context, de, PropertyManager.ConfigurationNamingContext) !;
                string containerDN = "CN=Inter-Site Transports,CN=Sites," + config;
                if (transport == ActiveDirectoryTransportType.Rpc)
                {
                    containerDN = "CN=IP," + containerDN;
                }
                else
                {
                    containerDN = "CN=SMTP," + containerDN;
                }
                de = DirectoryEntryManager.GetDirectoryEntry(context, containerDN);
            }
            catch (COMException e)
            {
                throw ExceptionHelper.GetExceptionFromCOMException(context, e);
            }
            catch (ActiveDirectoryObjectNotFoundException)
            {
                // this is the case where the context is a config set and we could not find an ADAM instance in that config set
                throw new ActiveDirectoryOperationException(SR.Format(SR.ADAMInstanceNotFoundInConfigSet, context.Name));
            }

            try
            {
                ADSearcher adSearcher = new ADSearcher(de,
                                                       "(&(objectClass=siteLinkBridge)(objectCategory=SiteLinkBridge)(name=" + Utils.GetEscapedFilterValue(bridgeName) + "))",
                                                       new string[] { "distinguishedName" },
                                                       SearchScope.OneLevel,
                                                       false, /* don't need paged search */
                                                       false /* don't need to cache result */);
                SearchResult?srchResult = adSearcher.FindOne();

                if (srchResult == null)
                {
                    // no such site link bridge object
                    Exception e = new ActiveDirectoryObjectNotFoundException(SR.DSNotFound, typeof(ActiveDirectorySiteLinkBridge), bridgeName);
                    throw e;
                }
                else
                {
                    DirectoryEntry connectionEntry = srchResult.GetDirectoryEntry();
                    // it is an existing site link bridge object
                    ActiveDirectorySiteLinkBridge bridge = new ActiveDirectorySiteLinkBridge(context, bridgeName, transport, true);
                    bridge.cachedEntry = connectionEntry;
                    return(bridge);
                }
            }
            catch (COMException e)
            {
                if (e.ErrorCode == unchecked ((int)0x80072030))
                {
                    // if it is ADAM and transport type is SMTP, throw NotSupportedException.
                    DirectoryEntry tmpDE = DirectoryEntryManager.GetDirectoryEntry(context, WellKnownDN.RootDSE);
                    if (Utils.CheckCapability(tmpDE, Capability.ActiveDirectoryApplicationMode) && transport == ActiveDirectoryTransportType.Smtp)
                    {
                        throw new NotSupportedException(SR.NotSupportTransportSMTP);
                    }
                    else
                    {
                        // object is not found since we cannot even find the container in which to search
                        throw new ActiveDirectoryObjectNotFoundException(SR.DSNotFound, typeof(ActiveDirectorySiteLinkBridge), bridgeName);
                    }
                }

                throw ExceptionHelper.GetExceptionFromCOMException(context, e);
            }
            finally
            {
                de.Dispose();
            }
        }
        public static ActiveDirectorySiteLinkBridge FindByName(DirectoryContext context, string bridgeName, ActiveDirectoryTransportType transport)
        {
            DirectoryEntry directoryEntry;
            ActiveDirectorySiteLinkBridge activeDirectorySiteLinkBridge;

            ActiveDirectorySiteLinkBridge.ValidateArgument(context, bridgeName, transport);
            context = new DirectoryContext(context);
            try
            {
                directoryEntry = DirectoryEntryManager.GetDirectoryEntry(context, WellKnownDN.RootDSE);
                string propertyValue = (string)PropertyManager.GetPropertyValue(context, directoryEntry, PropertyManager.ConfigurationNamingContext);
                string str           = string.Concat("CN=Inter-Site Transports,CN=Sites,", propertyValue);
                if (transport != ActiveDirectoryTransportType.Rpc)
                {
                    str = string.Concat("CN=SMTP,", str);
                }
                else
                {
                    str = string.Concat("CN=IP,", str);
                }
                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[] strArrays = new string[1];
                    strArrays[0] = "distinguishedName";
                    ADSearcher   aDSearcher   = new ADSearcher(directoryEntry, string.Concat("(&(objectClass=siteLinkBridge)(objectCategory=SiteLinkBridge)(name=", Utils.GetEscapedFilterValue(bridgeName), "))"), strArrays, SearchScope.OneLevel, false, false);
                    SearchResult searchResult = aDSearcher.FindOne();
                    if (searchResult != null)
                    {
                        DirectoryEntry directoryEntry1 = searchResult.GetDirectoryEntry();
                        ActiveDirectorySiteLinkBridge activeDirectorySiteLinkBridge1 = new ActiveDirectorySiteLinkBridge(context, bridgeName, transport, true);
                        activeDirectorySiteLinkBridge1.cachedEntry = directoryEntry1;
                        activeDirectorySiteLinkBridge = activeDirectorySiteLinkBridge1;
                    }
                    else
                    {
                        Exception exception = new ActiveDirectoryObjectNotFoundException(Res.GetString("DSNotFound"), typeof(ActiveDirectorySiteLinkBridge), bridgeName);
                        throw exception;
                    }
                }
                catch (COMException cOMException3)
                {
                    COMException cOMException2 = cOMException3;
                    if (cOMException2.ErrorCode != -2147016656)
                    {
                        throw ExceptionHelper.GetExceptionFromCOMException(context, cOMException2);
                    }
                    else
                    {
                        DirectoryEntry directoryEntry2 = DirectoryEntryManager.GetDirectoryEntry(context, WellKnownDN.RootDSE);
                        if (!Utils.CheckCapability(directoryEntry2, Capability.ActiveDirectoryApplicationMode) || transport != ActiveDirectoryTransportType.Smtp)
                        {
                            throw new ActiveDirectoryObjectNotFoundException(Res.GetString("DSNotFound"), typeof(ActiveDirectorySiteLinkBridge), bridgeName);
                        }
                        else
                        {
                            throw new NotSupportedException(Res.GetString("NotSupportTransportSMTP"));
                        }
                    }
                }
            }
            finally
            {
                directoryEntry.Dispose();
            }
            return(activeDirectorySiteLinkBridge);
        }
		internal int Add(ActiveDirectorySiteLinkBridge bridge)
		{
			return base.InnerList.Add(bridge);
		}
    public void CopyTo(ActiveDirectorySiteLinkBridge[] bridges, int index)
    {
      Contract.Requires(bridges != null);
      Contract.Requires(index >= 0);

    }
        public static ActiveDirectorySiteLinkBridge FindByName(DirectoryContext context, string bridgeName, ActiveDirectoryTransportType transport)
        {
            DirectoryEntry directoryEntry;
            ActiveDirectorySiteLinkBridge bridge2;

            ValidateArgument(context, bridgeName, transport);
            context = new DirectoryContext(context);
            try
            {
                directoryEntry = DirectoryEntryManager.GetDirectoryEntry(context, WellKnownDN.RootDSE);
                string str = (string)PropertyManager.GetPropertyValue(context, directoryEntry, PropertyManager.ConfigurationNamingContext);
                string dn  = "CN=Inter-Site Transports,CN=Sites," + str;
                if (transport == ActiveDirectoryTransportType.Rpc)
                {
                    dn = "CN=IP," + dn;
                }
                else
                {
                    dn = "CN=SMTP," + dn;
                }
                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
            {
                SearchResult result = new ADSearcher(directoryEntry, "(&(objectClass=siteLinkBridge)(objectCategory=SiteLinkBridge)(name=" + Utils.GetEscapedFilterValue(bridgeName) + "))", new string[] { "distinguishedName" }, SearchScope.OneLevel, false, false).FindOne();
                if (result == null)
                {
                    Exception exception2 = new ActiveDirectoryObjectNotFoundException(Res.GetString("DSNotFound"), typeof(ActiveDirectorySiteLinkBridge), bridgeName);
                    throw exception2;
                }
                DirectoryEntry entry2 = result.GetDirectoryEntry();
                bridge2 = new ActiveDirectorySiteLinkBridge(context, bridgeName, transport, true)
                {
                    cachedEntry = entry2
                };
            }
            catch (COMException exception3)
            {
                if (exception3.ErrorCode != -2147016656)
                {
                    throw ExceptionHelper.GetExceptionFromCOMException(context, exception3);
                }
                if (Utils.CheckCapability(DirectoryEntryManager.GetDirectoryEntry(context, WellKnownDN.RootDSE), Capability.ActiveDirectoryApplicationMode) && (transport == ActiveDirectoryTransportType.Smtp))
                {
                    throw new NotSupportedException(Res.GetString("NotSupportTransportSMTP"));
                }
                throw new ActiveDirectoryObjectNotFoundException(Res.GetString("DSNotFound"), typeof(ActiveDirectorySiteLinkBridge), bridgeName);
            }
            finally
            {
                directoryEntry.Dispose();
            }
            return(bridge2);
        }
 public bool Contains(ActiveDirectorySiteLinkBridge bridge)
 {
     throw new NotImplementedException();
 }