Ejemplo n.º 1
0
        public StrParam GetNameBalance(CookieContainer c**k, CurrInfoLst currLst)
        {
            Main.AddtoLog("Getting account name and balance...");
            string markpage = SendGet(_market, c**k, false);

            //For testring purposes!
            //string markpage = File.ReadAllText(@"C:\dollars.html");

            //Fix to getting name regex
            string parseName = Regex.Match(markpage, "(?<=buynow_dialog_myaccountname\">)(.*)(?=</span>)").ToString().Trim();

            if (parseName == "")
            {
                return(null);
            }

            //accName = parseName;
            //Set profileId for old Url format
            myUserId = Regex.Match(markpage, "(?<=g_steamID = \")(.*)(?=\";)").ToString();

            //30.05.14 Update
            string parseImg = Regex.Match(markpage, "(?<=avatarIcon\"><img src=\")(.*)(?=\" alt=\"\"></span>)", RegexOptions.Singleline).ToString();

            string parseAmount = Regex.Match(markpage, "(?<=marketWalletBalanceAmount\">)(.*)(?=</span>)").ToString();

            currLst.GetType(parseAmount);
            parseAmount = currLst.ReplaceAscii(parseAmount);

            return(new StrParam(parseName, parseAmount, parseImg));
        }
Ejemplo n.º 2
0
        public int ParseOnSale(string content, CurrInfoLst currLst)
        {
            inventList.Clear();
            string parseBody = Regex.Match(content, "(?<=section market_home_listing_table\">)(.*)(?=<div id=\"tabContentsMyMarketHistory)", RegexOptions.Singleline).ToString();

            MatchCollection matches = Regex.Matches(parseBody, "(?<=market_recent_listing_row listing_)(.*?)(?=	</div>\r\n</div>)", RegexOptions.Singleline);

            if (matches.Count != 0)
            {
                foreach (Match match in matches)
                {
                    string currmatch = match.Groups[1].Value;

                    string ImgLink = Regex.Match(currmatch, "(?<=economy/image/)(.*)(?=/38fx38f)").ToString();

                    //If you need:
                    //string assetid = Regex.Match(currmatch, "(?<='mylisting', ')(.*)(?=\" class=\"item_market)").ToString();
                    //assetid = assetid.Substring(assetid.Length - 11, 9);

                    string listId = Regex.Match(currmatch, "(?<=mylisting_)(.*)(?=_image\" src=)").ToString();

                    string appidRaw = Regex.Match(currmatch, "(?<=market_listing_item_name_link)(.*)(?=</a></span>)").ToString();
                    string pageLnk  = Regex.Match(appidRaw, "(?<=href=\")(.*)(?=\">)").ToString();

                    //phuckin' shit
                    string captainPrice = Regex.Match(currmatch, @"(?<=>
						)(.*)(?=					</span>
					<br>)"                    , RegexOptions.Singleline).ToString();

                    captainPrice = GetSweetPrice(Regex.Replace(captainPrice, currLst.GetAscii(), string.Empty).Trim());

                    string[] LinkName = Regex.Match(currmatch, "(?<=_name_link\" href=\")(.*)(?=</a></span><br/>)").ToString().Split(new string[] { "\">" }, StringSplitOptions.None);

                    string ItemType = Regex.Match(currmatch, "(?<=_listing_game_name\">)(.*)(?=</span>)").ToString();

                    inventList.Add(new InventItem(listId, LinkName[1], ItemType, captainPrice, ImgLink, string.Empty, true, true, pageLnk));
                }
            }
            //  else
            //TODO. Add correct error processing
            // MessageBox.Show(Strings.OnSaleErr, Strings.Error, MessageBoxButtons.OK, MessageBoxIcon.Error);

            return(matches.Count);
        }
Ejemplo n.º 3
0
        public StrParam GetNameBalance(CookieContainer c**k, CurrInfoLst currLst)
        {
            Main.AddtoLog("Getting account name and balance...");

            string markpage = SendGet(_market, c**k, false, true);

            //For testring purposes!
            //string markpage = System.IO.File.ReadAllText(@"C:\sing.htm");

            //Fix to getting name regex
            string parseName = Regex.Match(markpage, "(?<=buynow_dialog_myaccountname\">)(.*)(?=</span>)").ToString().Trim();

            if (parseName == "")
            {
                return(null);
            }

            //accName = parseName;
            //Set profileId for old Url format
            myUserId = Regex.Match(markpage, "(?<=g_steamID = \")(.*)(?=\";)").ToString();

            //30.05.14 Update
            string parseImg = Regex.Match(markpage, "(?<=avatarIcon\"><img src=\")(.*)(?=\" alt=\"\"></span>)", RegexOptions.Singleline).ToString();

            string parseAmount = Regex.Match(markpage, "(?<=marketWalletBalanceAmount\">)(.*)(?=</span>)").ToString();

            string country = Regex.Match(markpage, "(?<=g_strCountryCode = \")(.*)(?=\";)").ToString();
            string strlang = Regex.Match(markpage, "(?<=g_strLanguage = \")(.*)(?=\";)").ToString();

            currLst.GetType(parseAmount);

            parseAmount = currLst.ReplaceAscii(parseAmount);

            //?country=RU&language=russian&currency=5&count=20
            string Addon = string.Format(jsonAddonUrl, country, strlang, currLst.GetCode());

            return(new StrParam(parseName, parseAmount, parseImg, Addon));
        }
Ejemplo n.º 4
0
        public byte ParseLotList(string content, List <ScanItem> lst, CurrInfoLst currLst, bool full, bool ismain)
        {
            lst.Clear();

            //Smart ass!
            if (Main.isHTML && ismain)
            {
                string jsonAssets = Regex.Match(content, @"(?<=g_rgAssets \= )(.*)(?=;
	var g_rgCurrency)"    , RegexOptions.Singleline).ToString();

                if (jsonAssets == string.Empty)
                {
                    return(6);
                }

                string jsonListInfo = Regex.Match(content, @"(?<=g_rgListingInfo \= )(.*)(?=;
	var g_plotPriceHistory)"    , RegexOptions.Singleline).ToString();

                content = "{" + string.Format(buildJson, jsonListInfo, jsonAssets) + "}";
            }
            else
            {
                if (content == string.Empty)
                {
                    //Content empty
                    return(0);
                }
                else if (content == "403")
                {
                    //403 Forbidden
                    return(5);
                }
                else if (content.Length < 40)
                {
                    //Move along
                    return(8);
                }
                else if (content[0] != '{')
                {
                    //Json is not valid
                    return(2);
                }
            }

            try
            {
                //"success":false
                if (content.Substring(11, 1) == "f")
                {
                    return(1);
                }

                var pageJS = JsonConvert.DeserializeObject <PageBody>(content);

                if (pageJS.Listing.Count != 0)
                {
                    foreach (ListingInfo ourItem in pageJS.Listing.Values)
                    {
                        var  ourItemInfo = pageJS.Assets[ourItem.asset.appid][ourItem.asset.contextid][ourItem.asset.id];
                        bool isNull      = false;


                        if (ourItem.userId == myUserId)
                        {
                            continue;
                        }

                        if ((IgnoreWarn) && (ourItemInfo.warnings != null))
                        {
                            //Renamed Item or Descriprtion
                            Main.AddtoLog(string.Format("{0}: {1}", ourItemInfo.name, ourItemInfo.warnings.ToString()));
                            continue;
                        }

                        if (ourItem.price != 0)
                        {
                            //Damn, Mr.Crowley... WTF!?
                            if (NotSetHead && !full)
                            {
                                doMessage(flag.SetHeadName, scanID, new StrParam(ourItemInfo.name, ourItemInfo.icon_url), true);
                                scanInput.Name = ourItemInfo.name;
                                NotSetHead     = false;
                            }

                            lst.Add(new ScanItem(ourItem.listingid, ourItem.price, ourItem.fee, new AppType(ourItem.asset.appid, ourItem.asset.contextid), ourItemInfo.name));
                            isNull = false;
                        }
                        else
                        {
                            isNull = true;
                        }

                        //If we load 1st lot and it's not null
                        if (!full && !isNull)
                        {
                            //Fine!
                            return(7);
                        }
                    }
                }
                else
                {
                    return(1);
                }
            }
            catch (Exception e)
            {
                //Parsing fail
                Main.AddtoLog("Err Source: " + e.Message);
                return(3);
            }

            if (lst.Count == 0)
            {
                return(0);
            }
            else
            {
                //Fine!
                return(7);
            }
        }
Ejemplo n.º 5
0
        public static string ParseSearchRes(string content, List <SearchItem> lst, CurrInfoLst currLst)
        {
            lst.Clear();
            string totalFind = "0";

            try
            {
                var searchJS = JsonConvert.DeserializeObject <SearchBody>(content);

                if (searchJS.Success)
                {
                    totalFind = searchJS.TotalCount;

                    //content = File.ReadAllText(@"C:\dollar2.html");
                    MatchCollection matches = Regex.Matches(searchJS.HtmlRes, "(?<=market_listing_row_link\" href)(.*?)(?<=</a>)", RegexOptions.IgnoreCase | RegexOptions.Multiline | RegexOptions.Singleline);
                    if (matches.Count != 0)
                    {
                        foreach (Match match in matches)
                        {
                            string currmatch = match.Groups[1].Value;

                            //Fix for Steam update 5/01/14 4:00 PM PST
                            string ItemUrl = Regex.Match(currmatch, "(?<==\")(.*)(?=\" id)").ToString();

                            string ItemQuan = Regex.Match(currmatch, "(?<=num_listings_qty\">)(.*)(?=</span>)").ToString();

                            //Fix for Steam update 3/26/14 4:00 PM PST
                            string ItemPrice = Regex.Match(currmatch, "(?<=<span style=\"color:)(.*)(?=<div class=\"market_listing_right_cell)", RegexOptions.Singleline).ToString();

                            //Удаляем ascii кода нашей текущей валюты
                            if (currLst.NotSet)
                            {
                                currLst.GetType(ItemPrice);
                                //If not loggen in then
                                ItemPrice = Regex.Replace(ItemPrice, currLst.GetAscii(), string.Empty);
                                //currLst.NotSet = true;
                            }
                            else
                            {
                                ItemPrice = Regex.Replace(ItemPrice, currLst.GetAscii(), string.Empty);
                            }

                            ItemPrice = Regex.Replace(ItemPrice, @"[^\d\,\.]+", string.Empty);

                            //Fix fot Steam update 3/26/14 4:00 PM PST
                            string ItemName = Regex.Match(currmatch, "(?<=listing_item_name\" style=\"color:)(.*)(?=</span>)").ToString();
                            ItemName = ItemName.Remove(0, ItemName.IndexOf(">") + 1);

                            string ItemGame = Regex.Match(currmatch, "(?<=game_name\">)(.*)(?=</span>)").ToString();

                            string ItemImg = Regex.Match(currmatch, "(?<=net/economy/image/)(.*)(/62fx62f)", RegexOptions.Singleline).ToString();

                            //Заполняем список
                            lst.Add(new SearchItem(ItemName, ItemGame, ItemUrl, ItemQuan, ItemPrice, ItemImg));
                        }
                    }
                    else
                    {
                        MessageBox.Show(Strings.SearchErr, Strings.Error, MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
            }
            catch (Exception e)
            {
                Main.AddtoLog(e.Message);
                MessageBox.Show("Error parsing search results.", Strings.Error, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

            return(totalFind);
        }
Ejemplo n.º 6
0
        public byte ParseLotList(string content, List <ScanItem> lst, CurrInfoLst currLst, bool full)
        {
            lst.Clear();


            if (content == string.Empty)
            {
                //Content empty
                return(0);
            }
            else if ((content.Length < 200) && (content[0] == '{'))
            {
                //Json without data
                return(1);
            }
            else if (content == "403")
            {
                //403 Forbidden
                return(5);
            }
            else if (content[0] != '{')
            {
                //Json is not valid
                return(2);
            }

            try
            {
                var pageJS = JsonConvert.DeserializeObject <PageBody>(content);

                if (pageJS.Listing.Count != 0 && pageJS.Success == true)
                {
                    foreach (ListingInfo ourItem in pageJS.Listing.Values)
                    {
                        var  ourItemInfo = pageJS.Assets[ourItem.asset.appid][ourItem.asset.contextid][ourItem.asset.id];
                        bool isNull      = false;


                        if (ourItem.userId == myUserId)
                        {
                            continue;
                        }

                        if ((IgnoreWarn) && (ourItemInfo.warnings != null))
                        {
                            //Renamed Item or Descriprtion
                            Main.AddtoLog(string.Format("{0}: {1}", ourItemInfo.name, ourItemInfo.warnings.ToString()));
                            continue;
                        }

                        if (ourItem.price != 0)
                        {
                            //Damn, Mr.Crowley... WTF!?
                            if (NotSetHead && !full)
                            {
                                doMessage(flag.SetHeadName, scanID, new StrParam(ourItemInfo.name, ourItemInfo.icon_url), true);
                                scanInput.Name = ourItemInfo.name;
                                NotSetHead     = false;
                            }

                            lst.Add(new ScanItem(ourItem.listingid, ourItem.price, ourItem.fee, new AppType(ourItem.asset.appid, ourItem.asset.contextid), ourItemInfo.name));
                            isNull = false;
                        }
                        else
                        {
                            isNull = true;
                        }

                        //If we load 1st lot and it's not null
                        if (!full && !isNull)
                        {
                            //Fine!
                            return(7);
                        }
                    }
                }
                else
                {
                    return(1);
                }
            }
            catch (Exception e)
            {
                //Parsing fail
                Main.AddtoLog("Err Source: " + e.Source);
                return(3);
            }

            if (lst.Count == 0)
            {
                return(0);
            }
            else
            {
                //Fine!
                return(7);
            }
        }