Esempio n. 1
0
        /// <summary>
        /// Writes the data of the provided <see cref="ICurrentSeasonInfo"/> to the <see cref="StringBuilder"/>
        /// </summary>
        /// <param name="season">The <see cref="ICurrentSeasonInfo"/> whose data is to be written</param>
        /// <returns>A <see cref="StringBuilder"/> containing string representation of the provided season</returns>
        private string WriteCurrentSeasonInfoData(ICurrentSeasonInfo season)
        {
            if (season == null)
            {
                return(null);
            }

            var groups = season.Groups == null
                ? "null"
                : string.Join(",", season.Groups.Select((s, index) => $"{index}-{s.Name}:C{s.Competitors?.Count()}"));
            var competitors = season.Competitors == null
                ? "null"
                : string.Join(",", season.Competitors.Select(s => s.Id));
            var schedule = season.Schedule == null
                ? "null"
                : string.Join(",", season.Schedule.Select(s => s.Id));

            var builder = new StringBuilder();

            builder.Append("Id=").Append(season.Id)
            .Append(" Name=").Append(season.GetName(_culture))
            .Append(" StartDate=").Append(season.StartDate)
            .Append(" EndDate=").Append(season.EndDate)
            .Append(" Coverage=").Append(season.Coverage?.SeasonId)
            .Append(" CurrentRound=").Append(season.CurrentRound?.GetName(_culture))
            .Append(" Groups=").Append(groups)
            .Append(" Schedule=").Append(schedule)
            .Append(" Competitors=").Append(season.Competitors?.Count()).Append("::").Append(competitors);

            return(builder.ToString());
        }
Esempio n. 2
0
 /// <summary>
 ///     Initializes a new instance of the <see cref="TournamentInfo" /> class.
 /// </summary>
 /// <param name="cacheItem">The cache item</param>
 /// <param name="categorySummary">The category summary</param>
 /// <param name="currentSeasonInfo">The full current season info</param>
 public TournamentInfo(TournamentInfoBasicCI cacheItem, ICategorySummary categorySummary,
                       ICurrentSeasonInfo currentSeasonInfo)
     : base(cacheItem.Id, cacheItem.Name as IReadOnlyDictionary <CultureInfo, string>)
 {
     Category      = categorySummary;
     CurrentSeason = currentSeasonInfo;
 }