Bombsquad.DynamicMedia.Implementations.FormatInfo.RegistryFormatInfoProvider.ResolveFromExtension C# (CSharp) Method

ResolveFromExtension() public method

public ResolveFromExtension ( string extension ) : IFormatInfo
extension string
return IFormatInfo
        public IFormatInfo ResolveFromExtension( string extension )
        {
            if ( string.IsNullOrEmpty( extension ) || !extension.StartsWith( "." ) )
            {
                return null;
            }

            return m_formatInfoCache.GetOrAdd( extension, key =>
            {
                var contentType = Registry.GetValue( @"HKEY_CLASSES_ROOT\" + extension, "Content Type", null ) as string;

                if ( string.IsNullOrEmpty( contentType ) )
                {
                    return null;
                }

                return new FormatInfo
                {
                    Extension = extension,
                    ContentType = contentType,
                    AllowCompression = false,
                    ClientCacheMaxAge = m_clientCacheMaxAge
                };
            } );
        }