Beispiel #1
0
        protected bool Equals(StreamerInfo other)
        {
            if (Data == null && other.Data == null)
            {
                return(true);
            }

            if (Data == null || other.Data == null)
            {
                return(false);
            }

            return(Data.SequenceEqual(other.Data));
        }
Beispiel #2
0
        private void TwitchInfoCollector()
        {
            while (true)
            {
                var newStreamerInfo = TwitchApiRequest <StreamerInfo>($"users?login={streamerLoginName}");
                var newStreamInfo   = TwitchApiRequest <StreamInfo>($"streams?user_login={streamerLoginName}");

                if (StreamerInfo == null || !StreamerInfo.Equals(newStreamerInfo) || StreamInfo == null || !StreamInfo.Equals(newStreamInfo))
                {
                    OnTwitchInfoChanged?.Invoke(this, new TwitchInfoEventArgs(newStreamerInfo, newStreamInfo));
                }

                StreamerInfo = newStreamerInfo;
                StreamInfo   = newStreamInfo;

                // Wait for 60s until next update, cancel thread when token was cancelled
                if (TokenSource.Token.WaitHandle.WaitOne(60000))
                {
                    return;
                }
            }
        }