コード例 #1
0
        /// <summary>
        /// Returns true when the supplied stream is supported.
        /// </summary>
        /// <param name="stream">The stream to check.</param>
        /// <returns>True when the supplied stream is supported.</returns>
        public bool IsSupported(Stream stream)
        {
            Throw.IfNull(nameof(stream), stream);

            if (!stream.CanRead || !stream.CanWrite || !stream.CanSeek)
            {
                return(false);
            }

            return(IsSupported(ImageOptimizerHelper.GetFormatInformation(stream)));
        }
コード例 #2
0
        private IImageOptimizer GetOptimizer(Stream stream)
        {
            var info = ImageOptimizerHelper.GetFormatInformation(stream);

            return(GetOptimizer(info));
        }
コード例 #3
0
        private IImageOptimizer GetOptimizer(FileInfo file)
        {
            var info = ImageOptimizerHelper.GetFormatInformation(file);

            return(GetOptimizer(info));
        }
コード例 #4
0
 /// <summary>
 /// Returns true when the supplied file name is supported based on the extension of the file.
 /// </summary>
 /// <param name="fileName">The name of the file to check.</param>
 /// <returns>True when the supplied file name is supported based on the extension of the file.</returns>
 public bool IsSupported(string fileName) => IsSupported(ImageOptimizerHelper.GetFormatInformation(fileName));
コード例 #5
0
 /// <summary>
 /// Returns true when the supplied file name is supported based on the extension of the file.
 /// </summary>
 /// <param name="file">The file to check.</param>
 /// <returns>True when the supplied file name is supported based on the extension of the file.</returns>
 /// <returns>True when the image could be compressed otherwise false.</returns>
 public bool IsSupported(FileInfo file) => IsSupported(ImageOptimizerHelper.GetFormatInformation(file));