/// <summary> /// Gets the specified request. /// </summary> /// <param name="request">The request.</param> /// <returns>System.Object.</returns> public object Get(GetMediaInfoImage request) { var themeFolder = Path.Combine(_appPaths.MediaInfoImagesPath, request.Theme); if (Directory.Exists(themeFolder)) { var path = BaseItem.SupportedImageExtensions.Select(i => Path.Combine(themeFolder, request.Name + i)) .FirstOrDefault(File.Exists); if (!string.IsNullOrEmpty(path)) { return(ToStaticFileResult(path)); } } var allFolder = Path.Combine(_appPaths.MediaInfoImagesPath, "all"); if (Directory.Exists(allFolder)) { // Avoid implicitly captured closure var currentRequest = request; var path = BaseItem.SupportedImageExtensions.Select(i => Path.Combine(allFolder, currentRequest.Name + i)) .FirstOrDefault(File.Exists); if (!string.IsNullOrEmpty(path)) { return(ToStaticFileResult(path)); } } throw new ResourceNotFoundException("MediaInfo image not found: " + request.Name); }
/// <summary> /// Gets the specified request. /// </summary> /// <param name="request">The request.</param> /// <returns>System.Object.</returns> public object Get(GetMediaInfoImage request) { var themeFolder = Path.Combine(_appPaths.MediaInfoImagesPath, request.Theme); if (Directory.Exists(themeFolder)) { var path = BaseItem.SupportedImageExtensions.Select(i => Path.Combine(themeFolder, request.Name + i)) .FirstOrDefault(File.Exists); if (!string.IsNullOrEmpty(path)) { return ToStaticFileResult(path); } } var allFolder = Path.Combine(_appPaths.MediaInfoImagesPath, "all"); if (Directory.Exists(allFolder)) { // Avoid implicitly captured closure var currentRequest = request; var path = BaseItem.SupportedImageExtensions.Select(i => Path.Combine(allFolder, currentRequest.Name + i)) .FirstOrDefault(File.Exists); if (!string.IsNullOrEmpty(path)) { return ToStaticFileResult(path); } } throw new ResourceNotFoundException("MediaInfo image not found: " + request.Name); }