Exemplo n.º 1
0
        public static FileFormat GetFileFormatNoUnknown(FilePath imageFilePath, IStringlyTypedPathOperator stringlyTypedPathOperator)
        {
            var fileFormat = ImageFileFormatOperator.GetFileFormatAllowUnknown(imageFilePath, stringlyTypedPathOperator);

            if (fileFormat == FileFormat.Unknown)
            {
                var fileExtension = stringlyTypedPathOperator.GetFileExtension(imageFilePath.Value);

                var message = EnumerationHelper.UnrecognizedEnumerationValueMessage <FileFormat>(fileExtension);
                throw new Exception(message);
            }

            return(fileFormat);
        }