private List <string> CheckMarketId(string link) { List <string> result = new List <string>() { "", "", "" }; try { var res = Task.Run(() => HelpFunctions.LoadPage(link)); res.Wait(); string page = res.Result; //string page = HelpFunctions.LoadPage(link); if (page != "") { Regex rId = new Regex("Market_LoadOrderSpread\\((.*)\\);"); Match mId = rId.Match(page); result[0] = $"http://steamcommunity.com/market/itemordershistogram?country=RU&language=english¤cy=5&item_nameid={mId.Groups[1].Value.Trim()}&two_factor=0"; Regex rIcoUri = new Regex("\"icon_url\":\"([^\"]*)"); Match mIcoUri = rIcoUri.Match(page); result[1] = $"http://steamcommunity-a.akamaihd.net/economy/image/{mIcoUri.Groups[1].Value}/60fx60f"; Regex rName = new Regex("<span class=\"market_listing_item_name\" style=\"\">(.*)</span><br/>"); Match mName = rName.Match(page); result[2] = mName.Groups[1].Value.Trim(); } } catch (Exception ex) { tbLogSteam.AppendText(ex.Message + Environment.NewLine); } return(result); }
private void CheckPrice(out PriceDate pd, out string prefix, out string suffix) { pd = null; prefix = suffix = ""; try { string response = HelpFunctions.LoadPage(ITEM_JSON_LINK); if (response == "" || response == "[]") { SetToolTipUpdate($"{DateTime.Now} empty json"); } else { MarketResponse resp = JsonConvert.DeserializeObject <MarketResponse>(response); if (resp != null && resp.success) { if (resp.sog != null && resp.sog.Count > 0) { prefix = resp.price_prefix; suffix = resp.price_suffix; pd = new PriceDate(double.Parse(resp.sog[0][0], CultureInfo.InvariantCulture), DateTime.Now); SetToolTipUpdate($"{DateTime.Now} success updated"); } } else { SetToolTipUpdate($"{DateTime.Now} error json"); } } } catch (Exception ex) { Logger.Write($"CheckPrice error: {ex.Message} / {ITEM_ID} / {ITEM_NAME}"); } }
private string CheckNick(string link) { try { string page = HelpFunctions.LoadPage(link); if (page != "") { Regex r = new Regex("<span class=\"actual_persona_name\">(.*)</span>"); Match match = r.Match(page); return(match.Groups[1].Value); } } catch (Exception ex) { tbLogSteam.AppendText(ex.Message + Environment.NewLine); } return(null); }
public void CheckViewers() { if (cheking) { return; } cheking = true; try { string page = HelpFunctions.LoadPage(twitchUrl); if ((page != "") && (page != "\"\"")) { TwitchJSON result = JsonConvert.DeserializeObject <TwitchJSON>(page); if (result.chatter_count > 0) { string sendtext = ""; foreach (var userName in users) { if (!result.chatters.viewers.Contains(userName)) { sendtext += $"{DateTime.Now}: пользователя {userName} нет в смотрящих стрима." + Environment.NewLine; } } if (!String.IsNullOrEmpty(sendtext) && ((DateTime.Now - lastSendedDT) > TimeSpan.FromMinutes(waitTime))) { lastSendedDT = DateTime.Now; tg.SendMessage(sendtext); } AddTextToLog("Check users - Result check users sucsessful."); } else { AddTextToLog("Check users - Result xml is empty."); } } } catch (Exception ex) { AddTextToLog(ex.Message); } cheking = false; }