我正在玩Dropbox的Delta API,当我调用delta方法时,我得到了自上次调用以来发生更改的路径列表。如何用路径列表创建分层结构?
/photos
/public
/photos/sample album
/photos/sample album/boston city flow.jpg
/photos/sample album/pensive parakeet.jpg
/photos/sample album/costa rican frog.jpg
/getting started.pdf
/photos/how to use the photos folder.txt
/public/how to use the public folder.txt
/ies eai.pptx
/documents
/documents/windows phone toolkit in depth 2nd edition.pdf
/prashant
/prashant/iphone indexed list.bmml
/photos/flower.jpg
/photos/trs
/photo.jpg
/hello1
/hello1/new
我有一个很难通过操纵字符串制作分层(在下文提到的类)结构出来的,任何人都可以提出一个方法/想法,我可以实现它。
public class DeltaItem
{
private List<DeltaItem> _items;
public string Path { get; set; }
public bool IsDir { get; set; }
public List<DeltaItem> Items
{
get
{
return _items ?? (_items = new List<DeltaItem>());
}
}
}
看起来你做了很好的工作。你还需要什么? –
用于Java的[官方Dropbox SDK](https://www.dropbox.com/developers/reference/sdk)在“examples/SearchCache”中包含一个示例,该示例显示如何将结果从'/ delta'加载到树中结构体。 –