Manage/ModelImport.aspx.cs

(开头部分) 6KB

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

using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.IO;
using System.Data;
using EKETEAM.Data;
using EKETEAM.FrameWork;
using System.Xml;
using System.Xml.Serialization;

namespace eFrameWork.Manage
{
    public partial class ModelImport : System.Web.UI.Page
    {
        public eUser user;
        public eExtensionsList allowExts = new eExtensionsList(".efw");
        protected void Page_Load(object sender, EventArgs e)
        {
            user = new eUser("Manage");
            user.Check();
            #region 安全性检查
            if (Request.UrlReferrer == null) Response.End();
            if (Request.Url.Host.ToLower() != Request.UrlReferrer.Host.ToLower()) Response.End();// || Request.Url.Port != Request.UrlReferrer.Port
            //if (!eConfig.portMapping && Request.Url.Port != Request.UrlReferrer.Port) Response.End();
            //如果判断端口,则端口映射/转发无法保存
            #endregion

            #region 保存文件
            if (Request.Files.Count == 1)
            {
                HttpPostedFile file = Request.Files[0];
                if (file.ContentLength > 0)
                {
                    string tempPath = eRunTime.tempPath;
                    string ext = file.FileName.fileExtension();
                    if(!allowExts.Contains(ext))
                    {
                        //Response.Write("<script>alert('文件格式不正确!');document.location='Models.aspx';</script>");
                        Response.Write("<script>parent.layer.msg('文件格式不正确!');document.location='ModelImport.aspx';</script>");
                        Response.End();
                    }

                    string filename = eBase.GetFileName() + ext;
                    string pathname = tempPath + filename;
                    if (!Directory.Exists(tempPath)) Directory.CreateDirectory(tempPath);
                    file.safeSaveAs(pathname, allowExts);


                    System.IO.StreamReader sr = new System.IO.StreamReader(pathname, System.Text.Encoding.UTF8);
                    string line = sr.ReadLine();
                    sr.Close();

                    if (line.StartsWith("{"))
                    {
                        //import_json(pathname);
                    }
                    else
                    {
后面还有 123 行代码,解锁后查看完整代码

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

AI 解读

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

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