From ec1f5dc317182582ebff843c9e8a4d5277405469 Mon Sep 17 00:00:00 2001 From: Erwin de Haan Date: Sun, 6 Jan 2019 21:50:43 +0100 Subject: Mayor code cleanup Add Argument*Exceptions now use proper nameof operators. Added exception messages to quite a few Argument*Exceptions. Fixed rethorwing to be proper syntax. Added a ton of null checkes. (This is only a start, there are about 500 places that need proper null handling) Added some TODOs to log certain exceptions. Fix sln again. Fixed all AssemblyInfo's and added proper copyright (where I could find them) We live in *current year*. Fixed the use of braces. Fixed a ton of properties, and made a fair amount of functions static that should be and can be static. Made more Methods that should be static static. You can now use static to find bad functions! Removed unused variable. And added one more proper XML comment. --- Emby.Drawing/Common/ImageHeader.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Emby.Drawing/Common/ImageHeader.cs') diff --git a/Emby.Drawing/Common/ImageHeader.cs b/Emby.Drawing/Common/ImageHeader.cs index f37f396f5..592705d6c 100644 --- a/Emby.Drawing/Common/ImageHeader.cs +++ b/Emby.Drawing/Common/ImageHeader.cs @@ -94,7 +94,7 @@ namespace Emby.Drawing.Common } } - throw new ArgumentException(ErrorMessage, "binaryReader"); + throw new ArgumentException(ErrorMessage, nameof(binaryReader)); } /// -- cgit v1.2.3 From f2dae8ee519904116cd11381eee518ce55db4373 Mon Sep 17 00:00:00 2001 From: hawken Date: Sat, 12 Jan 2019 12:45:14 +0000 Subject: Make image header extension matching case insensitive --- Emby.Drawing/Common/ImageHeader.cs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'Emby.Drawing/Common/ImageHeader.cs') diff --git a/Emby.Drawing/Common/ImageHeader.cs b/Emby.Drawing/Common/ImageHeader.cs index f37f396f5..844c966bb 100644 --- a/Emby.Drawing/Common/ImageHeader.cs +++ b/Emby.Drawing/Common/ImageHeader.cs @@ -50,12 +50,13 @@ namespace Emby.Drawing.Common /// The image was of an unrecognised format. public static ImageSize GetDimensions(string path, ILogger logger, IFileSystem fileSystem) { - var extension = Path.GetExtension(path); - - if (string.IsNullOrEmpty(extension)) + if (string.IsNullOrEmpty(path)) { - throw new ArgumentException("ImageHeader doesn't support image file"); + throw new ArgumentNullException(nameof(path)); } + + string extension = Path.GetExtension(path).ToLower(); + if (!SupportedExtensions.Contains(extension)) { throw new ArgumentException("ImageHeader doesn't support " + extension); -- cgit v1.2.3