public override bool Equals(object obj)
        {
            if (!(obj is VideoEntity compareObj))
            {
                return(false);
            }

            return(Title.Equals(compareObj.Title) &&
                   ChannelName.Equals(compareObj.ChannelName));
        }
 public override bool Equals(object obj)
 {
     if (!(obj is TwitchChannelModel instance))
     {
         return(false);
     }
     return(ChannelName.Equals(instance.ChannelName, StringComparison.InvariantCultureIgnoreCase) &&
            ImageUrl.Equals(instance.ImageUrl, StringComparison.InvariantCultureIgnoreCase) &&
            IsFollowerSubscribed == instance.IsFollowerSubscribed &&
            IsStreamSubscribed == instance.IsStreamSubscribed);
 }
Esempio n. 3
0
        public override void SetupStatsWatcher()
        {
            if (ChannelName.Equals("#" + (Chat as ChatBase).AnonymousNickName, StringComparison.InvariantCultureIgnoreCase))
            {
                return;
            }

            statsPoller = new WebPoller()
            {
                Id  = ChannelName,
                Uri = new Uri(String.Format(@"http://api.gaminglive.tv/channels/{0}", ChannelName.Replace("#", ""))),
            };

            statsPoller.ReadStream = (stream) =>
            {
                if (stream == null)
                {
                    return;
                }

                lock (pollerLock)
                {
                    using ( stream )
                    {
                        var channelInfo = JsonUtil.DeserializeStream <GamingLiveChannelStats>(stream);
                        statsPoller.LastValue = channelInfo;
                        int viewers = 0;
                        if (channelInfo != null && channelInfo.state != null)
                        {
                            viewers = channelInfo.state.viewers;
                        }

                        ChannelStats.ViewersCount = viewers;
                        Chat.UpdateStats();
                    }
                }
            };
            statsPoller.Start();
        }