public void DoTrack(string name, string game, string hashname, int buyPer, int sellPer, int interval) { SteamLibrary.TrackingItem item = new SteamLibrary.TrackingItem(name, game, 0, 0, buyPer, sellPer, false, false, false, "", 0); item.hashname = hashname; string gameid = SteamLibrary.GetApp(game).AppID; try { SteamLibrary.StrParam price = SteamParseSite.ParseItemPrice(hashname, gameid, cookieCont); item.StartPrice = Convert.ToSingle(price.P1); item.MedianPrice = Convert.ToSingle(price.P2); } catch { } item.Link = "http://steamcommunity.com/market/listings/" + SteamLibrary.GetApp(game).AppID + "/" + name; int index = TrackingList.Count; TrackingList.Add(item); item.index = index; doMessage(flag.Add_track, 0, item, true); item.Refresh = new System.Timers.Timer(); item.Refresh.Elapsed += new System.Timers.ElapsedEventHandler(delegate { TrackProgress(item); }); item.Refresh.Interval = interval; item.Refresh.AutoReset = true; item.Refresh.Start(); }
private void TrackProgress(SteamLibrary.TrackingItem item) { Stopwatch stop = new Stopwatch(); string gameid = SteamLibrary.GetApp(item.Game).AppID; try { stop.Start(); SteamLibrary.StrParam price = SteamParseSite.ParseItemPrice(item.hashname, gameid, cookieCont); item.StartPrice = Convert.ToSingle(price.P1); item.PreMedianPrice = item.MedianPrice; item.MedianPrice = Convert.ToSingle(price.P2); stop.Stop(); } catch { } try { if (((item.StartPrice / item.MedianPrice * 100) < item.BuyPercent) && (item.Buy) && (item.StartPrice > 0) && (item.MedianPrice / item.MedianPrice < 1.2)) { pricecheck = item.StartPrice; BuyThreadExcute(item.Link, true, true, true); } } catch { } doMessage(flag.Track_progress, Convert.ToInt32(stop.ElapsedMilliseconds), item, true); }
private void GetAccInfo(SteamLibrary.StrParam mess) { if (mess != null) { SteamParsing.SteamSite.StartLoadImgTread(mess.P4, AvatarPB); WalletL.Text = mess.P3.Insert(1, " "); JsonAddon = mess.P4; //walletVal = Convert.ToInt32(SteamSite.GetSweetPrice(Regex.Replace(mess.P2, @"[^\d.,]+", string.Empty))); AccNameL.Text = mess.P1; LoginB.Text = "Logout"; button2.Enabled = true; button3.Enabled = true; button15.Enabled = true; SteamAuto.LoadThreadExcute(SteamAuto.UserName, 3000); /*ProgressBar1.Visible = false; * addtoScan.Enabled = true; * * setNotifyText(Strings.NotLogged);*/ } else { MessageBox.Show("ErrAccInfo", "Attention", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public void RefreshProgress(object state) { object[] parameters = state as object[]; SteamLibrary.InventItem item = (SteamLibrary.InventItem)parameters[0]; int index = (int)parameters[1]; string[] split = item.PageLink.Split('/'); SteamLibrary.StrParam priceOver = SteamParseSite.ParseItemPrice(split[7], split[6], cookieCont); item.MedianPrice = priceOver.P2; if (item.BuyPrice == "0") { item.BuyPrice = SteamLibrary.GetSweetPrice(item.MedianPrice); } doMessage(flag.InvPrice, index, item, true); }