Esempio n. 1
0
        public void StopTimer()
        {
            if (ProxyTimer != null)
            {
                ProxyTimer.Change(Timeout.Infinite, Timeout.Infinite);

                InternetSettings.UnsetProxy();
            }
        }
Esempio n. 2
0
        public void RotateIPAddress()
        {
            try
            {
                var startTimeSpan  = TimeSpan.Zero;
                var periodTimeSpan = TimeSpan.FromSeconds(RotateIpAddressAfter_Seconds);

                ProxyTimer = new Timer((e) =>
                {
                    string ipAddress = GetIpAddress();
                    if (!string.IsNullOrEmpty(ipAddress))
                    {
                        InternetSettings.SetProxy(ipAddress);
                    }
                }, null, startTimeSpan, periodTimeSpan);
            }
            catch (Exception ex)
            {
                Logger.Write("Exception in ProxyHelper -> DataGrabber. Message: " + ex.Message);
            }
            finally
            {
            }
        }