Esempio n. 1
0
 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);
 }
Esempio n. 2
0
 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;
 }
        public SteamMarketItem(List <string> itemInfo)
        {
            border.Child = this;
            this.Width   = WIDTH;
            this.Height  = 100;
            t.Elapsed   += t_Tick;

            ITEM_JSON_LINK   = itemInfo[0];
            ITEM_ICO_LINK    = itemInfo[1];
            ITEM_NAME        = itemInfo[2];
            ITEM_ID          = itemInfo[3];
            ITEM_MARKET_LINK = itemInfo[4];

            tbItemName.MouseDown += TbItemName_MouseDown;
            textblockValues       = new TextBlockValues(ITEM_ID);

            tbItemName.Text = ITEM_NAME;
            ico.Source      = HelpFunctions.GetBitmap(ITEM_ICO_LINK);

            lPrices = new List <PriceDate>();

            Style tbStyle = new Style(typeof(TextBlock));

            tbStyle.Setters.Add(new Setter {
                Property = Control.FontSizeProperty, Value = 10.0
            });
            tbStyle.Setters.Add(new Setter {
                Property = Control.FontFamilyProperty, Value = new FontFamily("Consolas")
            });
            tbStyle.Setters.Add(new Setter {
                Property = Control.HorizontalAlignmentProperty, Value = HorizontalAlignment.Stretch
            });
            tbStyle.Setters.Add(new Setter {
                Property = Control.VerticalAlignmentProperty, Value = VerticalAlignment.Center
            });

            this.ColumnDefinitions.Add(new ColumnDefinition()
            {
                Width = new GridLength(60, GridUnitType.Pixel)
            });
            this.ColumnDefinitions.Add(new ColumnDefinition()
            {
                Width = new GridLength(WIDTH - 60, GridUnitType.Pixel)
            });

            Grid gDescr = new Grid();

            gDescr.RowDefinitions.Add(new RowDefinition()
            {
                Height = new GridLength(40, GridUnitType.Pixel)
            });
            gDescr.RowDefinitions.Add(new RowDefinition()
            {
                Height = new GridLength(60, GridUnitType.Pixel)
            });

            Grid gPrices = new Grid();

            gPrices.RowDefinitions.Add(new RowDefinition()
            {
                Height = new GridLength(10, GridUnitType.Pixel)
            });
            gPrices.RowDefinitions.Add(new RowDefinition()
            {
                Height = new GridLength(10, GridUnitType.Pixel)
            });
            gPrices.RowDefinitions.Add(new RowDefinition()
            {
                Height = new GridLength(20, GridUnitType.Pixel)
            });
            gPrices.RowDefinitions.Add(new RowDefinition()
            {
                Height = new GridLength(20, GridUnitType.Pixel)
            });
            gPrices.RowDefinitions.Add(new RowDefinition()
            {
                Height = new GridLength(20, GridUnitType.Pixel)
            });
            gPrices.RowDefinitions.Add(new RowDefinition()
            {
                Height = new GridLength(20, GridUnitType.Pixel)
            });

            SetColumn(gDescr, 0);
            this.Children.Add(gDescr);

            SetColumn(gPrices, 1);
            this.Children.Add(gPrices);

            SetRow(tbItemName, 0);
            gDescr.Children.Add(tbItemName);

            SetRow(ico, 1);
            gDescr.Children.Add(ico);

            DockPanel dp = new DockPanel();

            SetRow(dp, 0);
            gPrices.Children.Add(dp);
            DockPanel.SetDock(bDelete, Dock.Right);
            dp.Children.Add(bDelete);
            TextBlock tbUpdate = new TextBlock()
            {
                Text = "UPDATED", Style = tbStyle
            };

            tbUpdate.ToolTip = tbLastUpdate;
            DockPanel.SetDock(tbUpdate, Dock.Left);
            dp.Children.Add(tbUpdate);

            SetUpTextBlock(gPrices, 0, 2, tbStyle, "Price", "PriceColor", "IReceivePrice");
            SetUpTextBlock(gPrices, 0, 3, tbStyle, "TenMinutes", "TenMinutesColor", "IReceiveTenMinutes");
            SetUpTextBlock(gPrices, 0, 4, tbStyle, "ThirtyMinutes", "ThirtyMinutesColor", "IReceiveThirtyMinutes");
            SetUpTextBlock(gPrices, 0, 5, tbStyle, "OneHour", "OneHourColor", "IReceiveOneHour");
        }