Esempio n. 1
0
        public static ImageTypeMapping ByMimeType(string mimeType)
        {
            ImageTypeMapping imageTypeMapping = ImageTypeMapper.mappings.Find((ImageTypeMapping candidate) => candidate.mimeType == mimeType);

            if (imageTypeMapping == null)
            {
                throw new UnknownImageTypeException(mimeType);
            }
            return(imageTypeMapping);
        }
Esempio n. 2
0
        public static ImageTypeMapping ByImageFormat(ImageFormat imageFormat)
        {
            ImageTypeMapping imageTypeMapping = ImageTypeMapper.mappings.Find((ImageTypeMapping candidate) => candidate.ImageFormatEquals(imageFormat));

            if (imageTypeMapping == null)
            {
                throw new UnknownImageTypeException(imageFormat.ToString());
            }
            return(imageTypeMapping);
        }
Esempio n. 3
0
        public static ImageTypeMapping ByExtension(string extension)
        {
            if (extension[0] == '.')
            {
                extension = extension.Substring(1);
            }
            extension = extension.ToLower();
            ImageTypeMapping imageTypeMapping = ImageTypeMapper.mappings.Find((ImageTypeMapping candidate) => candidate.extension == extension);

            if (imageTypeMapping == null)
            {
                throw new UnknownImageTypeException(extension);
            }
            return(imageTypeMapping);
        }