예제 #1
0
        public static bool TryParse(string combo, out ProxyEx result)
        {
            result = new ProxyEx();

            string[] parts = combo.Split(':');

            if (parts.Length != 2 && parts.Length != 4)
            {
                //throw new ArgumentException("proxyCombo must be in the format IP:PORT or IP:PORT:USERNAME:PASSWORD");

                return(false);
            }

            int port = 0;

            if (!Int32.TryParse(parts[1], out port))
            {
                //throw new ArgumentException(String.Format("Invalid port value \"{0}\"", parts[1]));

                return(false);
            }

            result.Address = parts[0];
            result.Port    = port;

            if (parts.Length == 4)
            {
                result.Username = parts[2];
                result.Password = parts[3];
            }

            return(true);
        }
예제 #2
0
        public override bool Equals(object obj)
        {
            ProxyEx proxyEx = obj as ProxyEx;

            if (proxyEx == null)
            {
                return(base.Equals(obj));
            }

            return(proxyEx.Address == this.Address && proxyEx.Port == this.Port);
        }