Esempio n. 1
0
 // Token: 0x060002A2 RID: 674 RVA: 0x0002AF00 File Offset: 0x00029100
 private void CheckDirectSku()
 {
     Account[] array = (from acc in this.NdcAccounts
                        where acc.Size.Length == 2 && acc.Size.First <string>().Length > 4
                        select acc).ToArray <Account>();
     if (array.IsAny <Account>())
     {
         this.GetProductDetails();
         if (this.Pid.IsNullOrWhiteSpace())
         {
             return;
         }
         foreach (Account account in array)
         {
             KeyValuePair <Account, string> item2 = new KeyValuePair <Account, string>(account, this.Link);
             if (!MonitorLink.ProcessedLinks.Contains(item2))
             {
                 MonitorLink.ProcessedLinks.Add(item2);
                 AtcItem item = new AtcItem(item2.Key, item2.Value, account.Size[1])
                 {
                     Details =
                     {
                         ProductId    = this.Pid,
                         Line1        = this.Line1,
                         Line2        = this.Line2,
                         StyleCode    = this.StyleCode,
                         ProductImage = this.Img,
                         Price        = this.Price,
                         Size         = account.Size[1],
                         SkuId        = account.Size[0],
                         SkuAndSize   = "{0}:{1}".With(new object[]
                         {
                             account.Size[0],
                             account.Size[1]
                         })
                     }
                 };
                 new Thread(delegate()
                 {
                     new AddToCart(item, this)
                     {
                         ForceOldMethod = Form1.ForceOldMethod
                     }.Atc();
                 }).Start();
                 Logger.Log("{0} (Size {2}): Processing link {1}".With(new object[]
                 {
                     account.EmailAddress,
                     this.Link,
                     account.Size[1]
                 }), true, true);
             }
             Logger.Log("{0}: Link {1} has already been processed.".With(new object[]
             {
                 account.EmailAddress,
                 this.Link
             }), true, true);
             this.NdcAccounts.Remove(account);
         }
     }
 }
 // Token: 0x060001EF RID: 495 RVA: 0x00022014 File Offset: 0x00020214
 public static string ReplacePlaceholders(this string str, AtcItem item)
 {
     if (item.IsNullOrDefault <AtcItem>())
     {
         item = new AtcItem(new Account("*****@*****.**", "pass", "10", "", "", "", "", "", "", "", null, false), "http://store.nike.com/us/en_us/pd/zoom-field-general-training-shoe/pid-1546292/pgid-10266634", "10")
         {
             Details = new ProductDetails
             {
                 Line1        = "Nike Zoom Field General (Ohio State)",
                 Line2        = "Men's Training Shoe",
                 Price        = "130.0",
                 ProductImage = "http://images.nike.com/is/image/DotCom/THN_PS/Nike-Zoom-Field-General-Ohio-State-Mens-Training-Shoe-654859_061.jpg?hei=620&wid=620&fmt=png",
                 Size         = "10",
                 StyleCode    = "654859-061"
             }
         };
     }
     return(str.ReplaceStringArray(NotificationSettings.AvailableFields, new string[]
     {
         item.Account.EmailAddress + (Form1.SendPassword ? ", password: {0}".With(new object[]
         {
             item.Account.Password
         }) : ""),
         item.SnkrsBuyUrl.IsNullOrWhiteSpace() ? NikeUrls.NikeCart : item.SnkrsBuyUrl,
         item.Details.Line2,
         item.Details.ProductImage,
         item.Url,
         item.Details.Line1,
         item.Details.Price,
         item.Details.Size,
         item.Details.StyleCode,
         NotificationSettings.ServiceLink,
         NotificationSettings.ServiceLogoImage,
         NotificationSettings.ServiceName,
         NotificationSettings.ServiceTwitterHandle
     }));
 }
Esempio n. 3
0
        // Token: 0x060002A8 RID: 680 RVA: 0x0002BE90 File Offset: 0x0002A090
        private bool MonitorLoadSkus()
        {
            string html = "";

            if (this.StyleCode.IsNullOrWhiteSpace())
            {
                this.GetProductDetails();
            }
            if (this.Pid.IsNullOrWhiteSpace())
            {
                return(true);
            }
            bool result;

            try
            {
                string text = NikeUrls.NikeLoadSkus.With(new object[]
                {
                    this.Pid
                });
                html = null;
                try
                {
                    html = Form1.ResponseDictionary[text];
                }
                catch (Exception)
                {
                }
                html = (html ?? this.NdcAccounts.GetRandom <Account>().Request.GetRequest(text, null, null, true, true));
                if (html.Contains("nike_Cart_handleJCartResponse"))
                {
                    throw new Exception("Sizes are not yet live...");
                }
                if (html.Contains("xml version="))
                {
                    if (Form1.SiteType == SiteType.NikeCN)
                    {
                        Form1.ForceOldMethod = true;
                        return(false);
                    }
                    html = html.Trim(new char[]
                    {
                        '}',
                        '{'
                    });
                    html = ((!html.Contains("<response>") || html.Contains("</response>")) ? html : (html + "</response>"));
                    XmlDocument xmlDocument = new XmlDocument();
                    xmlDocument.LoadXml(html);
                    html = JsonConvert.SerializeXmlNode(xmlDocument["response"]);
                    html = JObject.Parse(html)["response"].ToString();
                }
                JObject jobject = JObject.Parse(html);
                if (jobject["status"].ToString() == "success")
                {
                    JArray list = jobject["product"].Value <JArray>("childSKUs");
                    if (list.IsAny <JToken>())
                    {
                        using (List <Account> .Enumerator enumerator = this.NdcAccounts.GetEnumerator())
                        {
                            while (enumerator.MoveNext())
                            {
                                Account account = enumerator.Current;
                                KeyValuePair <Account, string> item2 = new KeyValuePair <Account, string>(account, this.Link);
                                if (!MonitorLink.ProcessedLinks.Contains(item2))
                                {
                                    MonitorLink.ProcessedLinks.Add(item2);
                                    string[] size = item2.Key.Size;
                                    for (int i = 0; i < size.Length; i++)
                                    {
                                        string  text2 = size[i];
                                        AtcItem item  = new AtcItem(item2.Key, item2.Value, text2)
                                        {
                                            Details =
                                            {
                                                ProductId    = this.Pid,
                                                Line1        = this.Line1,
                                                Line2        = this.Line2,
                                                StyleCode    = this.StyleCode,
                                                ProductImage = this.Img,
                                                Price        = this.Price
                                            }
                                        };
                                        new Thread(delegate()
                                        {
                                            new AddToCart(item, this)
                                            {
                                                OldHtml        = html,
                                                ForceOldMethod = Form1.ForceOldMethod
                                            }.Atc();
                                        }).Start();
                                        Logger.Log("{0} (Size {2}): Processing link {1}".With(new object[]
                                        {
                                            account.EmailAddress,
                                            this.Link,
                                            text2
                                        }), true, true);
                                    }
                                }
                                else
                                {
                                    Logger.Log("{0}: Link {1} has already been processed.".With(new object[]
                                    {
                                        account.EmailAddress,
                                        this.Link
                                    }), true, true);
                                }
                            }
                            goto IL_429;
                        }
                        goto IL_3AA;
IL_429:
                        return(true);
                    }
IL_3AA:
                    throw new Exception("Size details not available");
                }
                JToken jtoken = jobject["exceptions"];
                if (jtoken.IsAny <JToken>())
                {
                    jtoken = jtoken["error"][0];
                    throw new Exception("Error getting size.. Code: {0} Message: {1}".With(new object[]
                    {
                        jtoken["errorcode"],
                        jtoken["message"]
                    }));
                }
                throw new Exception("Size details not available");
            }
            catch (Exception ex)
            {
                Logger.Log("Error: Link {0} - {1}".With(new object[]
                {
                    this.Link,
                    ex.Message
                }), true, true);
                result = false;
            }
            return(result);
        }
Esempio n. 4
0
        // Token: 0x060002A7 RID: 679 RVA: 0x0002B99C File Offset: 0x00029B9C
        private bool MonitorProductPageT()
        {
            bool result;

            try
            {
                string html = null;
                try
                {
                    html = this.NdcAccounts.GetRandom <Account>().Request.GetRequest(this.Link, null, null, true, true);
                }
                catch (Exception ex)
                {
                    Logger.Log("Error: Link {0} - {1}".With(new object[]
                    {
                        this.Link,
                        ex.Message
                    }), true, true);
                    return(false);
                }
                string text = html.GetLinesArray(true).FirstOrDefault((string l) => l.Contains("window.INITIAL_REDUX_STATE="));
                if (text == null)
                {
                    throw new Exception("Product data not found...");
                }
                text = text.Replace("<script>window.INITIAL_REDUX_STATE=", "var x22xx123 = ");
                text = text.Replace(";</script>", ";");
                string  text2 = "";
                JObject jobject;
                try
                {
                    Engine engine = new Engine();
                    engine.Execute("window = {};");
                    engine.Execute(text);
                    JsValue value = engine.GetValue("x22xx123");
                    jobject = JObject.Parse(engine.Json.Stringify(value, new JsValue[]
                    {
                        value
                    }).ToString());
                }
                catch (Exception)
                {
                    throw new Exception("Error parsing product data...");
                }
                MonitorLink.NikeSku[] skus;
                foreach (Account account in this.NdcAccounts)
                {
                    KeyValuePair <Account, string> item2 = new KeyValuePair <Account, string>(account, this.Link);
                    if (!MonitorLink.ProcessedLinks.Contains(item2))
                    {
                        MonitorLink.ProcessedLinks.Add(item2);
                        string productId;
                        string line;
                        string line2;
                        string price;
                        string productImage;
                        try
                        {
                            text2        = account.ProductStyleCodes.First <string>();
                            skus         = jobject["Threads"]["products"][text2]["skus"].ToObject <MonitorLink.NikeSku[]>();
                            productId    = jobject["Threads"]["products"][text2]["productId"].Value <string>();
                            line         = jobject["Threads"]["products"][text2]["title"].Value <string>();
                            line2        = jobject["Threads"]["products"][text2]["subTitle"].Value <string>();
                            price        = jobject["Threads"]["products"][text2]["currentPrice"].Value <string>();
                            productImage = jobject["Threads"]["products"][text2]["firstImageUrl"].Value <string>();
                        }
                        catch (Exception)
                        {
                            Logger.Log("{0}: Error parsing product data... {1}".With(new object[]
                            {
                                account.EmailAddress,
                                text2
                            }), true, true);
                            continue;
                        }
                        string[] size = item2.Key.Size;
                        for (int i = 0; i < size.Length; i++)
                        {
                            string  text3 = size[i];
                            AtcItem item  = new AtcItem(item2.Key, item2.Value, text3)
                            {
                                Details =
                                {
                                    ProductId    = productId,
                                    Line1        = line,
                                    Line2        = line2,
                                    StyleCode    = text2,
                                    ProductImage = productImage,
                                    Price        = price
                                }
                            };
                            new Thread(delegate()
                            {
                                new AddToCart(item, this)
                                {
                                    OldHtml        = html,
                                    ForceOldMethod = Form1.ForceOldMethod,
                                    Skus           = skus
                                }.Atc();
                            }).Start();
                            Logger.Log("{0} (Size {2}): Processing link {1}".With(new object[]
                            {
                                account.EmailAddress,
                                this.Link,
                                text3
                            }), true, true);
                        }
                    }
                    else
                    {
                        Logger.Log("{0}: Link {1} has already been processed.".With(new object[]
                        {
                            account.EmailAddress,
                            this.Link
                        }), true, true);
                    }
                }
                result = true;
            }
            catch (Exception ex2)
            {
                Logger.Log("Error: Link {0} - {1}".With(new object[]
                {
                    this.Link,
                    ex2.Message
                }), true, true);
                result = false;
            }
            return(result);
        }