Esempio n. 1
0
 /// <summary>
 /// 验证目录是否存在
 /// </summary>
 private void ExistLabelDir(M_Label label)
 {
     if (!FileSystemObject.IsExist(dir + label.LabelCate, FsoMethod.Folder))
     {
         FileSystemObject.CreateFileFolder(dir + label.LabelCate);
     }
 }
Esempio n. 2
0
        /// <summary>
        /// 添加商城竞拍
        /// </summary>
        /// <param name="str"></param>
        public void AddCome(string strxml, int pid)
        {
            XmlDocument xml = new XmlDocument();

            if (!FileSystemObject.IsExist(ComePaht, FsoMethod.File))
            {
                XmlElement xmlelem = xml.CreateElement("xml");
                XmlElement str     = GetCome(xml, strxml, pid);
                xmlelem.AppendChild(str);
                xml.AppendChild(xmlelem);
                xml.Save(ComePaht);
            }
            else
            {
                XmlNode xn = null;
                if (FileSystemObject.ReadFile(ComePaht).Length > 0)
                {
                    xml.Load(ComePaht);
                    xn = xml.SelectSingleNode("xml");
                }
                XmlElement str = GetCome(xml, strxml, pid);
                if (xn != null)
                {
                    xn.AppendChild(str);
                }
                else
                {
                    XmlElement xmlelem = xml.CreateElement("xml");
                    xmlelem.AppendChild(str);
                    xml.AppendChild(xmlelem);
                }
                xml.Save(ComePaht);
            }
        }
Esempio n. 3
0
        /// <summary>
        /// 生成文件所在目录
        /// </summary>
        /// <param name="nodeid"></param>
        /// <param name="Nodeinfo"></param>
        /// <param name="HtmlPosition"></param>
        private string MakeHtmlFile(M_Node Nodeinfo)
        {
            string allFolder = "";

            //获得节点目录路径
            switch (Nodeinfo.HtmlPosition)
            {
            case 0:
                allFolder = "/site";    //0-根目录下
                break;

            case 1:
                Pardir    = "/site" + nll.GetDir(Nodeinfo.ParentID, ""); //继承父节点目录
                allFolder = Pardir;
                break;
            }
            //end
            allFolder = this.SiteMapath + "/" + allFolder + "/" + Nodeinfo.NodeDir;

            if (!FileSystemObject.IsExist(allFolder, FsoMethod.Folder))
            {
                FileSystemObject.CreateFileFolder(allFolder);
            }
            return(allFolder);//返回路径
        }
 protected void BtnSaveAccess_Click(object sender, EventArgs e)
 {
     if (base.IsValid)
     {
         string exportFileName = MailList.GetExportFileName(this.TxtExportToAccess.Text);
         if (FileSystemObject.IsExist(exportFileName, FsoMethod.File))
         {
             try
             {
                 int num = Users.ExportDataToAccess(exportFileName, Convert.ToInt32(this.DropGroup1.SelectedValue));
                 if (num > 0)
                 {
                     AdminPage.WriteSuccessMsg("操作成功:共导出 " + num.ToString() + " 个会员Email地址到" + this.TxtExportToAccess.Text + "文件。<a href=" + exportFileName + ">点击这里将文件下载回本地</a>", "MailListExport.aspx");
                 }
                 else
                 {
                     AdminPage.WriteErrMsg("该会员组没有可供导出的数据!");
                 }
             }
             catch (OleDbException exception)
             {
                 AdminPage.WriteErrMsg("<li>数据库操作失败,错误原因:" + exception.Message + "</li>");
             }
         }
         else
         {
             AdminPage.WriteErrMsg("文件不存在!");
         }
     }
 }
Esempio n. 5
0
        /// <summary>
        /// 生成文件
        /// </summary>
        /// <param name="mailinfo"></param>
        public void AddMake(string dir, string date)
        {
            XmlDocument xml = new XmlDocument();

            if (!FileSystemObject.IsExist(Makepath, FsoMethod.File))
            {
                XmlElement xmlelem = xml.CreateElement("xml");
                XmlElement str     = GetMakeXml(xml, dir, date);
                xmlelem.AppendChild(str);
                xml.AppendChild(xmlelem);
                xml.Save(Makepath);
            }
            else
            {
                XmlNode xn = null;
                if (FileSystemObject.ReadFile(Makepath).Length > 0)
                {
                    xml.Load(Makepath);
                    xn = xml.SelectSingleNode("xml");
                }
                XmlElement newChild = GetMakeXml(xml, dir, date);
                if (xn != null)
                {
                    xn.AppendChild(newChild);
                }
                else
                {
                    XmlElement xmlelem = xml.CreateElement("xml");
                    xmlelem.AppendChild(newChild);
                    xml.AppendChild(xmlelem);
                }
                xml.Save(Makepath);
            }
        }
Esempio n. 6
0
        /// <summary>
        /// Git环境检测
        /// </summary>
        /// <param name="self"></param>
        /// <returns></returns>
        public static IApplicationBuilder CheckGit(this IApplicationBuilder self)
        {
            if (SiteSetting.Current.GitConfig.GitCorePath.IsNullOrEmpty() || !FileSystemObject.IsExist(Path.Combine(SiteSetting.Current.GitConfig.GitCorePath, "git.exe"), FsoMethod.File))
            {
                var list     = new List <string>();
                var variable = Environment.GetEnvironmentVariable("path");
                if (variable != null)
                {
                    list.AddRange(variable.Split(';'));
                }

                list.Add(Environment.GetEnvironmentVariable("ProgramW6432"));
                list.Add(Environment.GetEnvironmentVariable("ProgramFiles"));

                foreach (var drive in Environment.GetLogicalDrives())
                {
                    list.Add(drive + @"Program Files\Git");
                    list.Add(drive + @"Program Files (x86)\Git");
                    list.Add(drive + @"Program Files\PortableGit");
                    list.Add(drive + @"Program Files (x86)\PortableGit");
                    list.Add(drive + @"PortableGit");
                }

                list = list.Where(x => !string.IsNullOrEmpty(x)).Distinct().ToList();
                foreach (var path in list)
                {
                    var ret = SearchPath(path);
                    if (ret != null)
                    {
                        SiteSetting.Current.GitConfig.GitCorePath = ret;
                        SiteSetting.Current.SaveAsync();
                    }
                }
            }

            if (SiteSetting.Current.GitConfig.RepositoryPath.IsNullOrEmpty())
            {
                SiteSetting.Current.GitConfig.RepositoryPath = Path.Combine(AppContext.BaseDirectory, "Repository");
                SiteSetting.Current.SaveAsync();
            }

            if (!FileSystemObject.IsExist(SiteSetting.Current.GitConfig.RepositoryPath, FsoMethod.Folder))
            {
                DirectoryUtil.CreateIfNotExists(SiteSetting.Current.GitConfig.RepositoryPath);
            }

            if (SiteSetting.Current.GitConfig.CachePath.IsNullOrEmpty())
            {
                SiteSetting.Current.GitConfig.CachePath = Path.Combine(AppContext.BaseDirectory, "Cache");
                SiteSetting.Current.SaveAsync();
            }

            if (!FileSystemObject.IsExist(SiteSetting.Current.GitConfig.CachePath, FsoMethod.Folder))
            {
                DirectoryUtil.CreateIfNotExists(SiteSetting.Current.GitConfig.CachePath);
            }

            return(self);
        }
Esempio n. 7
0
        private static void DeleteSpecialCategoryFolder(int specialCategoryId)
        {
            SpecialCategoryInfo specialCategoryInfoById = GetSpecialCategoryInfoById(specialCategoryId);
            string str  = VirtualPathUtility.AppendTrailingSlash(SiteConfig.SiteOption.CreateHtmlPath) + specialCategoryInfoById.SpecialCategoryDir;
            string file = Path.Combine(HttpContext.Current.Request.PhysicalApplicationPath, str);

            if (FileSystemObject.IsExist(file, FsoMethod.Folder))
            {
                FileSystemObject.Delete(file, FsoMethod.Folder);
            }
        }
Esempio n. 8
0
        /// <summary>
        /// 获取指定仓库的地址
        /// </summary>
        /// <param name="name"></param>
        /// <returns></returns>
        public Repository GetRepository(string name)
        {
            var path = Path.Combine(SiteSetting.Current.GitConfig.RepositoryPath, name);

            if (!FileSystemObject.IsExist(path, FsoMethod.Folder) || DirectoryUtil.IsEmpty(path))
            {
                return(new Repository(Repository.Init(path, true)));
            }

            return(new Repository(path));
        }
 protected void EBtnModifyName_Click(object sender, EventArgs e)
 {
     if (this.Page.IsValid)
     {
         string str     = this.currentDirectory + @"\";
         string oldFile = str + this.HdnName.Value;
         try
         {
             if (this.HdnType.Value == "1")
             {
                 string file = str + this.TxtDirName.Text;
                 if (oldFile == file)
                 {
                     AdminPage.WriteErrMsg("重命名目录名不能和原来目录名一样!", this.m_UrlReferrer);
                 }
                 if (!FileSystemObject.IsExist(file, FsoMethod.Folder))
                 {
                     FileSystemObject.Move(oldFile, file, FsoMethod.Folder);
                     base.Response.Write("<script type='text/javascript'>parent.frames[\"left\"].location.reload();</script>");
                     AdminPage.WriteSuccessMsg("重命名目录成功", this.m_UrlReferrer);
                 }
                 else
                 {
                     AdminPage.WriteErrMsg("<li>重命目标目录名已经存在。</li>", this.m_UrlReferrer);
                 }
             }
             else
             {
                 string str4 = str + this.TxtFileName.Text;
                 if (oldFile == str4)
                 {
                     AdminPage.WriteErrMsg("重命名文件名不能和原来文件名一样!", this.m_UrlReferrer);
                 }
                 if (!FileSystemObject.IsExist(str4, FsoMethod.File))
                 {
                     FileSystemObject.Move(oldFile, str4, FsoMethod.File);
                     AdminPage.WriteSuccessMsg("重命名文件成功", this.m_UrlReferrer);
                 }
                 else
                 {
                     AdminPage.WriteErrMsg("<li>重命目标文件名已经存在。</li>", this.m_UrlReferrer);
                 }
             }
         }
         catch (FileNotFoundException)
         {
             AdminPage.WriteErrMsg("文件未找到", this.m_UrlReferrer);
         }
         catch (UnauthorizedAccessException)
         {
             AdminPage.WriteErrMsg("<li>重命名文件夹或文件失败!检查您的服务器是否给风格文件夹写入权限。</li>", this.m_UrlReferrer);
         }
     }
 }
Esempio n. 10
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            string filename = base.Request.PhysicalApplicationPath + @"\" + "App_Data" + @"\" + "LabelExport.xml";

            if (!FileSystemObject.IsExist(filename, FsoMethod.File))
            {
                function.WriteErrMsg("数据文件:../App_Data/LabelExport.xml 不存在");
            }
            try
            {
                DataSet ds   = new DataSet();
                M_Label info = new M_Label();
                ds.ReadXml(filename);
                DataTable dt    = ds.Tables["Table"];
                int       count = dt.Rows.Count;
                int       i     = 1;
                foreach (DataRow dr in dt.Rows)
                {
                    info.LabelID    = 0;
                    info.LableName  = dr["LabelName"].ToString();
                    info.LabelCate  = dr["LabelCate"].ToString();
                    info.Desc       = dr["LabelDesc"].ToString();
                    info.LableType  = DataConverter.CLng(dr["LabelType"]);
                    info.Param      = dr["LabelParam"].ToString();
                    info.LabelTable = dr["LabelTable"].ToString();
                    info.LabelField = dr["LabelField"].ToString();
                    info.LabelWhere = dr["LabelWhere"].ToString();
                    info.LabelOrder = dr["LabelOrder"].ToString();
                    info.LabelCount = dr["LabelCount"].ToString();
                    info.Content    = dr["LabelContent"].ToString();
                    string str2 = ((i * 100) / count).ToString("F1");
                    str2 = str2 + "%";
                    if (this.bll.IsExist(info.LableName))
                    {
                        info.LableName = info.LableName + DataSecurity.RandomNum(4);
                    }
                    this.bll.AddLabel(info);
                    this.tp.Style["Width"] = str2;
                    this.tn.Text           = str2;
                    this.tc.Text           = i.ToString();

                    i++;
                }
                this.tp.Style["Width"] = "100%";
                this.tn.Text           = "100%";
                this.tc.Text           = count.ToString();
                this.finallytd.Text    = "导入完毕";
            }
            catch
            {
                function.WriteErrMsg("导入标签出现异常!");
            }
        }
Esempio n. 11
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            DataSet ds       = this.bll.GetAllLabel();
            string  filename = base.Request.PhysicalApplicationPath + @"\" + "App_Data" + @"\" + "LabelExport.xml";

            if (!FileSystemObject.IsExist(filename, FsoMethod.File))
            {
                FileSystemObject.Create(filename, FsoMethod.File);
            }
            this.Label1.Text = "开始导出";
            ds.WriteXml(filename);
            this.Label1.Text = "成功!";
        }
 protected void EBtnCopyDir_Click(object sender, EventArgs e)
 {
     if (!FileSystemObject.IsExist(this.currentDirectory + this.TxtCopyDir.Text, FsoMethod.Folder))
     {
         base.Response.Write("<script type='text/javascript'>parent.frames[\"left\"].location.reload();</script>");
         FileSystemObject.CopyDirectory(this.currentDirectory + this.HdnCopyDir.Value, this.currentDirectory + this.TxtCopyDir.Text);
         AdminPage.WriteSuccessMsg("<li>复制目录成功。</li>", this.m_UrlReferrer);
     }
     else
     {
         AdminPage.WriteErrMsg("<li>重命名的目录已经存在了。</li>", this.m_UrlReferrer);
     }
 }
Esempio n. 13
0
    private void MyBind()
    {
        int       psize = 18, pcount = 0;
        DataTable dt = new DataTable();

        if (ZType.Equals("myimg"))
        {
            //---读取用户上传的资源
            myimg_div.Visible = true;
            res_div.Visible   = false;
            var    mu   = buser.GetLogin();
            string path = function.VToP("/UploadFiles/User/" + mu.UserName + mu.UserID);
            if (FileSystemObject.IsExist(path, FsoMethod.Folder))
            {
                dt = FileSystemObject.SearchImg(path);
            }
            Myimg_RPT.DataSource = PageCommon.GetPageDT(psize, CPage, dt, out pcount);
            Myimg_RPT.DataBind();
            ImgPage_Lit.Text = PageCommon.CreatePageHtml(pcount, CPage);
            emptyimg.Visible = dt.Rows.Count < 1;
        }
        else
        {
            dt             = resBll.Search("", "bk_h5", ZType, "", "", Style);
            RPT.DataSource = PageCommon.GetPageDT(psize, CPage, dt, out pcount);
            RPT.DataBind();
            Page_Lit.Text     = PageCommon.CreatePageHtml(pcount, CPage);
            empty_div.Visible = dt.Rows.Count < 1;
            //-------------------
            string[] styleArr = new string[0];
            switch (ZType)
            {
            case "shape":
                styleArr = ("全部," + resMod.ShapeStyle).Split(',');
                break;

            case "text":
                styleArr = ("全部," + resMod.TextStyle).Split(',');
                break;

            case "icon":
                styleArr = ("全部," + resMod.IconStyle).Split(',');
                break;
            }
            foreach (string name in styleArr)
            {
                string css = name.Equals(Style) ? "active" : "";
                style_ul.InnerHtml += "<li class=\"style_li " + css + "\" onclick=\"getto('" + HttpUtility.UrlEncode(name) + "');\">" + name + "</li>";
            }
        }
    }
Esempio n. 14
0
        public void CreateNodePage(int NodeID)
        {
            M_Node nodeinfo    = this.bnode.GetNode(NodeID);
            string NodeDir     = nodeinfo.NodeDir;
            string TemplateDir = SiteConfig.SiteOption.TemplateDir + nodeinfo.IndexTemplate;

            if (!string.IsNullOrEmpty(TemplateDir) && nodeinfo.ListPageHtmlEx < 3)
            {
                TemplateDir = this.SitePhyPath + TemplateDir;
                TemplateDir = TemplateDir.Replace("/", @"\");
                string ContentHtml = this.bll.CreateHtml(FileSystemObject.ReadFile(TemplateDir), 0, NodeID);


                string InfoFile = "/" + NodeDir + "/index";

                //文件扩展名
                int InfoFileEx = nodeinfo.ContentFileEx;
                switch (InfoFileEx)
                {
                case 0:
                    InfoFile = InfoFile + ".html";
                    break;

                case 1:
                    InfoFile = InfoFile + ".htm";
                    break;

                case 2:
                    InfoFile = InfoFile + ".shtml";
                    break;

                case 3:
                    InfoFile = InfoFile + ".aspx";
                    break;
                }
                nodeinfo.NodeUrl = InfoFile;
                InfoFile         = this.SitePhyPath + InfoFile;
                InfoFile         = InfoFile.Replace("/", @"\");
                if (FileSystemObject.IsExist(InfoFile, FsoMethod.File))
                {
                    FileSystemObject.WriteFile(InfoFile, ContentHtml);
                }
                else
                {
                    FileSystemObject.WriteFile(InfoFile, ContentHtml);
                }
                this.bnode.UpdateNode(nodeinfo);
            }
        }
Esempio n. 15
0
        public String GetAuthor()
        {
            string ppath = Server.MapPath(@"/Template/" + ProDir + @"/Info.config");

            if (FileSystemObject.IsExist(ppath, FsoMethod.File))
            {
                DataSet newtempset = new DataSet();
                newtempset.ReadXml(ppath);
                return(newtempset.Tables[0].Rows[0]["Author"].ToString());//Project
            }
            else
            {
                return(ProDir);
            }
        }
Esempio n. 16
0
        public String GetTlpName(string name)
        {
            string ppath = Server.MapPath(@"/Template/" + Eval("Name").ToString() + @"/Info.config");

            if (FileSystemObject.IsExist(ppath, FsoMethod.File))
            {
                DataSet newtempset = new DataSet();
                newtempset.ReadXml(ppath);
                return(newtempset.Tables[0].Rows[0][name].ToString());//Project
            }
            else
            {
                return(Eval("name").ToString());
            }
        }
Esempio n. 17
0
        private static void DeleteHtmlFile(string gengeralId)
        {
            IList <CommonModelInfo> commonModelListByGeneralID = GetCommonModelListByGeneralID(gengeralId);
            string file = HttpContext.Current.Server.MapPath("~/" + VirtualPathUtility.AppendTrailingSlash(SiteConfig.SiteOption.CreateHtmlPath));

            foreach (CommonModelInfo info in commonModelListByGeneralID)
            {
                NodeInfo cacheNodeById = EasyOne.Contents.Nodes.GetCacheNodeById(info.NodeId);
                file = file + ContentHtmlName(info, cacheNodeById, 0);
                if (FileSystemObject.IsExist(file, FsoMethod.File))
                {
                    FileSystemObject.Delete(file, FsoMethod.File);
                }
            }
        }
Esempio n. 18
0
        public IActionResult Shopindex()
        {
            string IndexDir = SiteConfig.SiteOption.ShopTemplate;

            IndexDir = function.VToP(SiteConfig.SiteOption.TemplateDir + "/" + IndexDir);
            if (!FileSystemObject.IsExist(IndexDir, FsoMethod.File))
            {
                return(WriteErr("[产生错误的可能原因:内容信息不存在或未开放!]"));
            }
            else
            {
                string IndexHtml = FileSystemObject.ReadFile(IndexDir);
                IndexHtml = bll.CreateHtml(IndexHtml, 0, 0, "0");
                return(HtmlToClient(IndexHtml));
            }
        }
Esempio n. 19
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                CheckInstalled();
            }
            string vpath       = SiteConfig.SiteOption.TemplateDir + "/" + SiteConfig.SiteOption.IndexTemplate.TrimStart('/');
            string TemplateDir = function.VToP(vpath);
            string fileex      = ".html";

            switch (SiteConfig.SiteOption.IndexEx)
            {
            case "0":
                fileex = ".html";
                break;

            case "1":
                fileex = ".htm";
                break;

            case "2":
                fileex = ".shtml";
                break;

            case "3":
                fileex = ".aspx";
                break;
            }
            if (FileSystemObject.IsExist(Server.MapPath("/index" + fileex), FsoMethod.File))
            {
                Response.Redirect("index" + fileex);
            }
            if (!FileSystemObject.IsExist(TemplateDir, FsoMethod.File))
            {
                ErrToClient("[产生错误的可能原因:(" + vpath + ")不存在或未开放!]");
            }
            else
            {
                string readfile  = FileSystemObject.ReadFile(TemplateDir);
                string IndexHtml = this.bll.CreateHtml(readfile);
                if (SiteConfig.SiteOption.IsSensitivity == 1)
                {
                    IndexHtml = sll.ProcessSen(IndexHtml);
                }
                Response.Write(IndexHtml);
            }
        }
Esempio n. 20
0
        public bool IsExistXML(string LabelName)
        {
            XmlDocument doc = new XmlDocument();

            doc.Load(dirfilename);
            XmlNode nodeinfo = doc.SelectSingleNode("//NewDataSet/Table[LabelName='" + LabelName + "']");

            if (nodeinfo != null)
            {
                string filename = dir + nodeinfo["LabelCate"].InnerText + @"\" + LabelName + ".label";
                return(FileSystemObject.IsExist(filename, FsoMethod.File));
            }
            else
            {
                return(false);
            }
        }
Esempio n. 21
0
        protected void Page_Load(object sender, EventArgs e)
        {
            CheckInstalled();
            string IndexDir = SiteConfig.SiteOption.IndexTemplate;

            IndexDir = base.Request.PhysicalApplicationPath + SiteConfig.SiteOption.TemplateDir + IndexDir;
            IndexDir = IndexDir.Replace("/", @"\");
            if (!FileSystemObject.IsExist(IndexDir, FsoMethod.File))
            {
                Response.Write("[产生错误的可能原因:您访问的内容信息不存在!]");
            }
            else
            {
                string IndexHtml = this.bll.CreateHtml(FileSystemObject.ReadFile(IndexDir), 0, 0);
                Response.Write(IndexHtml);
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            function.AccessRulo();
            B_Admin badmin = new B_Admin();

            if (!IsPostBack)
            {
                showDropDownList2();
            }
            DataTable table = new DataTable();

            table.Columns.Add(new DataColumn("Title", typeof(string)));
            table.Columns.Add(new DataColumn("ID", typeof(string)));
            table.Columns.Add(new DataColumn("Url", typeof(string)));
            ///type 0首页,1节点
            table.Columns.Add(new DataColumn("Type", typeof(int)));

            if (FileSystemObject.IsExist(Request.PhysicalApplicationPath + "index.html", FsoMethod.File))
            {
                DataRow row1 = table.NewRow();
                row1[0] = "首页";
                row1[1] = "0";
                row1[2] = Request.ApplicationPath + "index.html";
                row1[3] = 0;
                table.Rows.Add(row1);
            }
            DataTable nn = bn.SelectNodeHtmlXML();

            if (nn.Rows.Count > 0)
            {
                for (int i = 0; i < nn.Rows.Count; i++)
                {
                    if (FileSystemObject.IsExist(Request.PhysicalApplicationPath + nn.Rows[i]["NodeListUrl"], FsoMethod.File))
                    {
                        DataRow newrow = table.NewRow();
                        newrow[0] = nn.Rows[i]["NodeName"];
                        newrow[1] = nn.Rows[i]["NodeID"];
                        newrow[2] = nn.Rows[i]["NodeListUrl"];
                        newrow[3] = 1;
                        table.Rows.Add(newrow);
                    }
                }
            }
            gvCard.DataSource = table;
            gvCard.DataBind();
        }
        public void Shopindex()
        {
            string IndexDir = SiteConfig.SiteOption.ShopTemplate;

            IndexDir = base.Request.PhysicalApplicationPath + SiteConfig.SiteOption.TemplateDir + "/" + IndexDir;
            IndexDir = IndexDir.Replace("/", @"\");
            if (!FileSystemObject.IsExist(IndexDir, FsoMethod.File))
            {
                Response.Write("[产生错误的可能原因:内容信息不存在或未开放!]");
            }
            else
            {
                string IndexHtml = FileSystemObject.ReadFile(IndexDir);
                IndexHtml = createBll.CreateHtml(IndexHtml, 0, 0, "0");
                Response.Write(IndexHtml);
            }
        }
Esempio n. 24
0
        public static string DeleteUnusefualFile(string content, string defaultPicUrl, string uploadFiles)
        {
            string file = "";

            if (uploadFiles.IndexOf('|') > 1)
            {
                string[] strArray = uploadFiles.Split(new string[] { "|" }, StringSplitOptions.None);
                uploadFiles = "";
                foreach (string str2 in strArray)
                {
                    if ((content.IndexOf(str2, StringComparison.Ordinal) <= 0) && (str2 != defaultPicUrl))
                    {
                        file = Path.Combine(HttpContext.Current.Request.PhysicalApplicationPath, VirtualPathUtility.AppendTrailingSlash(SiteConfig.SiteOption.UploadDir) + str2).Replace("/", @"\");
                        if (FileSystemObject.IsExist(file, FsoMethod.File))
                        {
                            FileSystemObject.Delete(file, FsoMethod.File);
                            HttpContext.Current.Response.Write("<li>" + str2 + "在项目中没有用到,也没有被设为首页图片,所以已经被删除!</li>");
                        }
                        else if (string.IsNullOrEmpty(uploadFiles))
                        {
                            uploadFiles = str2;
                        }
                        else
                        {
                            uploadFiles = uploadFiles + "|" + str2;
                        }
                    }
                }
            }
            else if ((content.IndexOf(uploadFiles, StringComparison.Ordinal) <= 0) && (uploadFiles != defaultPicUrl))
            {
                file = Path.Combine(HttpContext.Current.Request.PhysicalApplicationPath, VirtualPathUtility.AppendTrailingSlash(SiteConfig.SiteOption.UploadDir) + uploadFiles).Replace("/", @"\");
                if (FileSystemObject.IsExist(file, FsoMethod.File))
                {
                    FileSystemObject.Delete(file, FsoMethod.File);
                    HttpContext.Current.Response.Write("<li>" + uploadFiles + "在项目中没有用到,也没有被设为首页图片,所以已经被删除!</li>");
                }
                uploadFiles = "";
            }
            if (string.IsNullOrEmpty(uploadFiles))
            {
                uploadFiles = defaultPicUrl;
            }
            return(uploadFiles);
        }
Esempio n. 25
0
        public void CreateIndex()
        {
            string IndexDir = SiteConfig.SiteOption.IndexTemplate;

            IndexDir = this.SitePhyPath + SiteConfig.SiteOption.TemplateDir + IndexDir;
            IndexDir = IndexDir.Replace("/", @"\");
            string IndexHtml = this.bll.CreateHtml(FileSystemObject.ReadFile(IndexDir), 0, 0);
            string objindex  = this.SitePhyPath + @"\" + "index.html";

            if (FileSystemObject.IsExist(objindex, FsoMethod.File))
            {
                FileSystemObject.WriteFile(objindex, IndexHtml);
            }
            else
            {
                FileSystemObject.WriteFile(objindex, IndexHtml);
            }
        }
Esempio n. 26
0
        public string[] GetFileSize()
        {
            int count = this.zoneConfig.Count;

            string[] strArray = new string[count];
            for (int i = 0; i < (count); i++)
            {
                if (FileSystemObject.IsExist(GetJsTemplatePath() + this.GetTemplateName(i), FsoMethod.File))
                {
                    strArray[i] = FileSystemObject.GetFileSize(GetJsTemplatePath() + this.GetTemplateName(i));
                }
                else
                {
                    strArray[i] = "0.0KB";
                }
            }
            return(strArray);
        }
Esempio n. 27
0
        /// <summary>
        /// 获得内容生成路径
        /// </summary>
        /// <param name="NodeID"></param>
        /// <param name="GeneralID"></param>
        /// <returns></returns>
        private string GetPath(string NodeID, int GeneralID)
        {
            M_Node       Nodeinfo      = nll.SelReturnModel(DataConverter.CLng(NodeID));
            string       ContentFileEx = GetNodeContentEx(Nodeinfo);//内容页文件扩展名
            string       ContentRoot   = "";
            M_CommonData Cdata         = cll.GetCommonData(GeneralID);

            int ContentPageHtmlRule = Nodeinfo.ContentPageHtmlRule;//内容页文件名规则

            switch (ContentPageHtmlRule)
            {
            case 0:
                string filepath = MakeHtmlFile(Nodeinfo) + "/" + Cdata.CreateTime.Year + "/" + Cdata.CreateTime.Month + "/" + Cdata.CreateTime.Day;
                if (!FileSystemObject.IsExist(filepath, FsoMethod.Folder))
                {
                    FileSystemObject.CreateFileFolder(filepath);
                }
                ContentRoot = "/" + Cdata.CreateTime.Year + "/" + Cdata.CreateTime.Month + "/" + Cdata.CreateTime.Date.ToShortDateString() + "/" + Cdata.GeneralID.ToString();
                break;

            case 1:
                filepath = MakeHtmlFile(Nodeinfo) + "/" + Cdata.CreateTime.Year + "-" + Cdata.CreateTime.Month;
                if (!FileSystemObject.IsExist(filepath, FsoMethod.Folder))
                {
                    FileSystemObject.CreateFileFolder(filepath);
                }
                ContentRoot = filepath + Cdata.GeneralID.ToString();
                break;

            case 2:
                ContentRoot = "/" + Cdata.GeneralID.ToString();
                break;

            case 3:
                filepath = MakeHtmlFile(Nodeinfo) + "/" + Cdata.CreateTime.Year + Cdata.CreateTime.Month + Cdata.CreateTime.Day;
                if (!FileSystemObject.IsExist(filepath, FsoMethod.Folder))
                {
                    FileSystemObject.CreateFileFolder(filepath);
                }
                ContentRoot = "/" + Cdata.CreateTime.Year + Cdata.CreateTime.Month + Cdata.CreateTime.Day + "/" + Cdata.Title;
                break;
            }
            return(ContentRoot + "." + GetNodeContentEx(Nodeinfo));
        }
Esempio n. 28
0
        public virtual void ErrorLog(string errMsg)
        {
            string file = this.m_MapPath + "Admin/CreateHtmlLog/" + this.CreateId + ".txt";

            if (!FileSystemObject.IsExist(this.m_MapPath + "Admin/CreateHtmlLog", FsoMethod.Folder))
            {
                FileSystemObject.Create(this.m_MapPath + "Admin/CreateHtmlLog", FsoMethod.Folder);
            }
            if (FileSystemObject.IsExist(file, FsoMethod.File))
            {
                FileSystemObject.WriteAppend(file, "\r\n" + errMsg);
            }
            else
            {
                FileSystemObject.Create(file, FsoMethod.File);
                FileSystemObject.WriteFile(file, "生成时间:" + this.CreateStartTime.ToString() + "\r\n" + errMsg);
            }
            this.m_CreateHasNewError = true;
        }
        private bool CreateAndCheckFolderPermission(SpecialCategoryInfo categoryInfo)
        {
            string file = VirtualPathUtility.AppendTrailingSlash(this.PhysicalApplicationPath) + VirtualPathUtility.AppendTrailingSlash(SiteConfig.SiteOption.CreateHtmlPath) + categoryInfo.SpecialCategoryDir;

            if (!FileSystemObject.IsExist(file, FsoMethod.Folder))
            {
                try
                {
                    FileSystemObject.Create(file, FsoMethod.Folder);
                }
                catch
                {
                    string errMsg = string.Concat(new object[] { "专题类别ID为:", categoryInfo.SpecialCategoryId, "  ", categoryInfo.SpecialCategoryName, " 生成失败! 失败原因:请检查服务器是否给网站", SiteConfig.SiteOption.CreateHtmlPath, "文件夹写入权限!" });
                    this.ErrorLog(errMsg);
                    return(false);
                }
            }
            return(true);
        }
Esempio n. 30
0
        private bool CreateAndCheckFolderPermission(SpecialInfo specialInfo)
        {
            string file = VirtualPathUtility.AppendTrailingSlash(this.PhysicalApplicationPath) + VirtualPathUtility.AppendTrailingSlash(SiteConfig.SiteOption.CreateHtmlPath) + specialInfo.SpecialDir;

            if (!FileSystemObject.IsExist(file, FsoMethod.Folder))
            {
                try
                {
                    FileSystemObject.Create(file, FsoMethod.Folder);
                }
                catch
                {
                    string errMsg = "专题ID:" + specialInfo.SpecialId.ToString() + "  " + specialInfo.SpecialName + " 生成失败! 失败原因:请检查服务器是否给网站" + SiteConfig.SiteOption.CreateHtmlPath + "文件夹写入权限!";
                    this.ErrorLog(errMsg);
                    return(false);
                }
            }
            return(true);
        }