diff options
Diffstat (limited to 'Emby.Drawing')
| -rw-r--r-- | Emby.Drawing/Common/ImageHeader.cs | 10 | ||||
| -rw-r--r-- | Emby.Drawing/Emby.Drawing.csproj | 24 | ||||
| -rw-r--r-- | Emby.Drawing/ImageProcessor.cs | 125 | ||||
| -rw-r--r-- | Emby.Drawing/NullImageEncoder.cs | 42 |
4 files changed, 77 insertions, 124 deletions
diff --git a/Emby.Drawing/Common/ImageHeader.cs b/Emby.Drawing/Common/ImageHeader.cs index 3aa0cac25..c08cdabb2 100644 --- a/Emby.Drawing/Common/ImageHeader.cs +++ b/Emby.Drawing/Common/ImageHeader.cs @@ -1,12 +1,10 @@ -using MediaBrowser.Model.Drawing; -using Microsoft.Extensions.Logging; using System; using System.Collections.Generic; using System.IO; using System.Linq; - -using MediaBrowser.Controller.IO; +using MediaBrowser.Model.Drawing; using MediaBrowser.Model.IO; +using Microsoft.Extensions.Logging; namespace Emby.Drawing.Common { @@ -76,7 +74,7 @@ namespace Emby.Drawing.Common /// </summary> /// <param name="binaryReader">The binary reader.</param> /// <returns>Size.</returns> - /// <exception cref="System.ArgumentException">binaryReader</exception> + /// <exception cref="ArgumentException">binaryReader</exception> /// <exception cref="ArgumentException">The image was of an unrecognized format.</exception> private static ImageSize GetDimensions(BinaryReader binaryReader) { @@ -203,7 +201,7 @@ namespace Emby.Drawing.Common /// </summary> /// <param name="binaryReader">The binary reader.</param> /// <returns>Size.</returns> - /// <exception cref="System.ArgumentException"></exception> + /// <exception cref="ArgumentException"></exception> private static ImageSize DecodeJfif(BinaryReader binaryReader) { // A JPEG image consists of a sequence of segments, diff --git a/Emby.Drawing/Emby.Drawing.csproj b/Emby.Drawing/Emby.Drawing.csproj index 5ffaaed27..36e66d544 100644 --- a/Emby.Drawing/Emby.Drawing.csproj +++ b/Emby.Drawing/Emby.Drawing.csproj @@ -1,17 +1,17 @@ -<Project Sdk="Microsoft.NET.Sdk"> +<Project Sdk="Microsoft.NET.Sdk"> - <ItemGroup> - <ProjectReference Include="..\MediaBrowser.Model\MediaBrowser.Model.csproj" /> - <ProjectReference Include="..\MediaBrowser.Controller\MediaBrowser.Controller.csproj" /> - </ItemGroup> + <ItemGroup> + <ProjectReference Include="..\MediaBrowser.Model\MediaBrowser.Model.csproj" /> + <ProjectReference Include="..\MediaBrowser.Controller\MediaBrowser.Controller.csproj" /> + </ItemGroup> - <ItemGroup> - <Compile Include="..\SharedVersion.cs" /> - </ItemGroup> + <ItemGroup> + <Compile Include="..\SharedVersion.cs" /> + </ItemGroup> - <PropertyGroup> - <TargetFramework>netstandard2.0</TargetFramework> - <GenerateAssemblyInfo>false</GenerateAssemblyInfo> - </PropertyGroup> + <PropertyGroup> + <TargetFramework>netstandard2.0</TargetFramework> + <GenerateAssemblyInfo>false</GenerateAssemblyInfo> + </PropertyGroup> </Project> diff --git a/Emby.Drawing/ImageProcessor.cs b/Emby.Drawing/ImageProcessor.cs index 4e4b36507..ac6c7e9db 100644 --- a/Emby.Drawing/ImageProcessor.cs +++ b/Emby.Drawing/ImageProcessor.cs @@ -1,27 +1,26 @@ -using MediaBrowser.Common.Extensions; -using MediaBrowser.Controller; -using MediaBrowser.Controller.Drawing; -using MediaBrowser.Controller.Entities; -using MediaBrowser.Controller.Providers; -using MediaBrowser.Model.Drawing; -using MediaBrowser.Model.Entities; -using Microsoft.Extensions.Logging; -using MediaBrowser.Model.Serialization; using System; -using System.Collections.Concurrent; using System.Collections.Generic; using System.Globalization; using System.IO; using System.Linq; using System.Threading; using System.Threading.Tasks; -using MediaBrowser.Model.IO; using Emby.Drawing.Common; +using MediaBrowser.Common.Extensions; +using MediaBrowser.Controller; +using MediaBrowser.Controller.Drawing; +using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Library; using MediaBrowser.Controller.MediaEncoding; +using MediaBrowser.Controller.Providers; +using MediaBrowser.Model.Drawing; +using MediaBrowser.Model.Entities; +using MediaBrowser.Model.Extensions; +using MediaBrowser.Model.IO; using MediaBrowser.Model.Net; +using MediaBrowser.Model.Serialization; using MediaBrowser.Model.Threading; -using MediaBrowser.Model.Extensions; +using Microsoft.Extensions.Logging; namespace Emby.Drawing { @@ -75,7 +74,7 @@ namespace Emby.Drawing public IImageEncoder ImageEncoder { - get { return _imageEncoder; } + get => _imageEncoder; set { if (value == null) @@ -87,67 +86,44 @@ namespace Emby.Drawing } } - public string[] SupportedInputFormats - { - get + public string[] SupportedInputFormats => + new string[] { - return new string[] - { - "tiff", - "tif", - "jpeg", - "jpg", - "png", - "aiff", - "cr2", - "crw", - - // Remove until supported - //"nef", - "orf", - "pef", - "arw", - "webp", - "gif", - "bmp", - "erf", - "raf", - "rw2", - "nrw", - "dng", - "ico", - "astc", - "ktx", - "pkm", - "wbmp" - }; - } - } + "tiff", + "tif", + "jpeg", + "jpg", + "png", + "aiff", + "cr2", + "crw", + // Remove until supported + //"nef", + "orf", + "pef", + "arw", + "webp", + "gif", + "bmp", + "erf", + "raf", + "rw2", + "nrw", + "dng", + "ico", + "astc", + "ktx", + "pkm", + "wbmp" + }; - public bool SupportsImageCollageCreation - { - get - { - return _imageEncoder.SupportsImageCollageCreation; - } - } - private string ResizedImageCachePath - { - get - { - return Path.Combine(_appPaths.ImageCachePath, "resized-images"); - } - } + public bool SupportsImageCollageCreation => _imageEncoder.SupportsImageCollageCreation; - private string EnhancedImageCachePath - { - get - { - return Path.Combine(_appPaths.ImageCachePath, "enhanced-images"); - } - } + private string ResizedImageCachePath => Path.Combine(_appPaths.ImageCachePath, "resized-images"); + + private string EnhancedImageCachePath => Path.Combine(_appPaths.ImageCachePath, "enhanced-images"); public void AddParts(IEnumerable<IImageEnhancer> enhancers) { @@ -515,7 +491,7 @@ namespace Emby.Drawing /// <param name="item">The item.</param> /// <param name="image">The image.</param> /// <returns>Guid.</returns> - /// <exception cref="System.ArgumentNullException">item</exception> + /// <exception cref="ArgumentNullException">item</exception> public string GetImageCacheTag(BaseItem item, ItemImageInfo image) { var supportedEnhancers = GetSupportedEnhancers(item, image.Type); @@ -547,7 +523,7 @@ namespace Emby.Drawing /// <param name="image">The image.</param> /// <param name="imageEnhancers">The image enhancers.</param> /// <returns>Guid.</returns> - /// <exception cref="System.ArgumentNullException">item</exception> + /// <exception cref="ArgumentNullException">item</exception> public string GetImageCacheTag(BaseItem item, ItemImageInfo image, IImageEnhancer[] imageEnhancers) { var originalImagePath = image.Path; @@ -768,7 +744,7 @@ namespace Emby.Drawing /// <param name="uniqueName">Name of the unique.</param> /// <param name="fileExtension">The file extension.</param> /// <returns>System.String.</returns> - /// <exception cref="System.ArgumentNullException"> + /// <exception cref="ArgumentNullException"> /// path /// or /// uniqueName @@ -802,7 +778,7 @@ namespace Emby.Drawing /// <param name="path">The path.</param> /// <param name="filename">The filename.</param> /// <returns>System.String.</returns> - /// <exception cref="System.ArgumentNullException"> + /// <exception cref="ArgumentNullException"> /// path /// or /// filename @@ -870,8 +846,7 @@ namespace Emby.Drawing { lock (_locks) { - LockInfo info; - if (_locks.TryGetValue(key, out info)) + if (_locks.TryGetValue(key, out var info)) { info.Count++; } diff --git a/Emby.Drawing/NullImageEncoder.cs b/Emby.Drawing/NullImageEncoder.cs index 95ea42ecf..e6f205a1f 100644 --- a/Emby.Drawing/NullImageEncoder.cs +++ b/Emby.Drawing/NullImageEncoder.cs @@ -1,4 +1,4 @@ -using System; +using System; using MediaBrowser.Controller.Drawing; using MediaBrowser.Model.Drawing; @@ -6,26 +6,15 @@ namespace Emby.Drawing { public class NullImageEncoder : IImageEncoder { - public string[] SupportedInputFormats - { - get + public string[] SupportedInputFormats => + new[] { - return new[] - { - "png", - "jpeg", - "jpg" - }; - } - } + "png", + "jpeg", + "jpg" + }; - public ImageFormat[] SupportedOutputFormats - { - get - { - return new[] { ImageFormat.Jpg, ImageFormat.Png }; - } - } + public ImageFormat[] SupportedOutputFormats => new[] { ImageFormat.Jpg, ImageFormat.Png }; public void CropWhiteSpace(string inputPath, string outputPath) { @@ -42,20 +31,11 @@ namespace Emby.Drawing throw new NotImplementedException(); } - public string Name - { - get { return "Null Image Encoder"; } - } + public string Name => "Null Image Encoder"; - public bool SupportsImageCollageCreation - { - get { return false; } - } + public bool SupportsImageCollageCreation => false; - public bool SupportsImageEncoding - { - get { return false; } - } + public bool SupportsImageEncoding => false; public ImageSize GetImageSize(string path) { |
