/// <summary> /// При закрытии формы все очищаем и сохраняем настройки /// </summary> private void MainForm_FormClosing(object sender, FormClosingEventArgs e) { ProxyLib.UnregisterCallback(); FillSettingsFromFormValues(); _settings.Save(); }
public static ProxyLib GetGeo(ProxyLib prx) { prx.Country = "N/A"; prx.Region = "N/A"; prx.City = "N/A"; string end = Libraries.NET.GetSource(Globals.Globals.Geolocation.Replace("<IP>", prx.Proxy.Split(':')[0]).Replace("<PORT>", prx.Proxy.Split(':')[1])); if (end != "") { prx.Country = new Regex(Globals.Globals.Geolocation_country).Match(end).Groups[1].Value; prx.Region = new Regex(Globals.Globals.Geolocation_region).Match(end).Groups[1].Value; prx.City = new Regex(Globals.Globals.Geolocation_city).Match(end).Groups[1].Value; } if (prx.Region == "") { prx.Region = "N/A"; } if (prx.City == "") { prx.City = "N/A"; } return(prx); }
private void btnControl_Click(object sender, EventArgs e) { var btn = (Button)sender; if (btn == null) { return; } // bad bad bad practice switch (btn.Name) { case "btnSwipeUp": lblAction.Text = "Swipe Up"; ProxyLib.RegMenuDispatchScreen((byte)GestureEnum.GESTURE_SWIPE_UP, 0, 0); btnSwipeUp.Focus(); break; case "btnSwipeDown": lblAction.Text = "Swipe Down"; ProxyLib.RegMenuDispatchScreen((byte)GestureEnum.GESTURE_SWIPE_DOWN, 0, 0); btnSwipeDown.Focus(); break; case "btnSwipeLeft": lblAction.Text = "Swipe Left"; ProxyLib.RegMenuDispatchScreen((byte)GestureEnum.GESTURE_SWIPE_LEFT, 0, 0); btnSwipeLeft.Focus(); break; case "btnSwipeRight": lblAction.Text = "Swipe Right"; ProxyLib.RegMenuDispatchScreen((byte)GestureEnum.GESTURE_SWIPE_RIGHT, 0, 0); btnSwipeRight.Focus(); break; case "btnClick": lblAction.Text = "Click"; ProxyLib.RegMenuDispatchScreen((byte)GestureEnum.GESTURE_CLICK, 176 / 2, 176 / 2); btnClick.Focus(); break; case "btnShortKeypress": lblAction.Text = "Short Keypress"; ProxyLib.RegMenuKeyPress(); btnShortKeypress.Focus(); break; case "btnLongKeypress": lblAction.Text = "Long Keypress"; ProxyLib.RegMenuLongKeyPress(); btnLongKeypress.Focus(); break; default: System.Diagnostics.Debug.WriteLine($"UNKNOWN BUTTON: {btn.Name} IN btnControl_Click"); break; } }
private void MainForm_Load(object sender, EventArgs e) { // пробуем загрузить файл шрифтов if (string.IsNullOrEmpty(tbFontFilename.Text) || !File.Exists(tbFontFilename.Text)) { MessageBox.Show("Font file don't exist or not selected!" + Environment.NewLine + "Check Options Tab!", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning); } // регистрируем функцию обратного вызова _callback = new ProxyLib.Callback(CallbackParser); ProxyLib.RegisterCallback(_callback); // запускаем на выполнение программу, которая эмулируется ProxyLib.MainRun(); }
public static ProxyLib Judge(ProxyLib proxy) { proxy.Alive = false; proxy.Anonymity_type = Anonymity.Unknown; List <string> MustContain = new List <string>(); MustContain.Add("HTTP_X_FORWARDED_FOR"); MustContain.Add("REMOTE_ADDR"); Stopwatch stopwatch = new Stopwatch(); stopwatch.Start(); string end = Libraries.NET.GetSource(Globals.Globals.Judge.Replace("<IP>", proxy.Proxy.Split(':')[0]).Replace("<PORT>", proxy.Proxy.Split(':')[1])); stopwatch.Stop(); if (end != "") { if (MustContain.Any(s => end.Contains(s))) { string str1 = new Regex("HTTP_X_FORWARDED_FOR = (.*?)\n").Match(end).Groups[1].Value; string str2 = new Regex("REMOTE_ADDR = (.*?)\n").Match(end).Groups[1].Value; if (end.Contains(Globals.Globals.IPAddress)) { proxy.Anonymity_type = Anonymity.Transparent; } else if (EliteHeadersOnly(end)) { proxy.Anonymity_type = Anonymity.Elite; } else if (!end.Contains(Globals.Globals.IPAddress)) { proxy.Anonymity_type = Anonymity.Anonymous; } } } if (proxy.Anonymity_type != Anonymity.Unknown) { proxy.Alive = true; } return(proxy); }
/// <summary> /// Перехватываем сообщения с клавиатуры и передаем их прокси /// </summary> /// <returns></returns> public bool PreFilterMessage(ref Message m) { if (m.Msg != 0x0100) { return(false); } switch ((Keys)m.WParam.ToInt32()) { case Keys.Up: lblAction.Text = "Swipe Up"; ProxyLib.RegMenuDispatchScreen((byte)GestureEnum.GESTURE_SWIPE_UP, 0, 0); btnSwipeUp.Focus(); break; case Keys.Down: lblAction.Text = "Swipe Down"; ProxyLib.RegMenuDispatchScreen((byte)GestureEnum.GESTURE_SWIPE_DOWN, 0, 0); btnSwipeDown.Focus(); break; case Keys.Left: lblAction.Text = "Swipe Left"; ProxyLib.RegMenuDispatchScreen((byte)GestureEnum.GESTURE_SWIPE_LEFT, 0, 0); btnSwipeLeft.Focus(); break; case Keys.Right: lblAction.Text = "Swipe Right"; ProxyLib.RegMenuDispatchScreen((byte)GestureEnum.GESTURE_SWIPE_RIGHT, 0, 0); btnSwipeRight.Focus(); break; default: return(false); } return(true); }
private void WatchScreen_MouseUp(object sender, MouseEventArgs e) { var dx = e.X - _mouseDownPoint.X; var dy = e.Y - _mouseDownPoint.Y; if (Math.Abs(dx) < _settings.MaxDistanceClick && Math.Abs(dy) < _settings.MaxDistanceClick) { lblAction.Text = "Click"; ProxyLib.RegMenuDispatchScreen((byte)GestureEnum.GESTURE_CLICK, _mouseDownPoint.X, _mouseDownPoint.Y); btnClick.Focus(); } else if (Math.Abs(dx) > Math.Abs(dy)) { lblAction.Text = dx < 0 ? "Swipe Left" : "Swipe Right"; ProxyLib.RegMenuDispatchScreen(dx < 0 ? (byte)GestureEnum.GESTURE_SWIPE_LEFT : (byte)GestureEnum.GESTURE_SWIPE_RIGHT, e.X, e.Y); if (dx < 0) { btnSwipeLeft.Focus(); } else { btnSwipeRight.Focus(); } } else { lblAction.Text = dy < 0 ? "Swipe Up" : "Swipe Down"; ProxyLib.RegMenuDispatchScreen(dy < 0 ? (byte)GestureEnum.GESTURE_SWIPE_UP : (byte)GestureEnum.GESTURE_SWIPE_DOWN, e.X, e.Y); if (dy < 0) { btnSwipeUp.Focus(); } else { btnSwipeDown.Focus(); } } }
void Check() { lvProxies.Update(); try { Globals.IPAddress = Helpers.GetIP(); while (check_index < Lists.Proxies.Count) { if (stop) { break; } ProxyLib proxy = Lists.Proxies.ElementAt(check_index); check_index++; proxy.Date_initiated = DateTime.Now.ToString("yyyy-mm-dd"); proxy.Time_initiated = DateTime.Now.ToString("hh:mm:ss tt"); lblStatus.Text = "Checking proxies..."; proxy = Checker.Judge(proxy); if (proxy.Alive) { proxy = Checker.GetGeo(proxy); alive++; if (proxy.Anonymity_type == Assets.Libraries.Enums.Anonymity.Transparent) { transparent++; } else if (proxy.Anonymity_type == Assets.Libraries.Enums.Anonymity.Anonymous) { anonymous++; } else if (proxy.Anonymity_type == Assets.Libraries.Enums.Anonymity.Elite) { elite++; } Lists.Checked_proxies.Add(proxy); if (!Globals.Disable_listview) { lvProxies.Items.Add(new ListViewItem(new string[] { proxy.Proxy, proxy.Anonymity_type.ToString(), proxy.Country, proxy.Region, proxy.City, proxy.Response_time.ToString(), proxy.Time_initiated })); } lblTransProxies.Text = string.Format("Transparent: {0}", transparent); lblAnonProxies.Text = string.Format("Anonymous: {0}", anonymous); lblEliteProxies.Text = string.Format("Elite: {0}", elite); lblWorkingProxies.Text = string.Format("Working proxies: {0}", alive); } else { dead++; } check++; lblDeadProxies.Text = string.Format("Dead proxies: {0}", dead); } GC.Collect(); GC.WaitForPendingFinalizers(); } catch { } finally { lvProxies.EndUpdate(); Task.Factory.StartNew(() => { Halt(); }); } }