예제 #1
0
        public string GetImageLink(BasicInfo data, ImageSize imageSize)
        {
            if (_serviceConfigurationInfo is null)
            {
                _serviceConfigurationInfo = TmdbServiceConfiguration.Configuration;
            }
            _serviceConfigurationInfo.ThrowIfNull(nameof(_serviceConfigurationInfo));

            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);
        }
예제 #2
0
 public TmdbImageSupplier(TmdbServiceConfigurationInfo serviceConfigurationInfo)
 {
     _serviceConfigurationInfo =
         serviceConfigurationInfo.ThrowIfNull(nameof(serviceConfigurationInfo));
 }