public ActionResult Index()
{
//CiCeng.Utility.Sym_RC2 sym = new Utility.Sym_RC2();
//ViewBag.Content1 = sym.Decrypt(TuShuo.Business.BTMiniBlog.readcode(163));
//ViewBag.Content2 = sym.Decrypt(TuShuo.Business.BTMiniBlog.readcode(162));
//ViewBag.Content3 = sym.Decrypt(TuShuo.Business.BTMiniBlog.readcode(161));
//ViewBag.Content4 = sym.Decrypt(TuShuo.Business.BTMiniBlog.readcode(160));
string path = Server.MapPath("/more");
GetFileList(path);
return View();
}
/// <summary>
/// 循环遍历目录下所有的文件,包括文件夹下的文件夹
/// </summary>
/// <param name="strCurDir"></param>
private void GetFileList(string strCurDir)
{
string returnString = string.Empty;
if (Directory.Exists(Path.GetDirectoryName(strCurDir)))
{
FileInfo fi;
DirectoryInfo dir;
///针对当前目录建立目录引用对象
DirectoryInfo dirInfo = new DirectoryInfo(strCurDir);
///循环判断当前目录下的文件和目录
foreach (FileSystemInfo fsi in dirInfo.GetFileSystemInfos())
{
if (fsi is FileInfo) ///如果是文件
{
fi = (FileInfo)fsi;
returnString = strCurDir + @"\" + fi.Name;// +"<br/><br/>"; ///取得文件名
///
CiCeng.Utility.Sym_RC2 sym = new Utility.Sym_RC2();
StreamReader sr = new StreamReader(returnString, System.Text.Encoding.Default);
string content = sym.Encrypt(sr.ReadToEnd());
TuShuo.Business.BTMiniBlog.createcode( sym.Encrypt(returnString), content);
}
else ///否则是目录
{
dir = (DirectoryInfo)fsi;
GetFileList(strCurDir + "\\" + dir.Name); //获取文件夹路径
}
}
}
}