コード例 #1
0
        public TwitchTeamMember(JToken data)
        {
            int currentViews, followerCount, totalViews;

            if (int.TryParse(data.SelectToken("current_viewers").ToString(), out currentViews))
            {
                _currentViews = currentViews;
            }
            if (int.TryParse(data.SelectToken("followers_count").ToString(), out followerCount))
            {
                _followerCount = followerCount;
            }
            if (int.TryParse(data.SelectToken("total_views").ToString(), out totalViews))
            {
                _totalViews = totalViews;
            }

            if (data.SelectToken("status").ToString().Trim().ToLower() == "live")
            {
                _isLive = true;
            }

            _description = data.SelectToken("description").ToString();
            _displayName = data.SelectToken("display_name").ToString();
            _imageSizes  = new ImgSizes(data.SelectToken("image"));
            _link        = data.SelectToken("link").ToString();
            _metaGame    = data.SelectToken("meta_game").ToString();
            _name        = data.SelectToken("name").ToString();
            _title       = data.SelectToken("title").ToString();
        }
コード例 #2
0
ファイル: TeamMember.cs プロジェクト: swiftyspiffy/TwitchLib
        /// <summary>TeamMember constructor.</summary>
        public TeamMember(JToken data)
        {
            int currentViews, followerCount, totalViews;

            if (int.TryParse(data.SelectToken("current_viewers").ToString(), out currentViews)) CurrentViews = currentViews;
            if (int.TryParse(data.SelectToken("followers_count").ToString(), out followerCount)) FollowerCount = followerCount;
            if (int.TryParse(data.SelectToken("total_views").ToString(), out totalViews)) TotalViews = totalViews;

            if (data.SelectToken("status").ToString().Trim().ToLower() == "live")
                IsLive = true;

            Description = data.SelectToken("description").ToString();
            DisplayName = data.SelectToken("display_name").ToString();
            ImageSizes = new ImgSizes(data.SelectToken("image"));
            Link = data.SelectToken("link").ToString();
            MetaGame = data.SelectToken("meta_game").ToString();
            Name = data.SelectToken("name").ToString();
            Title = data.SelectToken("title").ToString();
        }