Пример #1
0
        // This method will be called when the thread is started.
        public void DoWork()
        {
            while (!shutdown)
            {
                if (_Global.ProxyServers.Count != 0)
                {
                    try
                    {
                        string path = _Global.ProxyOutFilePath();
                        //_Global.log("Writing proxies to file");


                        using (var file = new System.IO.StreamWriter(path)) {
                            lock (_Global.ProxyServers)
                            {
                                foreach (ProxyServer server in _Global.ProxyServers.ToList())
                                {
                                    if (server.Status.Substring(0, 2) == "Ok" && AnonymityToInt(server.Anonymity) >= AnonymityToInt(Properties.Settings.Default.ProxyMinAnonymity))
                                    {
                                        file.WriteLine(server.Ip + ":" + server.Port);
                                    }
                                }
                            }
                        }

                        _Form.Invoke((MethodInvoker) delegate
                        {
                            _labelOutFileTime.Text      = DateTime.Now.ToShortTimeString();
                            _labelProxyOutFilePath.Text = path;
                        });
                    }
                    catch (Exception ex)
                    {
                        _Global.log("Can not writ to out file: " + ex.Message);
                    }
                }

                Thread.Sleep(10000);
            }
        }
Пример #2
0
 private void buttonOutFileOpen_Click(object sender, EventArgs e)
 {
     Process.Start("notepad.exe", Global.ProxyOutFilePath());
 }