|
1 |
| -using System.Linq; |
| 1 | +using System; |
2 | 2 | using System.Collections.Generic;
|
3 |
| -using System; |
| 3 | +using System.Linq; |
4 | 4 |
|
5 | 5 | namespace GenHTTP.Api.Protocol
|
6 | 6 | {
|
@@ -108,26 +108,6 @@ public enum ContentType
|
108 | 108 | /// </summary>
|
109 | 109 | TextJavaScript,
|
110 | 110 |
|
111 |
| - /// <summary> |
112 |
| - /// A H.264 encoded video file. |
113 |
| - /// </summary> |
114 |
| - VideoH264, |
115 |
| - |
116 |
| - /// <summary> |
117 |
| - /// A MP4 video file. |
118 |
| - /// </summary> |
119 |
| - VideoMp4, |
120 |
| - |
121 |
| - /// <summary> |
122 |
| - /// A MPEG video file. |
123 |
| - /// </summary> |
124 |
| - VideoMpeg, |
125 |
| - |
126 |
| - /// <summary> |
127 |
| - /// A MPEG-4 video file. |
128 |
| - /// </summary> |
129 |
| - VideoMpeg4Generic, |
130 |
| - |
131 | 111 | /// <summary>
|
132 | 112 | /// A uncompressed audio file.
|
133 | 113 | /// </summary>
|
@@ -206,7 +186,128 @@ public enum ContentType
|
206 | 186 | /// <summary>
|
207 | 187 | /// A Protobuf message.
|
208 | 188 | /// </summary>
|
209 |
| - ApplicationProtobuf |
| 189 | + ApplicationProtobuf, |
| 190 | + |
| 191 | + /// <summary> |
| 192 | + /// 3GPP video file container (.3gp). |
| 193 | + /// </summary> |
| 194 | + Video3Gpp, |
| 195 | + |
| 196 | + /// <summary> |
| 197 | + /// 3GPP2 video files (.3g2). |
| 198 | + /// </summary> |
| 199 | + Video3Gpp2, |
| 200 | + |
| 201 | + /// <summary> |
| 202 | + /// AV1 video file (.av1). |
| 203 | + /// </summary> |
| 204 | + VideoAV1, |
| 205 | + |
| 206 | + /// <summary> |
| 207 | + /// A MPEG4 Part 10 (H.264) video file (.avc). |
| 208 | + /// </summary> |
| 209 | + VideoAvc, |
| 210 | + |
| 211 | + /// <summary> |
| 212 | + /// Digital video file (.dv). |
| 213 | + /// </summary> |
| 214 | + VideoDV, |
| 215 | + |
| 216 | + /// <summary> |
| 217 | + /// A H.261 video file. |
| 218 | + /// </summary> |
| 219 | + VideoH261, |
| 220 | + |
| 221 | + /// <summary> |
| 222 | + /// A H.263 video file. |
| 223 | + /// </summary> |
| 224 | + VideoH263, |
| 225 | + |
| 226 | + /// <summary> |
| 227 | + /// A H.264 encoded video file. |
| 228 | + /// </summary> |
| 229 | + VideoH264, |
| 230 | + |
| 231 | + /// <summary> |
| 232 | + /// A H.265 video file. |
| 233 | + /// </summary> |
| 234 | + VideoH265, |
| 235 | + |
| 236 | + /// <summary> |
| 237 | + /// A H.266 video file. |
| 238 | + /// </summary> |
| 239 | + VideoH266, |
| 240 | + |
| 241 | + /// <summary> |
| 242 | + /// A Matroska video file (.mkv). |
| 243 | + /// </summary> |
| 244 | + VideoMatroska, |
| 245 | + |
| 246 | + /// <summary> |
| 247 | + /// A 3D Matroska video file (.mk3d). |
| 248 | + /// </summary> |
| 249 | + VideoMatroska3D, |
| 250 | + |
| 251 | + /// <summary> |
| 252 | + /// A Motion JPEG 2000 video file (.mj2). |
| 253 | + /// </summary> |
| 254 | + VideoMJ2, |
| 255 | + |
| 256 | + /// <summary> |
| 257 | + /// A MP4 video file (.mp4). |
| 258 | + /// </summary> |
| 259 | + VideoMP4, |
| 260 | + |
| 261 | + /// <summary> |
| 262 | + /// A MPEG video file. |
| 263 | + /// </summary> |
| 264 | + VideoMpeg, |
| 265 | + |
| 266 | + /// <summary> |
| 267 | + /// A MPEG-4 video file. |
| 268 | + /// </summary> |
| 269 | + VideoMpeg4Generic, |
| 270 | + |
| 271 | + /// <summary> |
| 272 | + /// A MPEG-2 elementary stream video (.mpv). |
| 273 | + /// </summary> |
| 274 | + VideoMpv, |
| 275 | + |
| 276 | + /// <summary> |
| 277 | + /// An Apple quick time video file (.mov or .hdmov). |
| 278 | + /// </summary> |
| 279 | + VideoQuicktime, |
| 280 | + |
| 281 | + /// <summary> |
| 282 | + /// A raw video file. |
| 283 | + /// </summary> |
| 284 | + VideoRaw, |
| 285 | + |
| 286 | + /// <summary> |
| 287 | + /// A SMPTE 421M video file (.vc1). |
| 288 | + /// </summary> |
| 289 | + VideoVC1, |
| 290 | + |
| 291 | + /// <summary> |
| 292 | + /// A SMPTE VC-2 video file. |
| 293 | + /// </summary> |
| 294 | + VideoVC2, |
| 295 | + |
| 296 | + /// <summary> |
| 297 | + /// A VP8 encoded video file (.webm). |
| 298 | + /// </summary> |
| 299 | + VideoVP8, |
| 300 | + |
| 301 | + /// <summary> |
| 302 | + /// A VP9 encoded video file (.webm). |
| 303 | + /// </summary> |
| 304 | + VideoVP9, |
| 305 | + |
| 306 | + /// <summary> |
| 307 | + /// A WebM video file (.webm). |
| 308 | + /// </summary> |
| 309 | + VideoWebM |
| 310 | + |
210 | 311 | }
|
211 | 312 |
|
212 | 313 | #endregion
|
@@ -241,47 +342,67 @@ public class FlexibleContentType
|
241 | 342 |
|
242 | 343 | #region Mapping
|
243 | 344 |
|
244 |
| - private static readonly Dictionary<ContentType, string> MAPPING = new() |
| 345 | + private static readonly Dictionary<ContentType, string> MAPPING = new() |
245 | 346 | {
|
246 |
| - { ContentType.TextHtml, "text/html" }, |
247 |
| - { ContentType.TextCss, "text/css" }, |
248 |
| - { ContentType.ApplicationJavaScript, "application/javascript" }, |
249 |
| - { ContentType.ImageIcon, "image/x-icon" }, |
250 |
| - { ContentType.ImageGif, "image/gif" }, |
251 |
| - { ContentType.ImageJpg, "image/jpg" }, |
252 |
| - { ContentType.ImagePng, "image/png" }, |
253 |
| - { ContentType.ImageBmp, "image/bmp" }, |
254 | 347 | { ContentType.AudioMp4, "audio/mp4" },
|
255 | 348 | { ContentType.AudioOgg, "audio/ogg" },
|
256 | 349 | { ContentType.AudioMpeg, "audio/mpeg" },
|
257 |
| - { ContentType.ImageTiff, "image/tiff" }, |
258 |
| - { ContentType.TextCsv, "text/csv" }, |
259 |
| - { ContentType.TextRichText, "text/richtext" }, |
260 |
| - { ContentType.TextPlain, "text/plain" }, |
261 |
| - { ContentType.TextJavaScript, "text/javascript" }, |
262 |
| - { ContentType.TextXml, "text/xml" }, |
263 |
| - { ContentType.VideoH264, "video/H264" }, |
264 |
| - { ContentType.VideoMp4, "video/mp4" }, |
265 |
| - { ContentType.VideoMpeg, "video/mpeg" }, |
266 |
| - { ContentType.VideoMpeg4Generic, "video/mpeg4-generic" }, |
267 | 350 | { ContentType.AudioWav, "audio/wav" },
|
| 351 | + { ContentType.ApplicationJavaScript, "application/javascript" }, |
268 | 352 | { ContentType.ApplicationOfficeDocumentWordProcessing, "application/vnd.openxmlformats-officedocument.wordprocessingml.document" },
|
269 | 353 | { ContentType.ApplicationOfficeDocumentPresentation, "application/vnd.openxmlformats-officedocument.presentationml.presentation" },
|
270 | 354 | { ContentType.ApplicationOfficeDocumentSlideshow, "application/vnd.openxmlformats-officedocument.presentationml.slideshow" },
|
271 | 355 | { ContentType.ApplicationOfficeDocumentSheet, "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" },
|
272 | 356 | { ContentType.ApplicationForceDownload, "application/force-download" },
|
273 | 357 | { ContentType.ApplicationOctetStream, "application/octet-stream" },
|
| 358 | + { ContentType.ApplicationJson, "application/json" }, |
| 359 | + { ContentType.ApplicationWwwFormUrlEncoded, "application/x-www-form-urlencoded" }, |
| 360 | + { ContentType.ApplicationProtobuf, "application/protobuf" }, |
274 | 361 | { ContentType.FontEmbeddedOpenTypeFont, "font/eot" },
|
275 | 362 | { ContentType.FontOpenTypeFont, "font/otf" },
|
276 | 363 | { ContentType.FontTrueTypeFont, "font/ttf" },
|
277 | 364 | { ContentType.FontWoff, "font/woff" },
|
278 | 365 | { ContentType.FontWoff2, "font/woff2" },
|
| 366 | + { ContentType.ImageIcon, "image/x-icon" }, |
| 367 | + { ContentType.ImageGif, "image/gif" }, |
| 368 | + { ContentType.ImageJpg, "image/jpg" }, |
| 369 | + { ContentType.ImagePng, "image/png" }, |
| 370 | + { ContentType.ImageTiff, "image/tiff" }, |
| 371 | + { ContentType.ImageBmp, "image/bmp" }, |
279 | 372 | { ContentType.ImageScalableVectorGraphics, "image/svg" },
|
280 | 373 | { ContentType.ImageScalableVectorGraphicsXml, "image/svg+xml" },
|
281 | 374 | { ContentType.ImageScalableVectorGraphicsCompressed, "image/svgz" },
|
282 |
| - { ContentType.ApplicationJson, "application/json" }, |
283 |
| - { ContentType.ApplicationWwwFormUrlEncoded, "application/x-www-form-urlencoded" }, |
284 |
| - { ContentType.ApplicationProtobuf, "application/protobuf" } |
| 375 | + { ContentType.TextHtml, "text/html" }, |
| 376 | + { ContentType.TextCss, "text/css" }, |
| 377 | + { ContentType.TextCsv, "text/csv" }, |
| 378 | + { ContentType.TextRichText, "text/richtext" }, |
| 379 | + { ContentType.TextPlain, "text/plain" }, |
| 380 | + { ContentType.TextJavaScript, "text/javascript" }, |
| 381 | + { ContentType.TextXml, "text/xml" }, |
| 382 | + { ContentType.Video3Gpp, "video/3gpp" }, |
| 383 | + { ContentType.Video3Gpp2, "video/3gpp2" }, |
| 384 | + { ContentType.VideoAV1, "video/av1" }, |
| 385 | + { ContentType.VideoAvc, "video/av" }, |
| 386 | + { ContentType.VideoDV, "video/dv" }, |
| 387 | + { ContentType.VideoH261, "video/H261" }, |
| 388 | + { ContentType.VideoH263, "video/H263" }, |
| 389 | + { ContentType.VideoH264, "video/H264" }, |
| 390 | + { ContentType.VideoH265, "video/H265" }, |
| 391 | + { ContentType.VideoH266, "video/H266" }, |
| 392 | + { ContentType.VideoMatroska, "video/matroska" }, |
| 393 | + { ContentType.VideoMatroska3D, "video/matroska-3d" }, |
| 394 | + { ContentType.VideoMJ2, "video/mj2" }, |
| 395 | + { ContentType.VideoMP4, "video/mp4" }, |
| 396 | + { ContentType.VideoMpeg, "video/mpeg" }, |
| 397 | + { ContentType.VideoMpeg4Generic, "video/mpeg4-generic" }, |
| 398 | + { ContentType.VideoMpv, "video/MPV" }, |
| 399 | + { ContentType.VideoQuicktime, "video/quicktime" }, |
| 400 | + { ContentType.VideoRaw, "video/raw" }, |
| 401 | + { ContentType.VideoVC1, "video/vc1" }, |
| 402 | + { ContentType.VideoVC2, "video/vc2" }, |
| 403 | + { ContentType.VideoVP8, "video/VP8" }, |
| 404 | + { ContentType.VideoVP9, "video/VP9" }, |
| 405 | + { ContentType.VideoWebM, "video/webm" } |
285 | 406 | };
|
286 | 407 |
|
287 | 408 | private static readonly Dictionary<string, ContentType> MAPPING_REVERSE = MAPPING.ToDictionary(x => x.Value, x => x.Key);
|
|
0 commit comments