⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 createcheckfile.aspx.cs

📁 最好用的站点内容管理系统 全部源代码都有
💻 CS
字号:
//======================================================
//==     (c)2008 aspxcms inc by NeTCMS v1.0              ==
//==          Forum:bbs.aspxcms.com                   ==
//==         Website:www.aspxcms.com                  ==
//======================================================
using System;
using System.Data;
using System.IO;
using System.Collections.Generic;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using NetCMS.Content;
using NetCMS.Model;
using NetCMS.Content.Common;

namespace NetCMS.Web.manage.Sys
{
    public partial class CreateCheckfile : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                GetFiles();
            }
        }
        protected void GetFiles()
        {
            FileCompare fc = new FileCompare(Server.MapPath("~"), string.Empty);
            fc.GetFileList();
            List<FileComprInfo> list = fc.FileList;
            list.Sort(new FileNameComparer());
            DateTime Now = DateTime.Now;
            StreamWriter sw = null;
            string xmlfile = HttpContext.Current.Server.MapPath("./" + Now.ToString("yyyyMMddHHmmss") + ".xml");
            sw = File.CreateText(xmlfile);
            sw.WriteLine("<?xml version=\"1.0\" encoding=\"utf-8\"?>\r");
            sw.WriteLine("<rss version=\"2.0\">\r");
            sw.WriteLine("<netcms>\r");
            foreach (FileComprInfo info in list)
            {
                if (info.FaModifyTime != DateTime.MinValue)
                    sw.WriteLine("<file name=\"" + info.FileName + "\" size=\"" + info.FaFileSize + "\" modifytime=\"" + info.FaModifyTime + "\" />");
            }
            sw.WriteLine("</netcms>");
            sw.WriteLine("</rss>");
            sw.Flush();
            sw.Close(); sw.Dispose();
            //Response.End();
        }
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -