コード例 #1
0
        /// <summary>
        /// Is called when smart hosts ip addresses resolve operation has completed.
        /// </summary>
        /// <param name="op">Asynchronous operation.</param>
        /// <exception cref="ArgumentNullException">Is raised when <b>op</b> is null reference.</exception>
        private void SmartHostsResolveCompleted(Dns_Client.GetHostsAddressesAsyncOP op)
        {
            if (op == null)
            {
                throw new ArgumentNullException("op");
            }

            if (op.Error != null)
            {
                LogText("Failed to resolve relay smart host(s) ip addresses with error: " + op.Error.Message + ".");

                Dispose(op.Error);
            }
            else
            {
                for (int i = 0; i < op.HostEntries.Length; i++)
                {
                    Relay_SmartHost smartHost = m_pSmartHosts[i];

                    foreach (IPAddress ip in op.HostEntries[i].Addresses)
                    {
                        m_pTargets.Add(new Relay_Target(smartHost.Host, new IPEndPoint(ip, smartHost.Port), smartHost.SslMode, smartHost.UserName, smartHost.Password));
                    }
                }

                BeginConnect();
            }

            op.Dispose();
        }
コード例 #2
0
        /// <summary>
        /// Compares the current instance with another object of the same type.
        /// </summary>
        /// <param name="obj">An object to compare with this instance.</param>
        /// <returns>Returns true if two objects are equal.</returns>
        public override bool Equals(object obj)
        {
            if (obj == null)
            {
                return(false);
            }
            if (!(obj is Relay_SmartHost))
            {
                return(false);
            }

            Relay_SmartHost smartHost = (Relay_SmartHost)obj;

            if (m_Host != smartHost.Host)
            {
                return(false);
            }
            else if (m_Port != smartHost.Port)
            {
                return(false);
            }
            else if (m_SslMode != smartHost.SslMode)
            {
                return(false);
            }
            else if (m_UserName != smartHost.UserName)
            {
                return(false);
            }
            else if (m_Password != smartHost.Password)
            {
                return(false);
            }

            return(true);
        }