0

我有一个与 Amazon S3 Web 服务交互的 NET 后端。我在前端使用 Javascript 库 (ExtJs) 来尝试创建文件浏览器。为了做到这一点,我必须转换亚马逊中的所有文件路径,比如

Directory1/SubDirectory1/File.txt

Directory1/SubDirectory2/File2.txt

Directory2/SubDirectory3/File3.txt

到一个像这样的 JSON 树:

 root: {
        expanded: true,
        children: [
            { text: "Directory1", expanded: true, children: [
                { text: "SubDirectory1", children: [
                  {text:"File.txt", leaf: true }
                  ]
                },
                { text: "SubDirectory2",children: [
                  {text: "File2.txt"",leaf: true}
                 ]
               } 
            ] },
            { text: "Director2", expanded: true, children:[
                 {text:"SubDirectory3",children: [
                   {text:"File3.txt",leaf: true}
                     ]
                  }
             ]
             }
    }

任何人都知道在 .NET 中执行此操作的好方法吗?无论如何,我能想到的似乎非常容易出错或非常低效。

4

0 回答 0