예제 #1
0
        public static string SendPostRequest(string req, string url, string refer, CookieContainer cookie, bool tolog)
        {
            var    requestData = Encoding.UTF8.GetBytes(req);
            string content     = string.Empty;

            try
            {
                HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);

                request.CookieContainer = cookie;
                request.Method          = "POST";

                //New
                request.Proxy   = null;
                request.Timeout = 30000;
                //KeepAlive is True by default
                request.KeepAlive = true;

                request.UserAgent = SteamLibrary.steamUA;

                request.Referer       = refer;
                request.ContentType   = "application/x-www-form-urlencoded";
                request.ContentLength = requestData.Length;

                Stream s = request.GetRequestStream();
                {
                    s.Write(requestData, 0, requestData.Length);
                }
                s.Close();

                HttpWebResponse resp = (HttpWebResponse)request.GetResponse();

                StreamReader stream = new StreamReader(resp.GetResponseStream());
                content = stream.ReadToEnd();

                if (tolog)
                {
                    SteamLibrary.AddtoLog(content);
                }

                cookie = request.CookieContainer;

                resp.Close();
                stream.Close();
            }
            catch (WebException e)
            {
                if (e.Status == WebExceptionStatus.ProtocolError)
                {
                    WebResponse resp = e.Response;
                    using (StreamReader sr = new StreamReader(resp.GetResponseStream()))
                    {
                        content = sr.ReadToEnd();
                    }
                }
            }
            return(content);
        }
예제 #2
0
            public int ParseInventory(string content)
            {
                InventList.Clear();

                try
                {
                    var rgDescr = JsonConvert.DeserializeObject <SteamLibrary.InventoryData>(content);

                    foreach (SteamLibrary.InvItem prop in rgDescr.myInvent.Values)
                    {
                        var ourItem = rgDescr.invDescr[prop.classid + "_" + prop.instanceid];

                        //parse cost by url (_lists + 753/ + ourItem.MarketName)
                        string price = "0";

                        if (!ourItem.Marketable)
                        {
                            price = "1";
                        }

                        //fix for special symbols in Item Name
                        string markname = string.Empty;

                        if ((ourItem.MarketName == null) && (ourItem.Name == string.Empty))
                        {
                            ourItem.Name       = ourItem.SimpleName;
                            ourItem.MarketName = ourItem.SimpleName;
                        }

                        //BattleBlock Theater Fix
                        markname = Uri.EscapeDataString(ourItem.MarketName);
                        string pageLnk = string.Format("{0}/{1}/{2}", SteamLibrary._lists, ourItem.AppId, markname);

                        InventList.Add(new SteamLibrary.InventItem(prop.assetid, ourItem.Name, ourItem.Type,
                                                                   price, "0", ourItem.IconUrl, ourItem.MarketName, false, ourItem.Marketable, pageLnk));
                    }
                }
                catch (Exception e)
                {
                    SteamLibrary.AddtoLog(e.Message);
                }

                return(InventList.Count);
            }
예제 #3
0
        public void doMessage(flag myflag, int searchId, object message, bool isMain)
        {
            try
            {
                if (delegMessage != null)
                {
                    Control target = delegMessage.Target as Control;

                    if (target != null && target.InvokeRequired)
                    {
                        target.Invoke(delegMessage, new object[] { this, message, searchId, myflag, isMain });
                    }
                    else
                    {
                        delegMessage(this, message, searchId, myflag, isMain);
                    }
                }
            }
            catch (Exception e)
            {
                SteamLibrary.AddtoLog(e.Message);
            }
        }
예제 #4
0
            public SteamLibrary.StrParam GetNameBalance(CookieContainer cookieCont)
            {
                SteamLibrary.AddtoLog("Getting account name and balance...");

                string markpage = SendGet(SteamLibrary._market, cookieCont, false, true);

                //For testing 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);
                }

                //Set profileId for old Url format
                SteamAutoFunction.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();

                Currencies.GetType(parseAmount);

                parseAmount = Currencies.ReplaceAscii(parseAmount);

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

                return(new SteamLibrary.StrParam(parseName, SteamAutoFunction.MyUserID, parseAmount, parseImg, Addon));
            }
예제 #5
0
            public static void loadImg(string imgurl, PictureBox picbox, bool drawtext, bool doWhite)
            {
                try
                {
                    if (imgurl == string.Empty)
                    {
                        return;
                    }

                    WebClient wClient   = new WebClient();
                    byte[]    imageByte = wClient.DownloadData(imgurl);
                    using (MemoryStream ms = new MemoryStream(imageByte, 0, imageByte.Length))
                    {
                        ms.Write(imageByte, 0, imageByte.Length);
                        var resimg = Image.FromStream(ms, true);
                        picbox.BackColor = backColor(resimg, doWhite);
                        picbox.Image     = resimg;
                    }
                }
                catch (Exception exc)
                {
                    SteamLibrary.AddtoLog(exc.Message);
                }
            }
예제 #6
0
        public void BuyProgress(object sender, DoWorkEventArgs e)
        {
            object[] parameters = e.Argument as object[];

            string link       = Convert.ToString(parameters[0]);
            bool   BuyNow     = Convert.ToBoolean(parameters[1]);
            bool   IgnoreWarn = Convert.ToBoolean(parameters[2]);
            bool   isTrack    = Convert.ToBoolean(parameters[3]);

            try
            {
                string sessid = SteamParseSite.GetSessId(cookieCont);

                string url = link;

                if (BuyNow)
                {
                    SteamParseSite.ParseLotList(SteamParsing.SendGet(url, cookieCont, false, true),
                                                MyUserID, BuyList, false, true, IgnoreWarn);

                    if (BuyList.Count == 0)
                    {
                        doMessage(flag.Error_scan, 0, "0", true);
                    }
                    else
                    {
                        double totalPrice = BuyList[0].Price + BuyList[0].Fee;

                        if (isTrack)
                        {
                            if (totalPrice / 100 == pricecheck)
                            {
                                string totalStr = Convert.ToString(totalPrice);

                                var buyresp = BuyItem(cookieCont, sessid, BuyList[0].ListingId, link, BuyList[0].Price.ToString(),
                                                      BuyList[0].Fee.ToString(), totalStr);

                                BuyNow = false;

                                if (buyresp.Succsess)
                                {
                                    doMessage(flag.Success_buy, 0, buyresp.Mess + ";" + BuyList[0].ItemName, true);
                                }
                                else
                                {
                                    doMessage(flag.Error_buy, 0, buyresp.Mess, true);
                                }
                            }
                        }
                        else
                        {
                            string totalStr = Convert.ToString(totalPrice);

                            var buyresp = BuyItem(cookieCont, sessid, BuyList[0].ListingId, link, BuyList[0].Price.ToString(),
                                                  BuyList[0].Fee.ToString(), totalStr);

                            BuyNow = false;

                            if (buyresp.Succsess)
                            {
                                doMessage(flag.Success_buy, 0, buyresp.Mess + ";" + BuyList[0].ItemName, true);
                            }
                            else
                            {
                                doMessage(flag.Error_buy, 0, buyresp.Mess, true);
                            }
                        }
                    }
                    return;
                }
            }
            catch (Exception exc)
            {
                SteamLibrary.AddtoLog(exc.Message);
            }
            finally
            {
                //CancelScan();
            }
        }
예제 #7
0
        public string ParseAdvanceSearchRes(string content, List <SteamLibrary.SearchItem> lst, CookieContainer cookieCont,
                                            bool isGame, string game, bool isMin, string min, bool isMax, string max, int countRes)
        {
            if (searchDone == true)
            {
                lst.Clear();
            }
            searchDone = false;
            string totalFind = "0";

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

                if (searchJS.Success)
                {
                    totalFind       = searchJS.TotalCount;
                    sppos.PageCount = Convert.ToInt32(totalFind) / SearchResCount;

                    //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[] input = ItemUrl.Split('/');
                            string   hash  = input[6];

                            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();

                            if (SteamParsing.Currencies.NotSet)
                            {
                                SteamParsing.Currencies.GetType(ItemPrice);
                                //If not loggen in then
                                ItemPrice = Regex.Replace(ItemPrice, SteamParsing.Currencies.GetAscii(), string.Empty);
                                //currLst.NotSet = true;
                            }
                            else
                            {
                                ItemPrice = Regex.Replace(ItemPrice, SteamParsing.Currencies.GetAscii(), string.Empty);
                            }

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

                            bool pass = false;

                            if (isMin || isMax)
                            {
                                if (isMin && isMax)
                                {
                                    if (Convert.ToSingle(ItemPrice) > Convert.ToSingle(min) && (Convert.ToSingle(ItemPrice) < Convert.ToSingle(max)))
                                    {
                                        pass = true;
                                    }
                                }
                                else if (isMin)
                                {
                                    if (Convert.ToSingle(ItemPrice) > Convert.ToSingle(min))
                                    {
                                        pass = true;
                                    }
                                }
                                else
                                {
                                    if (Convert.ToSingle(ItemPrice) < Convert.ToSingle(max))
                                    {
                                        pass = true;
                                    }
                                }
                            }
                            else
                            {
                                pass = true;
                            }

                            if (pass)
                            {
                                //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();

                                if (isGame)
                                {
                                    if (ItemGame.Equals(game))
                                    {
                                        string Median = "0";

                                        try
                                        {
                                            string gameid = SteamLibrary.GetApp(ItemGame).AppID;
                                            Median = SteamParseSite.ParseItemPrice(hash, gameid, cookieCont).P2;

                                            if (Median.Equals("Error"))
                                            {
                                                Median = "0";
                                            }
                                        }
                                        catch { }

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

                                        SteamLibrary.SearchItem item = new SteamLibrary.SearchItem(ItemName, ItemGame, ItemUrl, ItemQuan,
                                                                                                   ItemPrice, ItemImg, Median);

                                        item.Hashname = hash;

                                        lst.Add(item);
                                    }
                                }
                                else
                                {
                                    string Median = "0";

                                    try
                                    {
                                        string gameid = SteamLibrary.GetApp(ItemGame).AppID;
                                        Median = SteamParseSite.ParseItemPrice(hash, gameid, cookieCont).P2;

                                        if (Median.Equals("Error"))
                                        {
                                            Median = "0";
                                        }
                                    }
                                    catch { }

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

                                    SteamLibrary.SearchItem item = new SteamLibrary.SearchItem(ItemName, ItemGame, ItemUrl, ItemQuan,
                                                                                               ItemPrice, ItemImg, Median);

                                    item.Hashname = hash;

                                    lst.Add(item);
                                }
                            }
                        }
                    }
                    else
                    {
                        MessageBox.Show("No item founded!", "Attention", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
            }
            catch (Exception e)
            {
                SteamLibrary.AddtoLog(e.Message);
                MessageBox.Show("Error parsing search results.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

            if (lst.Count < countRes)
            {
                DoAdvanceSearch(1, countRes, lastSrch, isGame, game, isMin, min, isMax, max);
            }
            else
            {
                doMessage(flag.Advance_search_success, 0, totalFind, true);
            }

            return(totalFind);
        }
예제 #8
0
        public void LoginProgress(object sender, DoWorkEventArgs e)
        {
            LoginProcess = true;
            Logged       = false;

            var accInfo = SteamParseSite.GetNameBalance(cookieCont);

            if (accInfo != null)
            {
                doMessage(flag.Already_logged, 0, accInfo, true);
                LoginProcess = false;
                Logged       = true;
                return;
            }

            string mailCode  = string.Empty;
            string guardDesc = string.Empty;
            string capchaId  = string.Empty;
            string capchaTxt = string.Empty;
            string mailId    = string.Empty;

            //Login cycle
begin:

            var rRSA = GetRSA("toshigawa_tori", cookieCont);

            if (rRSA == null)
            {
                SteamLibrary.AddtoLog("Network Problem");
                doMessage(flag.Login_cancel, 0, "Network Problem", true);
                LoginProcess = false;
                return;
            }

            string finalpass = SteamLibrary.EncryptPassword(Password, rRSA.Module, rRSA.Exponent);

            string MainReq = string.Format(SteamLibrary.loginReq, finalpass, UserName, mailCode, guardDesc, capchaId,
                                           capchaTxt, mailId, rRSA.TimeStamp);

            string BodyResp = SteamParsing.SendPost(MainReq, SteamLibrary._dologin, SteamLibrary._ref, cookieCont, true);

            //Checking login problem
            if (BodyResp.Contains("message"))
            {
                var rProcess = JsonConvert.DeserializeObject <SteamLibrary.RespProcess>(BodyResp);

                //Checking Incorrect Login
                if (rProcess.Message.Contains("Incorrect"))
                {
                    SteamLibrary.AddtoLog("Incorrect login");
                    doMessage(flag.Login_cancel, 0, "Incorrect login", true);
                    LoginProcess = false;
                    return;
                }
                else
                {
                    //Login correct, checking message type...
                    Dialog guardCheckForm = new Dialog();

                    if ((rProcess.isCaptcha) && (rProcess.Message.Contains("humanity")))
                    {
                        //Verifying humanity, loading capcha
                        guardCheckForm.capchgroupEnab = true;
                        guardCheckForm.codgroupEnab   = false;

                        string newcap = SteamLibrary._capcha + rProcess.Captcha_Id;
                        SteamParsing.SteamSite.loadImg(newcap, guardCheckForm.capchImg, false, false);
                    }
                    else
                    if (rProcess.isEmail)
                    {
                        //Steam guard wants email code
                        guardCheckForm.capchgroupEnab = false;
                        guardCheckForm.codgroupEnab   = true;
                    }
                    else
                    {
                        //Whoops!
                        goto begin;
                    }

                    //Re-assign main request values
                    if (guardCheckForm.ShowDialog() == DialogResult.OK)
                    {
                        mailCode  = guardCheckForm.MailCode;
                        guardDesc = guardCheckForm.GuardDesc;
                        capchaId  = rProcess.Captcha_Id;
                        capchaTxt = guardCheckForm.capchaText;
                        mailId    = rProcess.Email_Id;
                        guardCheckForm.Dispose();
                    }
                    else
                    {
                        SteamLibrary.AddtoLog("Dialog has been cancelled!");
                        doMessage(flag.Login_cancel, 0, "Dialog has been cancelled!", true);
                        e.Cancel     = true;
                        Logged       = false;
                        LoginProcess = false;
                        guardCheckForm.Dispose();
                        return;
                    }

                    goto begin;
                }
            }
            else
            {
                //No Messages, Success!
                var rFinal = JsonConvert.DeserializeObject <SteamLibrary.RespFinal>(BodyResp);

                if (rFinal.Success && rFinal.isComplete)
                {
                    //Okay
                    var accInfo2 = SteamParseSite.GetNameBalance(cookieCont);

                    doMessage(flag.Login_success, 0, accInfo2, true);

                    Logged = true;
                    SteamLibrary.AddtoLog("Login Success");
                }
                else
                {
                    //Fail
                    goto begin;
                }
            }

            LoginProcess = false;
        }
예제 #9
0
            public byte ParseLotList(string content, string myUserId, List <SteamLibrary.BuyItem> lst, bool full,
                                     bool ismain, bool IgnoreWarn)
            {
                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(SteamLibrary.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 <SteamLibrary.PageBody>(content);

                    if (pageJS.Listing.Count != 0)
                    {
                        foreach (SteamLibrary.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
                                SteamLibrary.AddtoLog(string.Format("{0}: {1}", ourItemInfo.name, ourItemInfo.warnings.ToString()));
                                continue;
                            }
                            if (ourItem.price != 0)
                            {
                                lst.Add(new SteamLibrary.BuyItem(ourItem.listingid, ourItem.price, ourItem.fee,
                                                                 new SteamLibrary.AppType(ourItem.asset.appid, ourItem.asset.contextid), ourItemInfo.name));
                                isNull = false;
                            }
                            else
                            {
                                isNull = true;
                            }
                            if (!full && !isNull)
                            {
                                return(7);
                            }
                        }
                    }
                    else
                    {
                        return(1);
                    }
                }
                catch (Exception e)
                {
                    //Parsing fail
                    SteamLibrary.AddtoLog("Err Source: " + e.Message);
                    return(3);
                }

                if (lst.Count == 0)
                {
                    return(0);
                }
                else
                {
                    //Fine!
                    return(7);
                }
            }
예제 #10
0
        public void Event_Message(object sender, object data, int searchId, flag myflag, bool isMain)
        {
            if (data == null)
            {
                return;
            }

            string message = data.ToString();

            switch (myflag)
            {
            case flag.Already_logged:

                StatusLabel1.Text = "Ready";
                StatusPB.Image    = null;
                SteamLibrary.AddtoLog("Already logged");
                GetAccInfo((SteamLibrary.StrParam)data);
                break;

            case flag.Login_success:

                StatusLabel1.Text = "Ready";
                StatusPB.Image    = null;
                SteamLibrary.AddtoLog("Login succesful");
                GetAccInfo((SteamLibrary.StrParam)data);
                break;

            case flag.Login_cancel:

                MessageBox.Show("Error logging in! " + message + "!", "Attention", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                StatusPB.Image    = null;
                StatusLabel1.Text = message;
                break;

            case flag.Logout_:

                StatusLabel1.Text = "Ready";
                StatusPB.Image    = null;
                LoginB.Text       = "Login";
                break;

            case flag.Search_success:

                ScanLV.Enabled   = true;
                button15.Enabled = true;

                if (SteamAutoFunction.sppos.CurrentPos == 1)
                {
                    int found = Convert.ToInt32(message);
                    SteamAutoFunction.sppos.PageCount = found / SteamAutoFunction.SearchResCount;
                    if (found % SteamAutoFunction.SearchResCount != 0)
                    {
                        SteamAutoFunction.sppos.PageCount++;
                    }
                }

                label5.Text = string.Format("{0}/{1}", SteamAutoFunction.sppos.CurrentPos.ToString(),
                                            SteamAutoFunction.sppos.PageCount.ToString());

                if (SteamAutoFunction.sppos.PageCount > 1)
                {
                    prepageBT.Visible  = true;
                    nextpageBT.Visible = true;
                    button16.Visible   = false;
                    button17.Visible   = false;
                }
                else
                {
                    prepageBT.Visible  = false;
                    nextpageBT.Visible = false;
                    button16.Visible   = false;
                    button17.Visible   = false;
                }

                ScanLV.Items.Clear();

                for (int i = 0; i < SteamAutoFunction.SearchList.Count; i++)
                {
                    var ourItem = SteamAutoFunction.SearchList[i];

                    string[] row = { ourItem.Game,     ourItem.Name,                                                  SteamParsing.Currencies.GetName() + " " + ourItem.StartPrice,
                                     ourItem.Quantity, SteamParsing.Currencies.GetName() + " " + ourItem.MedianPrice, ourItem.Hashname };
                    var      lstItem = new ListViewItem(row);
                    ScanLV.Items.Add(lstItem);
                }

                button2.Enabled   = true;
                StatusPB.Image    = null;
                StatusLabel1.Text = "Ready";

                break;

            case flag.Advance_search_success:

                ScanLV.Enabled               = true;
                button15.Enabled             = true;
                SteamAutoFunction.searchDone = true;

                if (SteamAutoFunction.sppos.CurrentPos == 1)
                {
                    int found = Convert.ToInt32(message);
                    SteamAutoFunction.sppos.PageCount = found / SteamAutoFunction.SearchResCount;
                    if (found % SteamAutoFunction.SearchResCount != 0)
                    {
                        SteamAutoFunction.sppos.PageCount++;
                    }
                }

                label5.Text = string.Format("{0}/{1}", SteamAutoFunction.sppos.CurrentPos.ToString(),
                                            SteamAutoFunction.sppos.PageCount.ToString());

                if (SteamAutoFunction.sppos.PageCount > 1)
                {
                    prepageBT.Visible  = false;
                    nextpageBT.Visible = false;
                    button16.Visible   = true;
                    button17.Visible   = true;
                }
                else
                {
                    prepageBT.Visible  = false;
                    nextpageBT.Visible = false;
                    button16.Visible   = false;
                    button17.Visible   = false;
                }

                ScanLV.Items.Clear();

                for (int i = 0; i < SteamAutoFunction.SearchList.Count; i++)
                {
                    var ourItem = SteamAutoFunction.SearchList[i];

                    string[] row = { ourItem.Game,     ourItem.Name,                                                  SteamParsing.Currencies.GetName() + " " + ourItem.StartPrice,
                                     ourItem.Quantity, SteamParsing.Currencies.GetName() + " " + ourItem.MedianPrice, ourItem.Hashname };
                    var      lstItem = new ListViewItem(row);
                    ScanLV.Items.Add(lstItem);
                }

                button2.Enabled   = true;
                StatusPB.Image    = null;
                StatusLabel1.Text = "Ready";

                break;

            case flag.Add_track:

                SteamLibrary.TrackingItem item = (SteamLibrary.TrackingItem)data;

                string lp = SteamParsing.Currencies.GetName() + " " + string.Format("{0:N2}", item.StartPrice);
                string mp = SteamParsing.Currencies.GetName() + " " + string.Format("{0:N2}", item.MedianPrice);

                string[] row1 = { item.Game,                   item.Name, lp,        mp, "", "",            item.BuyPercent.ToString(),
                                  item.SellPercent.ToString(), "",        item.Link, "", "", item.hashname, "" };
                var      lst1 = new ListViewItem(row1);
                TraItemLV.Items.Add(lst1);

                break;

            case flag.Track_progress:

                SteamLibrary.TrackingItem item1 = (SteamLibrary.TrackingItem)data;

                string lp1 = SteamParsing.Currencies.GetName() + " " + string.Format("{0:N2}", item1.StartPrice);
                string mp1 = SteamParsing.Currencies.GetName() + " " + string.Format("{0:N2}", item1.MedianPrice);

                TraItemLV.Items[item1.index].SubItems[2].Text  = lp1;
                TraItemLV.Items[item1.index].SubItems[3].Text  = mp1;
                TraItemLV.Items[item1.index].SubItems[13].Text = searchId.ToString();

                break;

            /*case flag.Error_scan:
             *
             *  string mess = GetScanErrMess(message);
             *  button12.Enabled = true;
             *  button3.Enabled = true;
             *  break;*/

            case flag.Success_buy:

                string[] price = message.Split(';');

                double itemcost = Math.Round(Convert.ToSingle(WalletL.Text.Remove(0, 2)) - Convert.ToSingle(price[0]), 2);

                FlashWindow.Flash(this);

                WalletL.Text     = SteamParsing.Currencies.GetName() + " " + price[0];
                button3.Enabled  = true;
                button12.Enabled = true;

                for (int i = 0; i < SteamAutoFunction.TrackingList.Count; i++)
                {
                    if (SteamAutoFunction.TrackingList[i].Name.Equals(price[1]))
                    {
                        SteamAutoFunction.TrackingList[i].Purchased = true;
                        TraItemLV.Items[i].SubItems[8].Text         = "x";
                        TraItemLV.Items[i].SubItems[10].Text        = SteamParsing.Currencies.GetName() + " " + itemcost;
                        TraItemLV.Items[i].SubItems[11].Text        = DateTime.Today.AddDays(7).ToString();
                        if (SteamAutoFunction.TrackingList[i].Buy == true)
                        {
                            SteamAutoFunction.TrackingList[i].Buy = false;
                            TraItemLV.Items[i].SubItems[4].Text   = "";
                        }
                        if (SteamAutoFunction.TrackingList[i].Buying == true)
                        {
                            SteamAutoFunction.TrackingList[i].Buying = false;
                        }
                        SteamAutoFunction.TrackingList[i].Refresh.Stop();
                        break;
                    }
                }

                break;

            case flag.Error_buy:

                button3.Enabled = true;
                break;


            case flag.Load_progress:

                for (int a = 0; a < SteamAutoFunction.TrackingList.Count; a++)
                {
                    SteamAutoFunction.TrackingList[a].index = a;

                    string lp2 = SteamParsing.Currencies.GetName() + " " + string.Format("{0:N2}", SteamAutoFunction.TrackingList[a].StartPrice);
                    string mp2 = SteamParsing.Currencies.GetName() + " " + string.Format("{0:N2}", SteamAutoFunction.TrackingList[a].MedianPrice);

                    string buy = ""; string sell = ""; string pured = ""; string pp = "";

                    if (SteamAutoFunction.TrackingList[a].Buy)
                    {
                        buy = "x";
                    }
                    if (SteamAutoFunction.TrackingList[a].Sell)
                    {
                        sell = "x";
                    }
                    if (SteamAutoFunction.TrackingList[a].Purchased)
                    {
                        pured = "x";
                        pp    = SteamParsing.Currencies.GetName() + " " + string.Format("{0:N2}", SteamAutoFunction.TrackingList[a].PurchasePrice);
                    }

                    string[] row2 = { SteamAutoFunction.TrackingList[a].Game,
                                      SteamAutoFunction.TrackingList[a].Name,                  lp2,                                             mp2,                                    buy, sell,
                                      SteamAutoFunction.TrackingList[a].BuyPercent.ToString(),
                                      SteamAutoFunction.TrackingList[a].SellPercent.ToString(),pured,                                           SteamAutoFunction.TrackingList[a].Link,
                                      pp,                                                      SteamAutoFunction.TrackingList[a].purchasedate,
                                      SteamAutoFunction.TrackingList[a].hashname,              "" };
                    var      lst2 = new ListViewItem(row2);
                    TraItemLV.Items.Add(lst2);
                }

                break;

            case flag.Inventory_Loaded:

                button9.Enabled   = true;
                InvenLV.Enabled   = true;
                StatusPB.Image    = null;
                StatusLabel1.Text = "Ready";
                //SetInvFilter();

                //label4.Text = filteredInvList.Count.ToString();
                button1.Enabled = true;
                if (searchId == 0)
                {
                    FillInventoryList();

                    button7.Enabled = true;
                    if (comboBox1.SelectedIndex != 8)
                    {
                        button10.Enabled = true;
                    }
                    else
                    {
                        button10.Enabled = false;
                    }
                }
                else
                {
                    InvenLV.Items.Clear();
                    button10.Enabled = false;
                    MessageBox.Show("Inventory section is empty!", "Attention", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                }
                break;

            case flag.InvPrice:

                SteamLibrary.InventItem ourItem1 = (SteamLibrary.InventItem)data;

                string priceRes = SteamParsing.Currencies.GetName() + " " + SteamLibrary.DoFracture(ourItem1.BuyPrice);
                string priceMes = SteamParsing.Currencies.GetName() + " " + ourItem1.MedianPrice.ToString();

                InvenLV.Items[searchId].SubItems[2].Text = priceRes;
                InvenLV.Items[searchId].SubItems[3].Text = priceMes;

                textBox2.Text = SteamLibrary.DoFracture(ourItem1.BuyPrice);
                textBox2_KeyUp(this, null);

                textBox2.ReadOnly = false;

                button11.Enabled = true;
                InvenLV.Enabled  = true;

                break;

            case flag.Items_Sold:
                if (searchId != 1)
                {
                    StatusLabel1.Text = "Ready";
                    StatusPB.Image    = null;

                    button10.Text = "Set price";

                    int app = comboBox1.SelectedIndex;

                    SteamAuto.InventoryThreadExcute(app);
                }
                break;
            }
        }