private static async Task<FetchReturnValue> Fetch( Twixel twitchApi, UserInfo userInfo, int offset ) { List<IVideoInfo> videosToAdd = new List<IVideoInfo>(); bool hasMore = true; long maxVideos = -1; switch ( userInfo.Service ) { case ServiceVideoCategoryType.TwitchRecordings: case ServiceVideoCategoryType.TwitchHighlights: Total<List<Video>> broadcasts = await twitchApi.RetrieveVideos( userInfo.Username, offset: offset, limit: 25, broadcasts: userInfo.Service == ServiceVideoCategoryType.TwitchRecordings, hls: false ); if ( broadcasts.total.HasValue ) { hasMore = offset + broadcasts.wrapped.Count < broadcasts.total; maxVideos = (long)broadcasts.total; } else { hasMore = broadcasts.wrapped.Count == 25; } foreach ( var v in broadcasts.wrapped ) { videosToAdd.Add( new TwitchVideoInfo( v ) ); } break; case ServiceVideoCategoryType.HitboxRecordings: List<HitboxVideo> videos = await Hitbox.RetrieveVideos( userInfo.Username, offset: offset, limit: 100 ); hasMore = videos.Count == 100; foreach ( var v in videos ) { videosToAdd.Add( new HitboxVideoInfo( v ) ); } break; default: return new FetchReturnValue { Success = false, HasMore = false, TotalVideos = maxVideos, Videos = videosToAdd }; } if ( videosToAdd.Count <= 0 ) { return new FetchReturnValue { Success = true, HasMore = false, TotalVideos = maxVideos, Videos = videosToAdd }; } if ( UserInfoPersister.KnownUsers.Add( userInfo ) ) { UserInfoPersister.Save(); } return new FetchReturnValue { Success = true, HasMore = hasMore, TotalVideos = maxVideos, Videos = videosToAdd }; }