private Account getAccount(string accountName) { Profile profile = new Profile(); profile = dbhelper.GetProfileByName(accountName); UserSessionData userSession = new UserSessionData { UserName = profile.name, Password = profile.password }; if (!string.IsNullOrEmpty(profile.proxyHost)) { ProxyData data = new ProxyData(profile.proxyHost, profile.proxyPort, profile.proxyUsername, profile.proxyPassword); Account account = new Account(userSession, proxyhandler.getProxy(data), data); return(account); } else { Account account = new Account(userSession); return(account); } }
private void SetAccounts(string tag) { Clear(); profiles = dbhelper.GetProfilesByTag(tag); //получаем данные аккаунтов из базы данных foreach (var item in profiles) { UserSessionData userSession = new UserSessionData { UserName = item.name, Password = item.password }; if (item.proxyHost != null) { ProxyData data = new ProxyData(item.proxyHost, item.proxyPort, item.proxyUsername, item.proxyPassword); accounts.Add(new Account(userSession, proxyhandler.getProxy(data), data)); Console.WriteLine("Proxies added to session"); } if (item.proxyHost == null) { accounts.Add(new Account(userSession)); } } }