mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-05-02 14:56:31 +01:00
Move some arrays to generics
This commit is contained in:
@@ -83,8 +83,8 @@ namespace Emby.Drawing
|
||||
}
|
||||
}
|
||||
|
||||
public string[] SupportedInputFormats =>
|
||||
new string[]
|
||||
public IReadOnlyCollection<string> SupportedInputFormats =>
|
||||
new HashSet<string>(StringComparer.OrdinalIgnoreCase)
|
||||
{
|
||||
"tiff",
|
||||
"tif",
|
||||
@@ -137,14 +137,14 @@ namespace Emby.Drawing
|
||||
}
|
||||
}
|
||||
|
||||
public ImageFormat[] GetSupportedImageOutputFormats()
|
||||
{
|
||||
return _imageEncoder.SupportedOutputFormats;
|
||||
}
|
||||
public IReadOnlyCollection<ImageFormat> GetSupportedImageOutputFormats()
|
||||
=> _imageEncoder.SupportedOutputFormats;
|
||||
|
||||
private static readonly HashSet<string> TransparentImageTypes
|
||||
= new HashSet<string>(StringComparer.OrdinalIgnoreCase) { ".png", ".webp", ".gif" };
|
||||
|
||||
private static readonly string[] TransparentImageTypes = new string[] { ".png", ".webp", ".gif" };
|
||||
public bool SupportsTransparency(string path)
|
||||
=> TransparentImageTypes.Contains(Path.GetExtension(path).ToLowerInvariant());
|
||||
=> TransparentImageTypes.Contains(Path.GetExtension(path));
|
||||
|
||||
public async Task<(string path, string mimeType, DateTime dateModified)> ProcessImage(ImageProcessingOptions options)
|
||||
{
|
||||
@@ -472,7 +472,7 @@ namespace Emby.Drawing
|
||||
return (originalImagePath, dateModified);
|
||||
}
|
||||
|
||||
if (!_imageEncoder.SupportedInputFormats.Contains(inputFormat, StringComparer.OrdinalIgnoreCase))
|
||||
if (!_imageEncoder.SupportedInputFormats.Contains(inputFormat))
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using MediaBrowser.Controller.Drawing;
|
||||
using MediaBrowser.Model.Drawing;
|
||||
|
||||
@@ -6,15 +7,11 @@ namespace Emby.Drawing
|
||||
{
|
||||
public class NullImageEncoder : IImageEncoder
|
||||
{
|
||||
public string[] SupportedInputFormats =>
|
||||
new[]
|
||||
{
|
||||
"png",
|
||||
"jpeg",
|
||||
"jpg"
|
||||
};
|
||||
public IReadOnlyCollection<string> SupportedInputFormats
|
||||
=> new HashSet<string>(StringComparer.OrdinalIgnoreCase) { "png", "jpeg", "jpg" };
|
||||
|
||||
public ImageFormat[] SupportedOutputFormats => new[] { ImageFormat.Jpg, ImageFormat.Png };
|
||||
public IReadOnlyCollection<ImageFormat> SupportedOutputFormats
|
||||
=> new HashSet<ImageFormat>() { ImageFormat.Jpg, ImageFormat.Png };
|
||||
|
||||
public void CropWhiteSpace(string inputPath, string outputPath)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user