private void GetCyberCount() { Regex rx = new Regex("viewers.*?\\:\\\"(.*?)\\\""); WebClient wc = new WebClient(); wc.DownloadStringCompleted += new DownloadStringCompletedEventHandler((b, a) => { if (a.Error == null) { Match m = rx.Match(a.Result); if (m.Success) { Header = "[Cyber] Зрителей: " + m.Groups[1].Value + ", " + StreamerNick; int h; if (int.TryParse(m.Groups[1].Value, out h)) { History.Add(new KeyValuePair <DateTime, int>(DateTime.Now, h)); if (History.Count > 10) { History.RemoveAt(0); } } } } CountTimer.Start(); }); wc.DownloadStringAsync(new Uri( string.Format("http://api.cybergame.tv/w/streams.php?channel={0}", StreamerNick), UriKind.RelativeOrAbsolute)); }
private void GetTwitchCount() { Regex rx = new Regex("viewers_count.*?(\\d*?)\\,"); WebClient wc = new WebClient(); wc.DownloadStringCompleted += new DownloadStringCompletedEventHandler((b, a) => { if (a.Error == null) { //{"average_bitrate": 0, "viewers_count": 272, "streams_count": 1} Match m = rx.Match(a.Result); if (m.Success) { Header = "[Twitch] Зрителей: " + m.Groups[1].Value + ", " + StreamerNick; int h; if (int.TryParse(m.Groups[1].Value, out h)) { History.Add(new KeyValuePair <DateTime, int>(DateTime.Now, h)); if (History.Count > 10) { History.RemoveAt(0); } } } } CountTimer.Start(); }); wc.DownloadStringAsync(new Uri( //http://api.justin.tv/api/stream/summary.json?channel=Knjazevdesu&jsonp= string.Format("http://api.justin.tv/api/stream/summary.json?channel={0}&jsonp=", StreamerNick), UriKind.RelativeOrAbsolute)); }
//cap void CountTimer_Tick(object sender, EventArgs e) { CurPollSeconds--; if (CurPollSeconds < 0) { CurPollSeconds = PollSeconds; CountTimer.Stop(); if (!string.IsNullOrEmpty(StreamerNick)) { switch (_CounterSource) { case CounterSource.Twitch: GetTwitchCount(); break; case CounterSource.Cybergame: GetCyberCount(); break; } } else { CountTimer.Start(); } } }
public MainForm() { InitializeComponent(); DBSetup(); InitDataTable(); CountTimer.Start(); }
// Use this for initialization void Start() { ct = new CountTimer(5); ct.TotalCount = 5; ct.Elapsed += HandleElapsed; ct.Start(); }
public InGameViewPresenter() { gameFlow = GameFacade.GameFlow; counter = new CountTimer(3); counter.Elapsed += HandleElapsed; counter.TimerFinished += HandleFinalCount; counter.TimerInit += HandleTimerInit; }
public KinectController() { _Sensor = KinectSensor.GetDefault(); if (_Sensor != null) { _Reader = _Sensor.BodyFrameSource.OpenReader(); if (!_Sensor.IsOpen) { _Sensor.Open(); } } this.Height = CountTimer.getHeight(); Debug.Log(this.Height); }
void HandleSpawnElapsed(float nowCount) { T obj = pool.GetOne(); borns.Add(obj); CountTimer putBackTimer = new CountTimer(10, 1); ptTimers.Add(putBackTimer); putBackTimer.Elapsed += delegate { pool.PutBack(obj); ptTimers.Remove(putBackTimer); borns.Remove(obj); }; putBackTimer.Start(); }
public MainUsercontrol() { InitializeComponent(); //m_nocAway = m_nocHome = "CHN"; this.DataContext = this; m_countTimer = new CountTimer(TimeSpan.FromMinutes(0), this.CountTimerCurrentCallback, CountMode.Count, 1000); m_countTimer.StatusChanged += this.CountTimerOnStatusChanged; CourtPlayers_Home.SelectedChanged += new RoutedEventHandler(CourtPlayers_Home_SelectedChanged); CourtPlayers_Away.SelectedChanged += new RoutedEventHandler(CourtPlayers_Away_SelectedChanged); BenchPlayers_Away.SelectedChanged += new RoutedEventHandler(BenchPlayers_Away_SelectedChanged); BenchPlayers_Home.SelectedChanged += new RoutedEventHandler(BenchPlayers_Home_SelectedChanged); }
// Use this for initialization void Start() { scoreObj = GameObject.FindWithTag("Player").GetComponent <Score>(); timer = GameObject.FindWithTag("Player").GetComponent <CountTimer>(); for (int i = 0; i < 5; i++) { //Get the highScore from 1 - 5 string highScoreKey = "HighScore" + (i + 1).ToString(); int highScore = PlayerPrefs.GetInt(highScoreKey, 0); // string name = PlayerPrefs.GetString(highScoreKey+"name", "Unknown"); if (highScore != 0) { highscoreUI.text += highScore.ToString() + "\n"; } } }