From 1ab518518113a0cad46592e2f7b3103f550eb947 Mon Sep 17 00:00:00 2001 From: Brian Popow Date: Tue, 17 Aug 2021 12:38:08 +0200 Subject: [PATCH] Add NotSupportedException to the Image.Load overload documentation --- src/ImageSharp/Image.FromBytes.cs | 28 +++++++++++++++++++++++----- src/ImageSharp/Image.FromFile.cs | 18 ++++++++++++++++++ 2 files changed, 41 insertions(+), 5 deletions(-) diff --git a/src/ImageSharp/Image.FromBytes.cs b/src/ImageSharp/Image.FromBytes.cs index a33a345a0f..789a936879 100644 --- a/src/ImageSharp/Image.FromBytes.cs +++ b/src/ImageSharp/Image.FromBytes.cs @@ -102,6 +102,7 @@ namespace SixLabors.ImageSharp /// The pixel format. /// The data is null. /// Image format not recognised. + /// Image format is not supported. /// Image contains invalid content. /// A new . public static Image Load(byte[] data) @@ -116,6 +117,7 @@ namespace SixLabors.ImageSharp /// The pixel format. /// The data is null. /// Image format not recognised. + /// Image format is not supported. /// Image contains invalid content. /// A new . public static Image Load(byte[] data, out IImageFormat format) @@ -131,6 +133,7 @@ namespace SixLabors.ImageSharp /// The configuration is null. /// The data is null. /// Image format not recognised. + /// Image format is not supported. /// Image contains invalid content. /// A new . public static Image Load(Configuration configuration, byte[] data) @@ -154,6 +157,7 @@ namespace SixLabors.ImageSharp /// The configuration is null. /// The data is null. /// Image format not recognised. + /// Image format is not supported. /// Image contains invalid content. /// A new . public static Image Load(Configuration configuration, byte[] data, out IImageFormat format) @@ -175,6 +179,7 @@ namespace SixLabors.ImageSharp /// The pixel format. /// The data is null. /// Image format not recognised. + /// Image format is not supported. /// Image contains invalid content. /// A new . public static Image Load(byte[] data, IImageDecoder decoder) @@ -198,6 +203,7 @@ namespace SixLabors.ImageSharp /// The configuration is null. /// The data is null. /// Image format not recognised. + /// Image format is not supported. /// Image contains invalid content. /// A new . public static Image Load(Configuration configuration, byte[] data, IImageDecoder decoder) @@ -216,10 +222,7 @@ namespace SixLabors.ImageSharp /// /// The byte span containing encoded image data to read the header from. /// The format or null if none found. - public static IImageFormat DetectFormat(ReadOnlySpan data) - { - return DetectFormat(Configuration.Default, data); - } + public static IImageFormat DetectFormat(ReadOnlySpan data) => DetectFormat(Configuration.Default, data); /// /// By reading the header on the provided byte span this calculates the images format. @@ -258,6 +261,7 @@ namespace SixLabors.ImageSharp /// The pixel format. /// Image format not recognised. /// Image contains invalid content. + /// Image format is not supported. /// A new . public static Image Load(ReadOnlySpan data) where TPixel : unmanaged, IPixel @@ -271,6 +275,7 @@ namespace SixLabors.ImageSharp /// The pixel format. /// Image format not recognised. /// Image contains invalid content. + /// Image format is not supported. /// A new . public static Image Load(ReadOnlySpan data, out IImageFormat format) where TPixel : unmanaged, IPixel @@ -284,6 +289,7 @@ namespace SixLabors.ImageSharp /// The pixel format. /// Image format not recognised. /// Image contains invalid content. + /// Image format is not supported. /// A new . public static Image Load(ReadOnlySpan data, IImageDecoder decoder) where TPixel : unmanaged, IPixel @@ -298,6 +304,7 @@ namespace SixLabors.ImageSharp /// The configuration is null. /// Image format not recognised. /// Image contains invalid content. + /// Image format is not supported. /// A new . public static unsafe Image Load(Configuration configuration, ReadOnlySpan data) where TPixel : unmanaged, IPixel @@ -321,6 +328,7 @@ namespace SixLabors.ImageSharp /// The configuration is null. /// Image format not recognised. /// Image contains invalid content. + /// Image format is not supported. /// A new . public static unsafe Image Load( Configuration configuration, @@ -347,6 +355,7 @@ namespace SixLabors.ImageSharp /// The configuration is null. /// Image format not recognised. /// Image contains invalid content. + /// Image format is not supported. /// A new . public static unsafe Image Load( Configuration configuration, @@ -372,6 +381,7 @@ namespace SixLabors.ImageSharp /// The data is null. /// Image format not recognised. /// Image contains invalid content. + /// Image format is not supported. /// The . public static Image Load(byte[] data, out IImageFormat format) => Load(Configuration.Default, data, out format); @@ -384,6 +394,7 @@ namespace SixLabors.ImageSharp /// The data is null. /// Image format not recognised. /// Image contains invalid content. + /// Image format is not supported. /// The . public static Image Load(byte[] data, IImageDecoder decoder) => Load(Configuration.Default, data, decoder); @@ -397,6 +408,7 @@ namespace SixLabors.ImageSharp /// The data is null. /// Image format not recognised. /// Image contains invalid content. + /// Image format is not supported. /// The . public static Image Load(Configuration configuration, byte[] data) => Load(configuration, data, out _); @@ -411,6 +423,7 @@ namespace SixLabors.ImageSharp /// The data is null. /// Image format not recognised. /// Image contains invalid content. + /// Image format is not supported. /// The . public static Image Load(Configuration configuration, byte[] data, IImageDecoder decoder) { @@ -430,6 +443,7 @@ namespace SixLabors.ImageSharp /// The data is null. /// Image format not recognised. /// Image contains invalid content. + /// Image format is not supported. /// The . public static Image Load(Configuration configuration, byte[] data, out IImageFormat format) { @@ -445,6 +459,7 @@ namespace SixLabors.ImageSharp /// The byte span containing image data. /// Image format not recognised. /// Image contains invalid content. + /// Image format is not supported. /// The . public static Image Load(ReadOnlySpan data) => Load(Configuration.Default, data); @@ -458,6 +473,7 @@ namespace SixLabors.ImageSharp /// The decoder is null. /// Image format not recognised. /// Image contains invalid content. + /// Image format is not supported. /// The . public static Image Load(ReadOnlySpan data, IImageDecoder decoder) => Load(Configuration.Default, data, decoder); @@ -470,6 +486,7 @@ namespace SixLabors.ImageSharp /// The decoder is null. /// Image format not recognised. /// Image contains invalid content. + /// Image format is not supported. /// The . public static Image Load(ReadOnlySpan data, out IImageFormat format) => Load(Configuration.Default, data, out format); @@ -491,7 +508,7 @@ namespace SixLabors.ImageSharp /// The decoder. /// The configuration is null. /// The decoder is null. - /// The stream is not readable. + /// The stream is not readable or the image format is not supported. /// Image format not recognised. /// Image contains invalid content. /// The . @@ -518,6 +535,7 @@ namespace SixLabors.ImageSharp /// The configuration is null. /// Image format not recognised. /// Image contains invalid content. + /// Image format is not supported. /// The . public static unsafe Image Load( Configuration configuration, diff --git a/src/ImageSharp/Image.FromFile.cs b/src/ImageSharp/Image.FromFile.cs index bf239c3e9f..3a4b459c54 100644 --- a/src/ImageSharp/Image.FromFile.cs +++ b/src/ImageSharp/Image.FromFile.cs @@ -182,6 +182,7 @@ namespace SixLabors.ImageSharp /// The configuration is null. /// The path is null. /// Image format not recognised. + /// Image format is not supported. /// Image contains invalid content. /// The . public static Image Load(Configuration configuration, string path) @@ -196,6 +197,7 @@ namespace SixLabors.ImageSharp /// The configuration is null. /// The path is null. /// Image format not recognised. + /// Image format is not supported. /// Image contains invalid content. /// A representing the asynchronous operation. public static async Task LoadAsync( @@ -219,6 +221,7 @@ namespace SixLabors.ImageSharp /// The path is null. /// The decoder is null. /// Image format not recognised. + /// Image format is not supported. /// Image contains invalid content. /// The . public static Image Load(Configuration configuration, string path, IImageDecoder decoder) @@ -241,6 +244,7 @@ namespace SixLabors.ImageSharp /// The path is null. /// The decoder is null. /// Image format not recognised. + /// Image format is not supported. /// Image contains invalid content. /// A representing the asynchronous operation. public static Task LoadAsync(string path, CancellationToken cancellationToken = default) @@ -255,6 +259,7 @@ namespace SixLabors.ImageSharp /// The path is null. /// The decoder is null. /// Image format not recognised. + /// Image format is not supported. /// Image contains invalid content. /// A representing the asynchronous operation. public static Task LoadAsync(string path, IImageDecoder decoder) @@ -269,6 +274,7 @@ namespace SixLabors.ImageSharp /// The path is null. /// The decoder is null. /// Image format not recognised. + /// Image format is not supported. /// Image contains invalid content. /// The pixel format. /// A representing the asynchronous operation. @@ -287,6 +293,7 @@ namespace SixLabors.ImageSharp /// The path is null. /// The decoder is null. /// Image format not recognised. + /// Image format is not supported. /// Image contains invalid content. /// A representing the asynchronous operation. public static Task LoadAsync( @@ -313,6 +320,7 @@ namespace SixLabors.ImageSharp /// The path is null. /// The decoder is null. /// Image format not recognised. + /// Image format is not supported. /// Image contains invalid content. /// The pixel format. /// A representing the asynchronous operation. @@ -338,6 +346,7 @@ namespace SixLabors.ImageSharp /// The path is null. /// Image format not recognised. /// Image contains invalid content. + /// Image format is not supported. /// The pixel format. /// A representing the asynchronous operation. public static Task> LoadAsync(string path) @@ -353,6 +362,7 @@ namespace SixLabors.ImageSharp /// The configuration is null. /// The path is null. /// Image format not recognised. + /// Image format is not supported. /// Image contains invalid content. /// The pixel format. /// A representing the asynchronous operation. @@ -376,6 +386,7 @@ namespace SixLabors.ImageSharp /// The path is null. /// The decoder is null. /// Image format not recognised. + /// Image format is not supported. /// Image contains invalid content. /// The . public static Image Load(string path, IImageDecoder decoder) @@ -388,6 +399,7 @@ namespace SixLabors.ImageSharp /// The path is null. /// Image format not recognised. /// Image contains invalid content. + /// Image format is not supported. /// The pixel format. /// A new . public static Image Load(string path) @@ -402,6 +414,7 @@ namespace SixLabors.ImageSharp /// The path is null. /// Image format not recognised. /// Image contains invalid content. + /// Image format is not supported. /// The pixel format. /// A new . public static Image Load(string path, out IImageFormat format) @@ -416,6 +429,7 @@ namespace SixLabors.ImageSharp /// The configuration is null. /// The path is null. /// Image format not recognised. + /// Image format is not supported. /// Image contains invalid content. /// The pixel format. /// A new . @@ -440,6 +454,7 @@ namespace SixLabors.ImageSharp /// The configuration is null. /// The path is null. /// Image format not recognised. + /// Image format is not supported. /// Image contains invalid content. /// The pixel format. /// A new . @@ -465,6 +480,7 @@ namespace SixLabors.ImageSharp /// The configuration is null. /// The path is null. /// Image format not recognised. + /// Image format is not supported. /// Image contains invalid content. /// A new . public static Image Load(Configuration configuration, string path, out IImageFormat format) @@ -485,6 +501,7 @@ namespace SixLabors.ImageSharp /// The decoder. /// The path is null. /// Image format not recognised. + /// Image format is not supported. /// Image contains invalid content. /// The pixel format. /// A new . @@ -502,6 +519,7 @@ namespace SixLabors.ImageSharp /// The path is null. /// The decoder is null. /// Image format not recognised. + /// Image format is not supported. /// Image contains invalid content. /// The pixel format. /// A new .