Ejemplo n.º 1
0
        /// <summary>
        /// Converts a string to an instance <see cref="Socks4aProxyClient"/>. Gets a value indicating whether the conversion was successfully.
        /// </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="Socks4aProxyClient"/>, otherwise <see langword="null"/>.</param>
        /// <returns>Value <see langword="true"/>, if the parameter <paramref name="proxyAddress"/> It converted successfully, otherwise <see langword="false"/>.</returns>
        public static bool TryParse(string proxyAddress, out Socks4aProxyClient result)
        {
            ProxyClient proxy;

            if (ProxyClient.TryParse(ProxyType.Socks4a, proxyAddress, out proxy))
            {
                result = proxy as Socks4aProxyClient;
                return(true);
            }
            else
            {
                result = null;
                return(false);
            }
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Adds a new chain Socks4a-proxy client.
 /// </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 AddSocks4aProxy(string proxyAddress)
 {
     _proxies.Add(Socks4aProxyClient.Parse(proxyAddress));
 }