public static bool CheckProxy(ProxyClient proxyClient) { try { using (HttpRequest request = new HttpRequest()) { request.UserAgent = GetUserAgent.get(); request.EnableEncodingContent = true; request.Proxy = proxyClient; request.Get(ProxyCheckLink); if (request.Response != null) { return(true); } } } catch {}; return(false); }
public static void RegistrationAccount() { try { string Password, UserAgent, NameSurname; string proxyLog = ""; ProxyClient proxyClient; while (true) { SaveData.WriteToLog($"System", "Попытка получить номер"); (string tzid, string number)number = GetSmsReg.GetNumber(); #region Выдача аккаунтов lock (locker) { if (SaveData.UsedRegistration < CountAccountForRegistration) { (string NameSurname, string Password)DataForRegistration = GetNameSurnamePassword.Get(); if (String.IsNullOrEmpty(DataForRegistration.NameSurname) || String.IsNullOrEmpty(DataForRegistration.Password) || string.IsNullOrEmpty(number.number)) { continue; } NameSurname = DataForRegistration.NameSurname; Password = DataForRegistration.Password; SaveData.UsedRegistration++; SaveData.SaveAccount($"{number.number}:{Password}", SaveData.ProcessedRegistrationList); } else { break; } UserAgent = GetUserAgent.get(); proxyClient = GetProxy.get(); proxyLog = proxyClient == null ? "" : $";{proxyClient.ToString()}"; } #endregion #region Вызов метода регистрации, и проверка результата SaveData.WriteToLog($"{number.number}:{Password}", "Попытка зарегестрировать аккаунт"); (Status status, CookieStorage cookie)Data; for (int i = 0; i < countRequest; i++) { Data = GoRegistrationAccount(NameSurname, number, Password, UserAgent, proxyClient); switch (Data.status) { case Status.True: SaveData.GoodRegistration++; SaveData.WriteToLog($"{number.number}:{Password}", "Аккаунт успешно зарегестрирован"); SaveData.SaveAccount($"{number.number}:{Password}{proxyLog}|{UserAgent}", SaveData.GoodRegistrationList); Data.cookie.SaveToFile($"out/cookies/{number.number}.jar", true); break; case Status.False: SaveData.InvalidRegistration++; SaveData.WriteToLog($"{number.number}:{Password}", "Аккаунт не зарегестрирован"); SaveData.SaveAccount($"{number.number}:{Password}{proxyLog}|{UserAgent}", SaveData.InvalidRegistrationList); break; default: SaveData.WriteToLog($"{number.number}:{Password}", "Неизвестная ошибка, повторяем."); UserAgent = GetUserAgent.get(); proxyClient = GetProxy.get(); continue; } break; } int sleep = rand.Next(minPauseRegistration, maxPauseRegistration); SaveData.WriteToLog($"System", $"Засыпаем на {sleep/60000} минут"); Thread.Sleep(sleep); #endregion } } catch (Exception exception) { MessageBox.Show(exception.Message); } }