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); }
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); }
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); }