Libs/MojoCube.Api/File/Function.cs

(开头部分) 2KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

using System;
using System.Collections.Generic;
using System.Text;
using System.Web;

namespace MojoCube.Api.File
{
    public class Function
    {
        //判断文件格式,返回页面头类型ContentType
        public static string GetContentType(string Path)
        {
            string ImgType = string.Empty;
            if (Path.LastIndexOf('.') > 0)
            {
                ImgType = Path.Substring(Path.LastIndexOf('.'));
            }
            string ContentType = string.Empty;

            switch (ImgType.ToLower())
            {
                case ".jpg":
                    {
                        ContentType = "image/jpeg";
                    } break;
                case ".gif":
                    {
                        ContentType = "image/gif";
                    } break;
                case ".png":
                    {
                        ContentType = "image/png";
                    } break;
                case ".bmp":
                    {
                        ContentType = "image/bmp";
                    } break;
                case ".wmv":
                    {
                        ContentType = "application/octet-stream";
                    } break;
                case ".asf":
                    {
                        ContentType = "application/octet-stream";
                    } break;
                case ".3gp":
                    {
                        ContentType = "application/octet-stream";
                    } break;
                case ".mpg":
                    {
                        ContentType = "application/octet-stream";
                    } break;
                case ".rar":
                    {
                        ContentType = "application/x-msdownload";
                    } break;
                case ".pdf":
                    {
                        ContentType = "application/pdf";
后面还有 34 行代码,购买后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。