private HTMLResponseContentType GetContentType(string extension) { if (contentTypes == null) { contentTypes = new Dictionary <string, HTMLResponseContentType>(); contentTypes[".html"] = new HTMLResponseContentType { contentType = HTMLContentType.TextContent, mimeType = "text/html" }; contentTypes[".css"] = new HTMLResponseContentType { contentType = HTMLContentType.TextContent, mimeType = "text/css" }; contentTypes[".js"] = new HTMLResponseContentType { contentType = HTMLContentType.TextContent, mimeType = "application/x-javascript" }; contentTypes[".jpg"] = new HTMLResponseContentType { contentType = HTMLContentType.BinaryContent, mimeType = "image/jpeg" }; contentTypes[".jpeg"] = new HTMLResponseContentType { contentType = HTMLContentType.BinaryContent, mimeType = "image/jpeg" }; contentTypes[".png"] = new HTMLResponseContentType { contentType = HTMLContentType.BinaryContent, mimeType = "image/png" }; contentTypes[".gif"] = new HTMLResponseContentType { contentType = HTMLContentType.BinaryContent, mimeType = "image/gif" }; contentTypes[".svg"] = new HTMLResponseContentType { contentType = HTMLContentType.BinaryContent, mimeType = "image/svg+xml" }; contentTypes[".eot"] = new HTMLResponseContentType { contentType = HTMLContentType.BinaryContent, mimeType = "application/vnd.ms-fontobject" }; contentTypes[".ttf"] = new HTMLResponseContentType { contentType = HTMLContentType.BinaryContent, mimeType = "application/font-sfnt" }; contentTypes[".woff"] = new HTMLResponseContentType { contentType = HTMLContentType.BinaryContent, mimeType = "application/font-woff" }; contentTypes[".otf"] = new HTMLResponseContentType { contentType = HTMLContentType.BinaryContent, mimeType = "application/font-sfnt" }; contentTypes[""] = new HTMLResponseContentType { contentType = HTMLContentType.BinaryContent, mimeType = null }; } if (contentTypes.ContainsKey(extension)) { return(contentTypes[extension]); } else { return(contentTypes[""]); } }
private HTMLResponseContentType GetContentType(string extension) { if (contentTypes == null) { contentTypes = new Dictionary<string, HTMLResponseContentType>(); contentTypes[".html"] = new HTMLResponseContentType { contentType = HTMLContentType.TextContent, mimeType = "text/html" }; contentTypes[".css"] = new HTMLResponseContentType { contentType = HTMLContentType.TextContent, mimeType = "text/css" }; contentTypes[".js"] = new HTMLResponseContentType { contentType = HTMLContentType.TextContent, mimeType = "application/x-javascript" }; contentTypes[".jpg"] = new HTMLResponseContentType { contentType = HTMLContentType.BinaryContent, mimeType = "image/jpeg" }; contentTypes[".jpeg"] = new HTMLResponseContentType { contentType = HTMLContentType.BinaryContent, mimeType = "image/jpeg" }; contentTypes[".png"] = new HTMLResponseContentType { contentType = HTMLContentType.BinaryContent, mimeType = "image/png" }; contentTypes[".gif"] = new HTMLResponseContentType { contentType = HTMLContentType.BinaryContent, mimeType = "image/gif" }; contentTypes[".svg"] = new HTMLResponseContentType { contentType = HTMLContentType.BinaryContent, mimeType = "image/svg+xml" }; contentTypes[".eot"] = new HTMLResponseContentType { contentType = HTMLContentType.BinaryContent, mimeType = "application/vnd.ms-fontobject" }; contentTypes[".ttf"] = new HTMLResponseContentType { contentType = HTMLContentType.BinaryContent, mimeType = "application/font-sfnt" }; contentTypes[".woff"] = new HTMLResponseContentType { contentType = HTMLContentType.BinaryContent, mimeType = "application/font-woff" }; contentTypes[".otf"] = new HTMLResponseContentType { contentType = HTMLContentType.BinaryContent, mimeType = "application/font-sfnt" }; contentTypes[""] = new HTMLResponseContentType { contentType = HTMLContentType.BinaryContent, mimeType = null }; } if (contentTypes.ContainsKey(extension)) { return contentTypes[extension]; } else { return contentTypes[""]; } }