private bool PopulateImageList(SupremeList _list) { if (Images == null) { Images = new ImageList(); Images.ImageSize = new Size(120, 120); } else { Images.Images.Clear(); } foreach (SupremeItem item in _list) { try { Images.Images.Add(LoadImage("http:" + item.Product)); } catch (Exception) { Images.Images.Add(Properties.Resources.error); } } return(true); }
private int ListGenerator(int i) { int ret = -1; if (List == null) { List = new SupremeList(i); if (List.Executed) { ret = default(int); } else { List = null; } } else { SupremeList Tmp = new SupremeList(i); if (Tmp.Executed) { if (List.Count() != Tmp.Count()) { List = Tmp; ret = default(int); } else if (!List.SequenceEqual(Tmp, new SupremeComparer())) { List = Tmp; ret = 1; } } else { Tmp = null; } } return(ret); }
private void GeneratePictureBoxImage(SupremeList _list, int i) { if (this.pictureBox1.InvokeRequired) { SetPictureBoxCallback p = new SetPictureBoxCallback(GeneratePictureBoxImage); this.Invoke(p, new object[] { _list, i }); } else { switch (i) { case 0: if (!Block) { if (Navigation != 0) { Navigation--; } pictureBox1.Image = Images.Images[Navigation]; } break; case 1: if (!Block) { if (Navigation != _list.Count() - 1) { Navigation++; } pictureBox1.Image = Images.Images[Navigation]; } break; default: Navigation = default(int); pictureBox1.Image = Images.Images[Navigation]; if (Type != 0) { pictureBox1.Cursor = Cursors.Hand; } else { pictureBox1.Cursor = Cursors.Help; } Block = false; break; } if (!Block) { if (_list[Navigation].Sold) { toolTip1.SetToolTip(pictureBox1, _list[Navigation].Name + " : SOLD OUT"); } else { toolTip1.SetToolTip(pictureBox1, _list[Navigation].Name); } } EmptyWorkingSet(Process.GetCurrentProcess().Handle); } }
void AI() { HtmlAgilityPack.HtmlDocument Doc = null; HtmlAgilityPack.HtmlDocument Tmp = null; List <int> Items = Enumerable.Range(0, Proposal.Count).ToList(); List <int> PurchasedItems = new List <int>(); while (Heartbeat) { foreach (int Item in Items.Reverse <int>()) { #region Artificial Intelligence try { #region Propsal & Supreme - Tag value verifiction comparer navigator SupremeList List = null; if (!string.IsNullOrEmpty(Proposal[Item].Tag)) { List = new SupremeList(0); if (!List.Executed) { continue; } Doc = null; for (int a = 0; a < List.Count; a++) { if (Compute(Proposal[Item].Tag, List[a].Name) < 4 || List[a].Name.Contains(Proposal[Item].Tag)) { Doc = new HtmlAgilityPack.HtmlDocument(); Doc.LoadHtml(new WebClient().DownloadString("http://www.supremenewyork.com" + List[a].Href)); Form1.webBrowser1.Navigate(new Uri("about:blank")); Form1.webBrowser1.Navigate("http://www.supremenewyork.com" + List[a].Href); break; } } if (Doc == null) { continue; } } #endregion #region Propsal & Supreme - Design value verification comparer navigator SupremeList Design = null; if (!string.IsNullOrEmpty(Proposal[Item].Design)) { Design = new SupremeList(Doc.DocumentNode.SelectNodes("//div[@id='details'] //li")); if (!Design.Executed) { continue; } Tmp = null; for (int s = 0; s < Design.Count; s++) { if (Compute(Proposal[Item].Design, Design[s].Design) < 1 || Design[s].Design.Contains(Proposal[Item].Design)) { if (!Design[s].Sold) { Tmp = new HtmlAgilityPack.HtmlDocument(); Tmp.LoadHtml(new WebClient().DownloadString("http://www.supremenewyork.com" + Design[s].Href)); Form1.webBrowser1.Navigate(new Uri("about:blank")); Form1.webBrowser1.Navigate("http://www.supremenewyork.com" + Design[s].Href); break; } } } if (Tmp == null) { continue; } } #endregion Thread.Sleep(3000); #region Proposal & Supreme - Size value verification event #region List value event System.Windows.Forms.HtmlElement SupremeSize = null; if (!string.IsNullOrEmpty(Proposal[Item].Size)) { SupremeSize = Form1.SupremeSize; System.Windows.Forms.HtmlElementCollection Options = SupremeSize.Children; foreach (System.Windows.Forms.HtmlElement element in Options) { if (Compute(Proposal[Item].Size, element.InnerText) < 1) { SupremeSize.SetAttribute("value", GetSubstringByString("=", ">", element.OuterHtml)); SupremeSize.InvokeMember("onchange"); SupremeSize.InvokeMember("click"); break; } } } #endregion #endregion Thread.Sleep(3000); #region Supreme - Add to cart button event #region Button event System.Windows.Forms.HtmlElement SupremeAddButton = null; SupremeAddButton = Form1.SupremeAddButton; System.Windows.Forms.HtmlElementCollection AddButton = SupremeAddButton.Children; foreach (System.Windows.Forms.HtmlElement element in AddButton) { if (element.GetAttribute("value").Equals("add to cart")) { element.InvokeMember("submit"); element.InvokeMember("click"); break; } } #endregion #endregion Thread.Sleep(3000); Form1.webBrowser1.Navigate("https://www.supremenewyork.com/checkout"); Thread.Sleep(3000); #region Supreme - Billing/Shipping information event #region Textbox value event System.Windows.Forms.HtmlElement SupremeCartAddress = null; SupremeCartAddress = Form1.SupremeCartAddress; SupremeCartAddress.Document.GetElementById("order_billing_name").SetAttribute("value", Information[0].Name); SupremeCartAddress.Document.GetElementById("order_email").SetAttribute("value", Information[0].Email); SupremeCartAddress.Document.GetElementById("order_tel").SetAttribute("value", Information[0].Tel); SupremeCartAddress.Document.GetElementById("bo").SetAttribute("value", Information[0].Address); SupremeCartAddress.Document.GetElementById("order_billing_zip").SetAttribute("value", Information[0].Zip); SupremeCartAddress.Document.GetElementById("order_billing_city").SetAttribute("value", Information[0].City); #endregion #region List value event mshtml.HTMLSelectElement SupremeCountry = null; if (Information[0].Country != "USA") { SupremeCountry = Form1.SupremeCountry; SupremeCountry.selectedIndex = 1; SupremeCountry.click(); SupremeCountry.FireEvent("onchange"); } // you can copy the format below to select any EUROPEAN country here...as of right now this code only works for the NORTH AMERICAN shipping System.Windows.Forms.HtmlElement SupremeState = null; SupremeState = Form1.SupremeState; System.Windows.Forms.HtmlElementCollection State = SupremeState.Children; foreach (System.Windows.Forms.HtmlElement element in State) { if (element.InnerText == Information[0].State) { SupremeState.SetAttribute("value", Information[0].State); SupremeState.InvokeMember("onchange"); SupremeState.InvokeMember("click"); break; } } #endregion #endregion Thread.Sleep(3000); #region Supreme - Credit card information event #region List value event System.Windows.Forms.HtmlElement SupremeType = null; SupremeType = Form1.SupremeType; System.Windows.Forms.HtmlElementCollection Type = SupremeType.Children; foreach (System.Windows.Forms.HtmlElement element in Type) { if (element.InnerText == Information[0].Type) { SupremeType.SetAttribute("value", FormatType(Information[0].Type)); SupremeType.InvokeMember("onchange"); SupremeType.InvokeMember("click"); break; } } System.Windows.Forms.HtmlElement SupremeMonth = null; SupremeMonth = Form1.SupremeMonth; System.Windows.Forms.HtmlElementCollection Month = SupremeMonth.Children; foreach (System.Windows.Forms.HtmlElement element in Month) { if (element.InnerText == Information[0].Expiry.Substring(0, 2)) { SupremeMonth.SetAttribute("value", Information[0].Expiry.Substring(0, 2)); SupremeMonth.InvokeMember("onchange"); SupremeMonth.InvokeMember("click"); break; } } System.Windows.Forms.HtmlElement SupremeYear = null; SupremeYear = Form1.SupremeYear; System.Windows.Forms.HtmlElementCollection Year = SupremeYear.Children; foreach (System.Windows.Forms.HtmlElement element in Year) { if (element.InnerText == Information[0].Expiry.Substring(2, 5).Trim()) { SupremeYear.SetAttribute("value", Information[0].Expiry.Substring(2, 5).Trim()); SupremeYear.InvokeMember("onchange"); SupremeYear.InvokeMember("click"); break; } } #endregion #region Textbox value event System.Windows.Forms.HtmlElement SupremeCartCC = null; SupremeCartCC = Form1.SupremeCartCC; SupremeCartCC.Document.GetElementById("cnb").SetAttribute("value", Information[0].Number); SupremeCartCC.Document.GetElementById("vval").SetAttribute("value", Information[0].Cvv); #endregion #region Checkbox event System.Windows.Forms.HtmlElementCollection Term = null; Term = Form1.SupremeTerm; foreach (System.Windows.Forms.HtmlElement element in Term) { if (element.GetAttribute("className") == "icheckbox_minimal") { if (element.FirstChild.Id == "order_terms") { element.SetAttribute("className", "icheckbox_minimal checked"); break; } } } #endregion #region Button event System.Windows.Forms.HtmlElement SupremeProcessButton = null; SupremeProcessButton = Form1.SupremeProcessButton; System.Windows.Forms.HtmlElementCollection Pay = SupremeProcessButton.Children; foreach (System.Windows.Forms.HtmlElement element in Pay) { if (element.GetAttribute("value").Equals("process payment")) { element.InvokeMember("click"); break; } } #endregion #endregion Thread.Sleep(5000); Form1.BotBuddha(2); Thread.Sleep(3000); PurchasedItems.Add(Item); Items.Remove(Item); if (PurchasedItems.Count != Proposal.Count) { Form1.BotBuddha(3); } else { Form1.BotBuddha(0); } } catch (Exception) { } #endregion } } }