source: TFP-WebServer/WebServer/src/MimeType.cs@ 449

Last change on this file since 449 was 402, checked in by alloc, 22 months ago
  • Major refactoring
  • Using Utf8Json for (de)serialization
  • Moving APIs to REST
  • Removing dependencies from WebServer and MapRenderer to ServerFixes
File size: 21.4 KB
Line 
1using System;
2using System.Collections.Generic;
3
4namespace Webserver {
5 public static class MimeType {
6 private static readonly IDictionary<string, string> mappings =
7 new CaseInsensitiveStringDictionary<string> {
8 {".323", "text/h323"},
9 {".3g2", "video/3gpp2"},
10 {".3gp", "video/3gpp"},
11 {".3gp2", "video/3gpp2"},
12 {".3gpp", "video/3gpp"},
13 {".7z", "application/x-7z-compressed"},
14 {".aa", "audio/audible"},
15 {".AAC", "audio/aac"},
16 {".aaf", "application/octet-stream"},
17 {".aax", "audio/vnd.audible.aax"},
18 {".ac3", "audio/ac3"},
19 {".aca", "application/octet-stream"},
20 {".accda", "application/msaccess.addin"},
21 {".accdb", "application/msaccess"},
22 {".accdc", "application/msaccess.cab"},
23 {".accde", "application/msaccess"},
24 {".accdr", "application/msaccess.runtime"},
25 {".accdt", "application/msaccess"},
26 {".accdw", "application/msaccess.webapplication"},
27 {".accft", "application/msaccess.ftemplate"},
28 {".acx", "application/internet-property-stream"},
29 {".AddIn", "text/xml"},
30 {".ade", "application/msaccess"},
31 {".adobebridge", "application/x-bridge-url"},
32 {".adp", "application/msaccess"},
33 {".ADT", "audio/vnd.dlna.adts"},
34 {".ADTS", "audio/aac"},
35 {".afm", "application/octet-stream"},
36 {".ai", "application/postscript"},
37 {".aif", "audio/x-aiff"},
38 {".aifc", "audio/aiff"},
39 {".aiff", "audio/aiff"},
40 {".air", "application/vnd.adobe.air-application-installer-package+zip"},
41 {".amc", "application/x-mpeg"},
42 {".application", "application/x-ms-application"},
43 {".art", "image/x-jg"},
44 {".asa", "application/xml"},
45 {".asax", "application/xml"},
46 {".ascx", "application/xml"},
47 {".asd", "application/octet-stream"},
48 {".asf", "video/x-ms-asf"},
49 {".ashx", "application/xml"},
50 {".asi", "application/octet-stream"},
51 {".asm", "text/plain"},
52 {".asmx", "application/xml"},
53 {".aspx", "application/xml"},
54 {".asr", "video/x-ms-asf"},
55 {".asx", "video/x-ms-asf"},
56 {".atom", "application/atom+xml"},
57 {".au", "audio/basic"},
58 {".avi", "video/x-msvideo"},
59 {".axs", "application/olescript"},
60 {".bas", "text/plain"},
61 {".bcpio", "application/x-bcpio"},
62 {".bin", "application/octet-stream"},
63 {".bmp", "image/bmp"},
64 {".c", "text/plain"},
65 {".cab", "application/octet-stream"},
66 {".caf", "audio/x-caf"},
67 {".calx", "application/vnd.ms-office.calx"},
68 {".cat", "application/vnd.ms-pki.seccat"},
69 {".cc", "text/plain"},
70 {".cd", "text/plain"},
71 {".cdda", "audio/aiff"},
72 {".cdf", "application/x-cdf"},
73 {".cer", "application/x-x509-ca-cert"},
74 {".chm", "application/octet-stream"},
75 {".class", "application/x-java-applet"},
76 {".clp", "application/x-msclip"},
77 {".cmx", "image/x-cmx"},
78 {".cnf", "text/plain"},
79 {".cod", "image/cis-cod"},
80 {".config", "application/xml"},
81 {".contact", "text/x-ms-contact"},
82 {".coverage", "application/xml"},
83 {".cpio", "application/x-cpio"},
84 {".cpp", "text/plain"},
85 {".crd", "application/x-mscardfile"},
86 {".crl", "application/pkix-crl"},
87 {".crt", "application/x-x509-ca-cert"},
88 {".cs", "text/plain"},
89 {".csdproj", "text/plain"},
90 {".csh", "application/x-csh"},
91 {".csproj", "text/plain"},
92 {".css", "text/css"},
93 {".csv", "text/csv"},
94 {".cur", "application/octet-stream"},
95 {".cxx", "text/plain"},
96 {".dat", "application/octet-stream"},
97 {".datasource", "application/xml"},
98 {".dbproj", "text/plain"},
99 {".dcr", "application/x-director"},
100 {".def", "text/plain"},
101 {".deploy", "application/octet-stream"},
102 {".der", "application/x-x509-ca-cert"},
103 {".dgml", "application/xml"},
104 {".dib", "image/bmp"},
105 {".dif", "video/x-dv"},
106 {".dir", "application/x-director"},
107 {".disco", "text/xml"},
108 {".dll", "application/x-msdownload"},
109 {".dll.config", "text/xml"},
110 {".dlm", "text/dlm"},
111 {".doc", "application/msword"},
112 {".docm", "application/vnd.ms-word.document.macroEnabled.12"},
113 {".docx", "application/vnd.openxmlformats-officedocument.wordprocessingml.document"},
114 {".dot", "application/msword"},
115 {".dotm", "application/vnd.ms-word.template.macroEnabled.12"},
116 {".dotx", "application/vnd.openxmlformats-officedocument.wordprocessingml.template"},
117 {".dsp", "application/octet-stream"},
118 {".dsw", "text/plain"},
119 {".dtd", "text/xml"},
120 {".dtsConfig", "text/xml"},
121 {".dv", "video/x-dv"},
122 {".dvi", "application/x-dvi"},
123 {".dwf", "drawing/x-dwf"},
124 {".dwp", "application/octet-stream"},
125 {".dxr", "application/x-director"},
126 {".eml", "message/rfc822"},
127 {".emz", "application/octet-stream"},
128 {".eot", "application/octet-stream"},
129 {".eps", "application/postscript"},
130 {".etl", "application/etl"},
131 {".etx", "text/x-setext"},
132 {".evy", "application/envoy"},
133 {".exe", "application/octet-stream"},
134 {".exe.config", "text/xml"},
135 {".fdf", "application/vnd.fdf"},
136 {".fif", "application/fractals"},
137 {".filters", "Application/xml"},
138 {".fla", "application/octet-stream"},
139 {".flr", "x-world/x-vrml"},
140 {".flv", "video/x-flv"},
141 {".fsscript", "application/fsharp-script"},
142 {".fsx", "application/fsharp-script"},
143 {".generictest", "application/xml"},
144 {".gif", "image/gif"},
145 {".group", "text/x-ms-group"},
146 {".gsm", "audio/x-gsm"},
147 {".gtar", "application/x-gtar"},
148 {".gz", "application/x-gzip"},
149 {".h", "text/plain"},
150 {".hdf", "application/x-hdf"},
151 {".hdml", "text/x-hdml"},
152 {".hhc", "application/x-oleobject"},
153 {".hhk", "application/octet-stream"},
154 {".hhp", "application/octet-stream"},
155 {".hlp", "application/winhlp"},
156 {".hpp", "text/plain"},
157 {".hqx", "application/mac-binhex40"},
158 {".hta", "application/hta"},
159 {".htc", "text/x-component"},
160 {".htm", "text/html"},
161 {".html", "text/html"},
162 {".htt", "text/webviewhtml"},
163 {".hxa", "application/xml"},
164 {".hxc", "application/xml"},
165 {".hxd", "application/octet-stream"},
166 {".hxe", "application/xml"},
167 {".hxf", "application/xml"},
168 {".hxh", "application/octet-stream"},
169 {".hxi", "application/octet-stream"},
170 {".hxk", "application/xml"},
171 {".hxq", "application/octet-stream"},
172 {".hxr", "application/octet-stream"},
173 {".hxs", "application/octet-stream"},
174 {".hxt", "text/html"},
175 {".hxv", "application/xml"},
176 {".hxw", "application/octet-stream"},
177 {".hxx", "text/plain"},
178 {".i", "text/plain"},
179 {".ico", "image/x-icon"},
180 {".ics", "application/octet-stream"},
181 {".idl", "text/plain"},
182 {".ief", "image/ief"},
183 {".iii", "application/x-iphone"},
184 {".inc", "text/plain"},
185 {".inf", "application/octet-stream"},
186 {".inl", "text/plain"},
187 {".ins", "application/x-internet-signup"},
188 {".ipa", "application/x-itunes-ipa"},
189 {".ipg", "application/x-itunes-ipg"},
190 {".ipproj", "text/plain"},
191 {".ipsw", "application/x-itunes-ipsw"},
192 {".iqy", "text/x-ms-iqy"},
193 {".isp", "application/x-internet-signup"},
194 {".ite", "application/x-itunes-ite"},
195 {".itlp", "application/x-itunes-itlp"},
196 {".itms", "application/x-itunes-itms"},
197 {".itpc", "application/x-itunes-itpc"},
198 {".IVF", "video/x-ivf"},
199 {".jar", "application/java-archive"},
200 {".java", "application/octet-stream"},
201 {".jck", "application/liquidmotion"},
202 {".jcz", "application/liquidmotion"},
203 {".jfif", "image/pjpeg"},
204 {".jnlp", "application/x-java-jnlp-file"},
205 {".jpb", "application/octet-stream"},
206 {".jpe", "image/jpeg"},
207 {".jpeg", "image/jpeg"},
208 {".jpg", "image/jpeg"},
209 {".js", "application/x-javascript"},
210 {".json", "application/json"},
211 {".jsx", "text/jscript"},
212 {".jsxbin", "text/plain"},
213 {".latex", "application/x-latex"},
214 {".library-ms", "application/windows-library+xml"},
215 {".lit", "application/x-ms-reader"},
216 {".loadtest", "application/xml"},
217 {".lpk", "application/octet-stream"},
218 {".lsf", "video/x-la-asf"},
219 {".lst", "text/plain"},
220 {".lsx", "video/x-la-asf"},
221 {".lzh", "application/octet-stream"},
222 {".m13", "application/x-msmediaview"},
223 {".m14", "application/x-msmediaview"},
224 {".m1v", "video/mpeg"},
225 {".m2t", "video/vnd.dlna.mpeg-tts"},
226 {".m2ts", "video/vnd.dlna.mpeg-tts"},
227 {".m2v", "video/mpeg"},
228 {".m3u", "audio/x-mpegurl"},
229 {".m3u8", "audio/x-mpegurl"},
230 {".m4a", "audio/m4a"},
231 {".m4b", "audio/m4b"},
232 {".m4p", "audio/m4p"},
233 {".m4r", "audio/x-m4r"},
234 {".m4v", "video/x-m4v"},
235 {".mac", "image/x-macpaint"},
236 {".mak", "text/plain"},
237 {".man", "application/x-troff-man"},
238 {".manifest", "application/x-ms-manifest"},
239 {".map", "text/plain"},
240 {".master", "application/xml"},
241 {".mda", "application/msaccess"},
242 {".mdb", "application/x-msaccess"},
243 {".mde", "application/msaccess"},
244 {".mdp", "application/octet-stream"},
245 {".me", "application/x-troff-me"},
246 {".mfp", "application/x-shockwave-flash"},
247 {".mht", "message/rfc822"},
248 {".mhtml", "message/rfc822"},
249 {".mid", "audio/mid"},
250 {".midi", "audio/mid"},
251 {".mix", "application/octet-stream"},
252 {".mk", "text/plain"},
253 {".mmf", "application/x-smaf"},
254 {".mno", "text/xml"},
255 {".mny", "application/x-msmoney"},
256 {".mod", "video/mpeg"},
257 {".mov", "video/quicktime"},
258 {".movie", "video/x-sgi-movie"},
259 {".mp2", "video/mpeg"},
260 {".mp2v", "video/mpeg"},
261 {".mp3", "audio/mpeg"},
262 {".mp4", "video/mp4"},
263 {".mp4v", "video/mp4"},
264 {".mpa", "video/mpeg"},
265 {".mpe", "video/mpeg"},
266 {".mpeg", "video/mpeg"},
267 {".mpf", "application/vnd.ms-mediapackage"},
268 {".mpg", "video/mpeg"},
269 {".mpp", "application/vnd.ms-project"},
270 {".mpv2", "video/mpeg"},
271 {".mqv", "video/quicktime"},
272 {".ms", "application/x-troff-ms"},
273 {".msi", "application/octet-stream"},
274 {".mso", "application/octet-stream"},
275 {".mts", "video/vnd.dlna.mpeg-tts"},
276 {".mtx", "application/xml"},
277 {".mvb", "application/x-msmediaview"},
278 {".mvc", "application/x-miva-compiled"},
279 {".mxp", "application/x-mmxp"},
280 {".nc", "application/x-netcdf"},
281 {".nsc", "video/x-ms-asf"},
282 {".nws", "message/rfc822"},
283 {".ocx", "application/octet-stream"},
284 {".oda", "application/oda"},
285 {".odc", "text/x-ms-odc"},
286 {".odh", "text/plain"},
287 {".odl", "text/plain"},
288 {".odp", "application/vnd.oasis.opendocument.presentation"},
289 {".ods", "application/oleobject"},
290 {".odt", "application/vnd.oasis.opendocument.text"},
291 {".one", "application/onenote"},
292 {".onea", "application/onenote"},
293 {".onepkg", "application/onenote"},
294 {".onetmp", "application/onenote"},
295 {".onetoc", "application/onenote"},
296 {".onetoc2", "application/onenote"},
297 {".orderedtest", "application/xml"},
298 {".osdx", "application/opensearchdescription+xml"},
299 {".p10", "application/pkcs10"},
300 {".p12", "application/x-pkcs12"},
301 {".p7b", "application/x-pkcs7-certificates"},
302 {".p7c", "application/pkcs7-mime"},
303 {".p7m", "application/pkcs7-mime"},
304 {".p7r", "application/x-pkcs7-certreqresp"},
305 {".p7s", "application/pkcs7-signature"},
306 {".pbm", "image/x-portable-bitmap"},
307 {".pcast", "application/x-podcast"},
308 {".pct", "image/pict"},
309 {".pcx", "application/octet-stream"},
310 {".pcz", "application/octet-stream"},
311 {".pdf", "application/pdf"},
312 {".pfb", "application/octet-stream"},
313 {".pfm", "application/octet-stream"},
314 {".pfx", "application/x-pkcs12"},
315 {".pgm", "image/x-portable-graymap"},
316 {".pic", "image/pict"},
317 {".pict", "image/pict"},
318 {".pkgdef", "text/plain"},
319 {".pkgundef", "text/plain"},
320 {".pko", "application/vnd.ms-pki.pko"},
321 {".pls", "audio/scpls"},
322 {".pma", "application/x-perfmon"},
323 {".pmc", "application/x-perfmon"},
324 {".pml", "application/x-perfmon"},
325 {".pmr", "application/x-perfmon"},
326 {".pmw", "application/x-perfmon"},
327 {".png", "image/png"},
328 {".pnm", "image/x-portable-anymap"},
329 {".pnt", "image/x-macpaint"},
330 {".pntg", "image/x-macpaint"},
331 {".pnz", "image/png"},
332 {".pot", "application/vnd.ms-powerpoint"},
333 {".potm", "application/vnd.ms-powerpoint.template.macroEnabled.12"},
334 {".potx", "application/vnd.openxmlformats-officedocument.presentationml.template"},
335 {".ppa", "application/vnd.ms-powerpoint"},
336 {".ppam", "application/vnd.ms-powerpoint.addin.macroEnabled.12"},
337 {".ppm", "image/x-portable-pixmap"},
338 {".pps", "application/vnd.ms-powerpoint"},
339 {".ppsm", "application/vnd.ms-powerpoint.slideshow.macroEnabled.12"},
340 {".ppsx", "application/vnd.openxmlformats-officedocument.presentationml.slideshow"},
341 {".ppt", "application/vnd.ms-powerpoint"},
342 {".pptm", "application/vnd.ms-powerpoint.presentation.macroEnabled.12"},
343 {".pptx", "application/vnd.openxmlformats-officedocument.presentationml.presentation"},
344 {".prf", "application/pics-rules"},
345 {".prm", "application/octet-stream"},
346 {".prx", "application/octet-stream"},
347 {".ps", "application/postscript"},
348 {".psc1", "application/PowerShell"},
349 {".psd", "application/octet-stream"},
350 {".psess", "application/xml"},
351 {".psm", "application/octet-stream"},
352 {".psp", "application/octet-stream"},
353 {".pub", "application/x-mspublisher"},
354 {".pwz", "application/vnd.ms-powerpoint"},
355 {".qht", "text/x-html-insertion"},
356 {".qhtm", "text/x-html-insertion"},
357 {".qt", "video/quicktime"},
358 {".qti", "image/x-quicktime"},
359 {".qtif", "image/x-quicktime"},
360 {".qtl", "application/x-quicktimeplayer"},
361 {".qxd", "application/octet-stream"},
362 {".ra", "audio/x-pn-realaudio"},
363 {".ram", "audio/x-pn-realaudio"},
364 {".rar", "application/octet-stream"},
365 {".ras", "image/x-cmu-raster"},
366 {".rat", "application/rat-file"},
367 {".rc", "text/plain"},
368 {".rc2", "text/plain"},
369 {".rct", "text/plain"},
370 {".rdlc", "application/xml"},
371 {".resx", "application/xml"},
372 {".rf", "image/vnd.rn-realflash"},
373 {".rgb", "image/x-rgb"},
374 {".rgs", "text/plain"},
375 {".rm", "application/vnd.rn-realmedia"},
376 {".rmi", "audio/mid"},
377 {".rmp", "application/vnd.rn-rn_music_package"},
378 {".roff", "application/x-troff"},
379 {".rpm", "audio/x-pn-realaudio-plugin"},
380 {".rqy", "text/x-ms-rqy"},
381 {".rtf", "application/rtf"},
382 {".rtx", "text/richtext"},
383 {".ruleset", "application/xml"},
384 {".s", "text/plain"},
385 {".safariextz", "application/x-safari-safariextz"},
386 {".scd", "application/x-msschedule"},
387 {".sct", "text/scriptlet"},
388 {".sd2", "audio/x-sd2"},
389 {".sdp", "application/sdp"},
390 {".sea", "application/octet-stream"},
391 {".searchConnector-ms", "application/windows-search-connector+xml"},
392 {".setpay", "application/set-payment-initiation"},
393 {".setreg", "application/set-registration-initiation"},
394 {".settings", "application/xml"},
395 {".sgimb", "application/x-sgimb"},
396 {".sgml", "text/sgml"},
397 {".sh", "application/x-sh"},
398 {".shar", "application/x-shar"},
399 {".shtml", "text/html"},
400 {".sit", "application/x-stuffit"},
401 {".sitemap", "application/xml"},
402 {".skin", "application/xml"},
403 {".sldm", "application/vnd.ms-powerpoint.slide.macroEnabled.12"},
404 {".sldx", "application/vnd.openxmlformats-officedocument.presentationml.slide"},
405 {".slk", "application/vnd.ms-excel"},
406 {".sln", "text/plain"},
407 {".slupkg-ms", "application/x-ms-license"},
408 {".smd", "audio/x-smd"},
409 {".smi", "application/octet-stream"},
410 {".smx", "audio/x-smd"},
411 {".smz", "audio/x-smd"},
412 {".snd", "audio/basic"},
413 {".snippet", "application/xml"},
414 {".snp", "application/octet-stream"},
415 {".sol", "text/plain"},
416 {".sor", "text/plain"},
417 {".spc", "application/x-pkcs7-certificates"},
418 {".spl", "application/futuresplash"},
419 {".src", "application/x-wais-source"},
420 {".srf", "text/plain"},
421 {".SSISDeploymentManifest", "text/xml"},
422 {".ssm", "application/streamingmedia"},
423 {".sst", "application/vnd.ms-pki.certstore"},
424 {".stl", "application/vnd.ms-pki.stl"},
425 {".sv4cpio", "application/x-sv4cpio"},
426 {".sv4crc", "application/x-sv4crc"},
427 {".svc", "application/xml"},
428 {".swf", "application/x-shockwave-flash"},
429 {".t", "application/x-troff"},
430 {".tar", "application/x-tar"},
431 {".tcl", "application/x-tcl"},
432 {".testrunconfig", "application/xml"},
433 {".testsettings", "application/xml"},
434 {".tex", "application/x-tex"},
435 {".texi", "application/x-texinfo"},
436 {".texinfo", "application/x-texinfo"},
437 {".tgz", "application/x-compressed"},
438 {".thmx", "application/vnd.ms-officetheme"},
439 {".thn", "application/octet-stream"},
440 {".tif", "image/tiff"},
441 {".tiff", "image/tiff"},
442 {".tlh", "text/plain"},
443 {".tli", "text/plain"},
444 {".toc", "application/octet-stream"},
445 {".tr", "application/x-troff"},
446 {".trm", "application/x-msterminal"},
447 {".trx", "application/xml"},
448 {".ts", "video/vnd.dlna.mpeg-tts"},
449 {".tsv", "text/tab-separated-values"},
450 {".ttf", "application/octet-stream"},
451 {".tts", "video/vnd.dlna.mpeg-tts"},
452 {".txt", "text/plain"},
453 {".u32", "application/octet-stream"},
454 {".uls", "text/iuls"},
455 {".user", "text/plain"},
456 {".ustar", "application/x-ustar"},
457 {".vb", "text/plain"},
458 {".vbdproj", "text/plain"},
459 {".vbk", "video/mpeg"},
460 {".vbproj", "text/plain"},
461 {".vbs", "text/vbscript"},
462 {".vcf", "text/x-vcard"},
463 {".vcproj", "Application/xml"},
464 {".vcs", "text/plain"},
465 {".vcxproj", "Application/xml"},
466 {".vddproj", "text/plain"},
467 {".vdp", "text/plain"},
468 {".vdproj", "text/plain"},
469 {".vdx", "application/vnd.ms-visio.viewer"},
470 {".vml", "text/xml"},
471 {".vscontent", "application/xml"},
472 {".vsct", "text/xml"},
473 {".vsd", "application/vnd.visio"},
474 {".vsi", "application/ms-vsi"},
475 {".vsix", "application/vsix"},
476 {".vsixlangpack", "text/xml"},
477 {".vsixmanifest", "text/xml"},
478 {".vsmdi", "application/xml"},
479 {".vspscc", "text/plain"},
480 {".vss", "application/vnd.visio"},
481 {".vsscc", "text/plain"},
482 {".vssettings", "text/xml"},
483 {".vssscc", "text/plain"},
484 {".vst", "application/vnd.visio"},
485 {".vstemplate", "text/xml"},
486 {".vsto", "application/x-ms-vsto"},
487 {".vsw", "application/vnd.visio"},
488 {".vsx", "application/vnd.visio"},
489 {".vtx", "application/vnd.visio"},
490 {".wav", "audio/wav"},
491 {".wave", "audio/wav"},
492 {".wax", "audio/x-ms-wax"},
493 {".wbk", "application/msword"},
494 {".wbmp", "image/vnd.wap.wbmp"},
495 {".wcm", "application/vnd.ms-works"},
496 {".wdb", "application/vnd.ms-works"},
497 {".wdp", "image/vnd.ms-photo"},
498 {".webarchive", "application/x-safari-webarchive"},
499 {".webtest", "application/xml"},
500 {".wiq", "application/xml"},
501 {".wiz", "application/msword"},
502 {".wks", "application/vnd.ms-works"},
503 {".WLMP", "application/wlmoviemaker"},
504 {".wlpginstall", "application/x-wlpg-detect"},
505 {".wlpginstall3", "application/x-wlpg3-detect"},
506 {".wm", "video/x-ms-wm"},
507 {".wma", "audio/x-ms-wma"},
508 {".wmd", "application/x-ms-wmd"},
509 {".wmf", "application/x-msmetafile"},
510 {".wml", "text/vnd.wap.wml"},
511 {".wmlc", "application/vnd.wap.wmlc"},
512 {".wmls", "text/vnd.wap.wmlscript"},
513 {".wmlsc", "application/vnd.wap.wmlscriptc"},
514 {".wmp", "video/x-ms-wmp"},
515 {".wmv", "video/x-ms-wmv"},
516 {".wmx", "video/x-ms-wmx"},
517 {".wmz", "application/x-ms-wmz"},
518 {".wpl", "application/vnd.ms-wpl"},
519 {".wps", "application/vnd.ms-works"},
520 {".wri", "application/x-mswrite"},
521 {".wrl", "x-world/x-vrml"},
522 {".wrz", "x-world/x-vrml"},
523 {".wsc", "text/scriptlet"},
524 {".wsdl", "text/xml"},
525 {".wvx", "video/x-ms-wvx"},
526 {".x", "application/directx"},
527 {".xaf", "x-world/x-vrml"},
528 {".xaml", "application/xaml+xml"},
529 {".xap", "application/x-silverlight-app"},
530 {".xbap", "application/x-ms-xbap"},
531 {".xbm", "image/x-xbitmap"},
532 {".xdr", "text/plain"},
533 {".xht", "application/xhtml+xml"},
534 {".xhtml", "application/xhtml+xml"},
535 {".xla", "application/vnd.ms-excel"},
536 {".xlam", "application/vnd.ms-excel.addin.macroEnabled.12"},
537 {".xlc", "application/vnd.ms-excel"},
538 {".xld", "application/vnd.ms-excel"},
539 {".xlk", "application/vnd.ms-excel"},
540 {".xll", "application/vnd.ms-excel"},
541 {".xlm", "application/vnd.ms-excel"},
542 {".xls", "application/vnd.ms-excel"},
543 {".xlsb", "application/vnd.ms-excel.sheet.binary.macroEnabled.12"},
544 {".xlsm", "application/vnd.ms-excel.sheet.macroEnabled.12"},
545 {".xlsx", "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"},
546 {".xlt", "application/vnd.ms-excel"},
547 {".xltm", "application/vnd.ms-excel.template.macroEnabled.12"},
548 {".xltx", "application/vnd.openxmlformats-officedocument.spreadsheetml.template"},
549 {".xlw", "application/vnd.ms-excel"},
550 {".xml", "text/xml"},
551 {".xmta", "application/xml"},
552 {".xof", "x-world/x-vrml"},
553 {".XOML", "text/plain"},
554 {".xpm", "image/x-xpixmap"},
555 {".xps", "application/vnd.ms-xpsdocument"},
556 {".xrm-ms", "text/xml"},
557 {".xsc", "application/xml"},
558 {".xsd", "text/xml"},
559 {".xsf", "text/xml"},
560 {".xsl", "text/xml"},
561 {".xslt", "text/xml"},
562 {".xsn", "application/octet-stream"},
563 {".xss", "application/xml"},
564 {".xtp", "application/octet-stream"},
565 {".xwd", "image/x-xwindowdump"},
566 {".z", "application/x-compress"},
567 {".zip", "application/x-zip-compressed"}
568 };
569
570 public static string GetMimeType (string _extension) {
571 if (_extension == null) {
572 throw new ArgumentNullException (nameof (_extension));
573 }
574
575 if (!_extension.StartsWith (".")) {
576 _extension = $".{_extension}";
577 }
578
579 return mappings.TryGetValue (_extension, out string mime) ? mime : "application/octet-stream";
580 }
581 }
582}
Note: See TracBrowser for help on using the repository browser.