source/Repid.MvcExtension/Controls/Manage/IncludeFile.cs

(开头部分) 1KB

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

using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Web;
using System.Web.Mvc;

namespace Repid.MvcExtension.Controls.Manage
{
    public static class IncludeFile
    {
        /// <summary>
        /// 样式
        /// </summary>
        /// <param name="src"></param>
        /// <returns></returns>
        public static MvcHtmlString Style(string path, string src)
        {
            path = path.Substring(0, path.LastIndexOf("/") + 1) + src;

            string filepath = HttpContext.Current.Server.MapPath(path);

            string styles = string.Empty;

            if (File.Exists(filepath))
            {
                using (StreamReader sr = new StreamReader(filepath))
                {
                    styles = sr.ReadToEnd();
                }
            }

            return new MvcHtmlString("<style type=\"text/css\">" + styles + "</style>");
        }

        /// <summary>
        /// 脚本
        /// </summary>
        /// <param name="src"></param>
        /// <returns></returns>
        public static MvcHtmlString Script(string path, string src)
        {
            path = path.Substring(0, path.LastIndexOf("/") + 1) + src;

            string filepath = HttpContext.Current.Server.MapPath(path);

            string javascript = string.Empty;

            if (File.Exists(filepath))
            {
                using (StreamReader sr = new StreamReader(filepath))
                {
                    javascript = sr.ReadToEnd();
                }
            }

            return new MvcHtmlString("<script type=\"text/javascript\">" + javascript + "</script>");
        }
    }
后面还有 1 行代码,解锁后查看完整代码

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

AI 解读 AI

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

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