Exemple #1
0
        private dir gettree(dir fdir)
        {
            string fpaht = fdir.attributes.path;
            List<FileItem> fis = FileManager.GetDirectoryItems(fdir.fupath);

            foreach (FileItem fi in fis)
            {
                dir aaa = new dir();
                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;
        }
Exemple #2
0
 private void button3_Click(object sender, EventArgs e)
 {
     //string path = "D:\\程序设计\\2011";
     string path = "D:\\CNG\\程序设计\\2011";
     string jsonT = "";
     dir fdir = new dir();
     fdir.attributes = new attrib("");
     fdir.fupath = path;
     dir my = gettree(fdir);
     fdir.fupath = "";
     //fdir.iconCls = "ico_tree_folder_close";
     fdir.state = "open";
     jsonT = Json.Json_转换到json(my);
     textBox1.Text = jsonT;
     Sys.DebugMes("完成");
 }