Ejemplo n.º 1
0
        /// <summary>
        /// Converts a string to an instance <see cref="Socks5ProxyClient"/>. Gets a value indicating whether the conversion was successful.
        /// </summary>
        /// <param name="proxyAddress">String type - host:port:username:password.   The last three are optional.</param>
        /// <param name="result">If the conversion is successful, it contains an instance <see cref="Socks5ProxyClient"/>, otherwise <see langword="null"/>.</param>
        /// <returns>Value <see langword="true"/>, if the parameter <paramref name="proxyAddress"/> converted successfully, otherwise <see langword="false"/>.</returns>
        public static bool TryParse(string proxyAddress, out Socks5ProxyClient result)
        {
            ProxyClient proxy;

            if (ProxyClient.TryParse(ProxyType.Socks5, proxyAddress, out proxy))
            {
                result = proxy as Socks5ProxyClient;
                return(true);
            }
            else
            {
                result = null;
                return(false);
            }
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Adds a chain of new customer-Socks5 proxy.
 /// </summary>
 /// <param name="proxyAddress">String type - host:port:username:password. The last three are optional.</param>
 /// <exception cref="System.ArgumentNullException">parameter <paramref name="proxyAddress"/> equally <see langword="null"/>.</exception>
 /// <exception cref="System.ArgumentException">parameter <paramref name="proxyAddress"/> It is an empty string.</exception>
 /// <exception cref="System.FormatException">port format is wrong.</exception>
 public void AddSocks5Proxy(string proxyAddress)
 {
     _proxies.Add(Socks5ProxyClient.Parse(proxyAddress));
 }