public void QueueAccount(string email, string password) { if (_accounts.All(account => account.Email != email)) { Account acc = new Account(email, password); _accounts.Add(acc); } }
private void GetAccountToken(Account account) { using (System.Windows.Forms.WebBrowser wb = new System.Windows.Forms.WebBrowser()) { wb.DocumentCompleted += wb_DocumentCompleted; wb.Tag = account; wb.ScriptErrorsSuppressed = true; wb.Url = new Uri(string.Format("file:///{0}", Path.GetFullPath("md.html"))); System.Windows.Forms.Application.Run(); } }
public MetadataFinder(Account account) { _account = account; }
public CheckParams(Account account) { Account = account; }
public static Dictionary<string, string> ParseAccountAttributes(Account account, string metadata) { var random = new Random(); var attributes = new Dictionary<string, string> { {"email", account.Email}, {"create", "0"}, {"password", account.Password}, {"x", random.Next(1, 201).ToString()}, {"y", random.Next(1, 22).ToString()}, {"metadata1", metadata} }; return attributes; }
private async Task GatherGiftCardBalanceAsync(NetHelper nHelper, Account account) { var task = Task.Factory.StartNew(() => { try { account.GiftCardBalance = Regex.Match(nHelper.GET(Globals.GC_URL), Globals.GC_REGEX).Groups[1].Value; } catch (Exception exception) { _logger.Debug("error while gather GiftCardBalance"); _logger.Error(exception); account.GiftCardBalance = "N/A"; } }); await task; }
public async Task GatherAddyInfosAsync(NetHelper nHelper, Account account) { var task = Task.Factory.StartNew(() => { try { string pageCode = nHelper.GET(Globals.ADDY_URL); string addyId = Regex.Match(pageCode, Globals.REGEX.Replace(" />", ">")).Groups[2].Value; string addyInfos = nHelper.GET(string.Format(Globals.FULLADDY_URL, addyId)); //account.ZipCode = HtmlParser.GetElementValueById(addyInfos, "enterAddressPostalCode"); //account.Phone = HtmlParser.GetElementValueById(addyInfos, "enterAddressPhoneNumber"); Regex attributesRegex = new Regex(Globals.REGEX, RegexOptions.Multiline | RegexOptions.IgnoreCase); foreach (Match m in attributesRegex.Matches(addyInfos)) { var addy = m.Groups[1].Value; if (addy == "oldPostalCode") account.ZipCode = m.Groups[2].Value; else if (addy == "oldPhoneNumber") account.Phone = m.Groups[2].Value; else _logger.Info(string.Format("unknown ADDY info:'{0}'", addy)); } } catch (Exception exception) { _logger.Debug("error while gather addy info"); _logger.Error(exception); account.ZipCode = "N/A"; account.Phone = "N/A"; } }); await task; }
public void GatherInformation(NetHelper nHelper, Account account) { var tasks = new List<Task>(new[] { GatherGiftCardBalanceAsync(nHelper, account), GatherOrdersAsync(nHelper, account), GatherAddyInfosAsync(nHelper, account) }); Task.WhenAll(tasks).Wait(); }