| | | 1 | | #nullable disable |
| | | 2 | | |
| | | 3 | | #pragma warning disable CS1591 |
| | | 4 | | |
| | | 5 | | using System; |
| | | 6 | | using System.IO; |
| | | 7 | | using MediaBrowser.Model.Drawing; |
| | | 8 | | using MediaBrowser.Model.MediaInfo; |
| | | 9 | | |
| | | 10 | | namespace MediaBrowser.Controller.Providers |
| | | 11 | | { |
| | | 12 | | public class DynamicImageResponse |
| | | 13 | | { |
| | | 14 | | public string Path { get; set; } |
| | | 15 | | |
| | | 16 | | public MediaProtocol Protocol { get; set; } |
| | | 17 | | |
| | | 18 | | public Stream Stream { get; set; } |
| | | 19 | | |
| | | 20 | | public ImageFormat Format { get; set; } |
| | | 21 | | |
| | | 22 | | public bool HasImage { get; set; } |
| | | 23 | | |
| | | 24 | | public void SetFormatFromMimeType(string mimeType) |
| | | 25 | | { |
| | 0 | 26 | | if (mimeType.EndsWith("gif", StringComparison.OrdinalIgnoreCase)) |
| | | 27 | | { |
| | 0 | 28 | | Format = ImageFormat.Gif; |
| | | 29 | | } |
| | 0 | 30 | | else if (mimeType.EndsWith("bmp", StringComparison.OrdinalIgnoreCase)) |
| | | 31 | | { |
| | 0 | 32 | | Format = ImageFormat.Bmp; |
| | | 33 | | } |
| | 0 | 34 | | else if (mimeType.EndsWith("png", StringComparison.OrdinalIgnoreCase)) |
| | | 35 | | { |
| | 0 | 36 | | Format = ImageFormat.Png; |
| | | 37 | | } |
| | | 38 | | else |
| | | 39 | | { |
| | 0 | 40 | | Format = ImageFormat.Jpg; |
| | | 41 | | } |
| | 0 | 42 | | } |
| | | 43 | | } |
| | | 44 | | } |