Get Type Description From Mime Type : Mime Type « Network « C# / C Sharp






Get Type Description From Mime Type

 

using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;

using System.Text;

namespace OperatorModule
{
    public static class Utilities
    {
    public static string GetTypeDescriptionFromMimeType(string mimeType)
        {
            string desc = "";
            switch (mimeType)
            {
                case "text/plain":
                    desc = "Text";
                    break;
                case "image/png":
                    desc = "PNG Image";
                    break;
                case "image/jpg":
                    desc = "JPG Image";
                    break;
                case "image/bmp":
                    desc = "Bitmap Image";
                    break;
                case "image/gif":
                    desc = "GIF Image";
                    break;
                case "document/doc":
                    desc = "Word Document";
                    break;
                case "document/docx":
                    desc = "Word 2007 Document";
                    break;
                case "document/xls":
                    desc = "Excel Book";
                    break;
                case "document/xlsx":
                    desc = "Excel 2007 Book";
                    break;
                case "document/pdf":
                    desc = "PDF Document";
                    break;
                case "docuemnt/rtf":
                    desc = "Rich Text Document";
                    break;
                case "archive/zip":
                    desc = "ZIP Archive";
                    break;
                case "archive/rar":
                    desc = "RAR Archive";
                    break;
                case "binary/other":
                    desc = "Binary Data";
                    break;
                default:
                    desc = "Unknown Contents";
                    break;
            }
            return desc;
        }

    }
}

   
  








Related examples in the same category

1.Get Image Mime Type
2.Get Mime Type From File Extension