Exemplo n.º 1
0
        public void SetSettings(ISettings settings)
        {
            Settings = settings;

            Login     = new Rpc.Login(this);
            Player    = new Rpc.Player(this);
            Download  = new Rpc.Download(this);
            Inventory = new Rpc.Inventory(this);
            Map       = new Rpc.Map(this);
            Fort      = new Rpc.Fort(this);
            Encounter = new Rpc.Encounter(this);
            Misc      = new Rpc.Misc(this);

            Player.SetCoordinates(Settings.DefaultLatitude, Settings.DefaultLongitude, Settings.DefaultAltitude);

            ProxyEx proxy = new ProxyEx
            {
                Address  = Settings.ProxyIP,
                Port     = Settings.ProxyPort,
                Username = Settings.ProxyUsername,
                Password = Settings.ProxyPassword
            };

            HttpClientHandler handler = new HttpClientHandler
            {
                AutomaticDecompression = DecompressionMethods.GZip | DecompressionMethods.Deflate,
                AllowAutoRedirect      = false,
                Proxy    = proxy.AsWebProxy(),
                UseProxy = true,
            };

            PokemonHttpClient = new PokemonHttpClient(handler);
        }
Exemplo n.º 2
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);
        }
Exemplo n.º 3
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);
        }