public IFormatInfo ResolveFromExtension(string extension)
{
if (string.IsNullOrEmpty(extension) || !extension.StartsWith("."))
{
return null;
}
FormatInfoElement infoElement;
if (!m_lookupFromExtension.TryGetValue(extension, out infoElement))
{
return null;
}
return new FormatInfo
{
Extension = extension.ToLower(),
ContentType = infoElement.ContentType.ToLower(),
AllowCompression = infoElement.AllowCompression,
ClientCacheMaxAge = infoElement.ClientCacheMaxAge.HasValue
? TimeSpan.FromSeconds(infoElement.ClientCacheMaxAge.Value)
: (TimeSpan?)null
};
}