Exemplo n.º 1
0
        /// <summary>
        /// Release resources.
        /// </summary>
        /// <param name = "disposing">
        /// If disposing equals true, Managed and unmanaged resources are disposed. if false, Only unmanaged resources
        /// can be disposed.
        /// </param>
        protected virtual void Dispose(bool disposing)
        {
            if (!this.disposed)
            {
                // If disposing equals true, dispose all managed and unmanaged resources.
                if (disposing)
                {
                    // Free managed resources & other reference types:
                    if (this.transportStack != null)
                    {
                        this.transportStack.Dispose();
                        this.transportStack = null;
                    }
                    if (this.security != null)
                    {
                        this.security.Dispose();
                        this.security = null;
                    }
                    this.config  = null;
                    this.encoder = null;
                    this.decoder = null;
                }

                // Call the appropriate methods to clean up unmanaged resources.
                // If disposing is false, only the following code is executed:

                this.disposed = true;
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Constructor.
        /// </summary>
        /// <param name="ldapVersion">The LDAP version that client uses.</param>
        /// <param name="config">
        /// The transport stack configuration. Note that for ADTS-LDAP, only socket transport is supported.
        /// </param>
        /// <exception cref="StackException">Thrown when the TransportConfig is not SocketTransportConfig</exception>
        /// <exception cref="ArgumentException">
        /// Thrown when the stack transport type is neither TCP nor UDP.
        /// </exception>
        public AdtsLdapClient(AdtsLdapVersion ldapVersion, TransportConfig config)
        {
            this.ldapVersion = ldapVersion;
            this.config      = config;

            if (ldapVersion == AdtsLdapVersion.V2)
            {
                this.encoder = new AdtsLdapV2Encoder();
            }
            else
            {
                this.encoder = new AdtsLdapV3Encoder();
            }
        }
        /// <summary>
        /// Constructor.
        /// </summary>
        /// <param name="ldapVersion">The LDAP version that client uses.</param>
        /// <param name="config">
        /// The transport stack configuration. Note that for ADTS-LDAP, only socket transport is supported.
        /// </param>
        /// <exception cref="StackException">Thrown when the TransportConfig is not SocketTransportConfig</exception>
        /// <exception cref="ArgumentException">
        /// Thrown when the stack transport type is neither TCP nor UDP.
        /// </exception>
        public AdtsLdapClient(AdtsLdapVersion ldapVersion, TransportConfig config)
        {
            this.ldapVersion = ldapVersion;
            this.config = config;

            if (ldapVersion == AdtsLdapVersion.V2)
            {
                this.encoder = new AdtsLdapV2Encoder();
            }
            else
            {
                this.encoder = new AdtsLdapV3Encoder();
            }
        }
        /// <summary>
        /// Release resources. 
        /// </summary>
        /// <param name = "disposing">
        /// If disposing equals true, Managed and unmanaged resources are disposed. if false, Only unmanaged resources 
        /// can be disposed. 
        /// </param>
        protected virtual void Dispose(bool disposing)
        {
            if (!this.disposed)
            {
                // If disposing equals true, dispose all managed and unmanaged resources.
                if (disposing)
                {
                    // Free managed resources & other reference types:
                    if (this.transportStack != null)
                    {
                        this.transportStack.Dispose();
                        this.transportStack = null;
                    }
                    if (this.security != null)
                    {
                        this.security.Dispose();
                        this.security = null;
                    }
                    this.config = null;
                    this.encoder = null;
                    this.decoder = null;
                }

                // Call the appropriate methods to clean up unmanaged resources.
                // If disposing is false, only the following code is executed:

                this.disposed = true;
            }
        }