public string GetImageLink(BasicInfo data, ImageSize imageSize) { data.ThrowIfNull(nameof(data)); if (_serviceConfigurationInfo is null) { _serviceConfigurationInfo = TmdbServiceConfiguration.Configuration; } if (!(data is TmdbMovieInfo movieInfo)) { throw new ArgumentException("Data handler has invalid type.", nameof(data)); } int sizeIndex = GetImageSizeIndex(imageSize, _serviceConfigurationInfo.PosterSizes.Count); string imageSizeValue = _serviceConfigurationInfo.PosterSizes[sizeIndex]; string result = _serviceConfigurationInfo.SecureBaseUrl + imageSizeValue + movieInfo.PosterPath; return(result); }
public string GetImageLink(BasicInfo data, ImageSize imageSize) { data.ThrowIfNull(nameof(data)); if (!(data is OmdbMovieInfo movieInfo)) { throw new ArgumentException("Data handler has invalid type.", nameof(data)); } return(movieInfo.PosterPath); }
private IImageSupplier DetermineImageSupplier(BasicInfo basicInfo) { basicInfo.ThrowIfNull(nameof(basicInfo)); return(basicInfo switch { OmdbMovieInfo _ => new OmdbImageSupplier(), TmdbMovieInfo _ => new TmdbImageSupplier(TmdbServiceConfiguration.Configuration), SteamGameInfo _ => new SteamImageSupplier(), _ => throw new ArgumentOutOfRangeException(nameof(basicInfo), basicInfo, "Got unknown type to process.") });