private static treeDir gettree(treeDir fdir) { string fpaht = fdir.attributes.path; List<FileItem> fis = FileManager.GetDirectoryItems(fdir.fupath); foreach (FileItem fi in fis) { treeDir aaa = new treeDir(); //Sys.DebugMes(fi.FullName); aaa.fupath = fi.FullName; aaa.text = fi.Name; aaa.attributes = new attrib(fpaht + "\\" + fi.Name); aaa = gettree(aaa); if (aaa.text != "") { aaa.state = "closed"; //aaa.iconCls = "ico_tree_folder_close"; aaa.fupath = ""; fdir.children.Add(aaa); } } return fdir; }
public static string getTreeJson(string path,string name) { //string path = "D:\\程序设计\\2011"; //string path = "D:\\CNG\\程序设计\\2011"; string jsonT = ""; treeDir fdir = new treeDir(); fdir.attributes = new attrib(""); fdir.fupath = path; treeDir my = gettree(fdir); fdir.fupath = ""; fdir.text = name; //fdir.iconCls = "ico_tree_folder_close"; fdir.state = "closed"; jsonT = Json.Json_转换到json(my); return jsonT; //Sys.DebugMes("完成"); }